python / cpython

The Python programming language
https://www.python.org
Other
63.53k stars 30.44k forks source link

limitations of new multiline code and closure support in pdb #126958

Open limwz01 opened 16 hours ago

limwz01 commented 16 hours ago

Bug report

Bug description:

The following code is the template to illustrate the problems:

#!/usr/bin/env python3.13
g0 = 0
def main():
    import pdb
    pdb.Pdb().set_trace()
if __name__ == "__main__":
    main()

The problems:

CPython versions tested on:

3.13

Operating systems tested on:

Linux

limwz01 commented 12 hours ago

An approach similar to mine at https://github.com/limwz01/ipython_utils and published at https://pypi.org/project/ipython-utils/ might help here. My code is very complicated but that's also because I wanted to support dynamic reloading of the code after an exception.

gaogaotiantian commented 11 hours ago

Thank you for the detailed report and the many test cases. Like I said in the other issue, we might not be able to fix all of them, but I'll see if there's something cheap and readable thing I can do to fix some of these!