Comments (6)
I may be misunderstanding the paragraph. Perhaps the convenience variable is restricted to the scope of the command and should not be persistent throughout the entire debugging session.
Example program
from itertools import product
x_axis = range(6)
y_axis = range(6)
for x,y in product(x_axis, y_axis):
...
In the same directory .pdbrc
$equal_components = []
b 7, (x ==y)
commands
$equal_components.append((x,y))
print($equal_components)
continue
Displays *** SyntaxError: invalid syntax
Instead I attempt
b 7, (x ==y)
commands
$equal_components.append((x,y))
print($equal_components)
continue
Then invoke with python -m pdb example.py
and manually type
(Pdb) commands
(com) $equal_components = []
(com) end
(Pdb) continue
Which does not work either, I'm presuming because there is no breakpoint to associate that command with.
What does work is
b 7, (x ==y)
commands
print((x,y))
continue
Breakpoint 1 at /tmp/example_pdbrc.py:7
(Pdb) c
(0, 0)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
(1, 1)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
(2, 2)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
(3, 3)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
(4, 4)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
(5, 5)
> /tmp/example_pdbrc.py(7)<module>()
-> ...
The program finished and will be restarted
from cpython.
First of all, you listed that you were using Python 3.11, is that the case? Convenience variable is a feature added in Python 3.12 so it won't work with 3.11.
from cpython.
First of all, you listed that you were using Python 3.11, is that the case? Convenience variable is a feature added in Python 3.12 so it won't work with 3.11.
Ah, let me try 3.12 with your backport
from cpython.
Defining a convenience variable through .pdbrc
does indeed work correctly when using 3.12 with your backport. Although from the paragraph I believe I was misunderstanding how it persists between breakpoints (it doesn't appear to).
With that being said I do find it unclear that convenience variables were added in 3.12 or specific convenience variables ($_frame
, etc.) were added in 3.12, or really what of the previous 6 paragraphs was added 3.12.
from cpython.
I agree that the added version is not super clear and I can try to improve it. However, about the persistence:
The convenience variables are cleared when the program resumes execution
Your program resumes execution between breakpoints so the convenience variables will be cleared. I think this behavior is well-described.
from cpython.
Yes I misunderstood the behavior of the convenience variables. As such I will close this.
from cpython.
Related Issues (20)
- Pandas cannot import numpy in free-threaded version of 3.13.0b2 HOT 7
- Runtime Error: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. HOT 3
- Skip `test_free_threading` with GIL HOT 2
- Type error in the section on type hints HOT 2
- Bug in smtplib example HOT 5
- unittest loaders should avoid loading test cases that are abstract base classes HOT 1
- Failing configure tests due to missing space HOT 5
- Protect multi-line macros expansions in `_test*.c` files HOT 1
- Use `@file` for gcc commands HOT 11
- New REPL does not include globals from executed module when used with `-i` HOT 3
- Python 3.13.0b2: rounding can cause incorrect log timestamps HOT 1
- Removed unused internal C API functions
- test_email fails on WASI: thread 'main' has overflowed its stack HOT 1
- faulthandler will hang the process with a TSAN and free-thread build Python HOT 5
- cpython HOT 1
- locals() does not include local variables set in exec() statement in 3.13b2 HOT 33
- `datetime.strftime("%Y")` is not padding correctly HOT 7
- psutil fails (segfault) on macOS in the free-threaded (python3.13t) version HOT 3
- Python 3.13 interactive console - CTRL-C does not give control back to gdb HOT 1
- No precise location provided for bytecode of lambda function returning a constant value HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.