gotcha / ipdb

Integration of IPython pdb
BSD 3-Clause "New" or "Revised" License
1.85k stars 146 forks source link

Tests fail in upcoming Python 3.13 #279

Open troycurtisjr opened 3 months ago

troycurtisjr commented 3 months ago

The Fedora team is testing Python packages against the upcoming Python 3.13 release (which is currently in Beta testing) , and ipdb 0.13.13 tests fail on this version. In the test OptsTest.test_debug_module_script_3_11 it goes into an infinite loop printing:

ImportError: No module named my_buggy_module_3_11
The program exited via sys.exit(). Exit status: 1
ImportError: No module named my_buggy_module_3_11
The program exited via sys.exit(). Exit status: 1

It looks like there were quite a few changes to Python's pdb module since 3.12. I've poked around a bit to determine what the issue is, but I'm not very familiar with the ipdb or pdb implementation details. One interesting change that I noted was that the pdb._user_requested_quit check was moved out of the try clause in the main loop of pdb. It looks like the ipdb is based largely on this arrangement, so it may also need to be tweaked in a similar fashion (though just doing so breaks other tests, though it does fix the infinite loop!)

I'll continue poking around in an effort to understand what is going on, but I opted to create this issue in case others are interested in helping to investigate.

To test, you can use the instructions found in the Fedora copr repo: https://copr.fedorainfracloud.org/coprs/g/python/python3.13/ though that might leverage tooling which is very specific to Fedora.

troycurtisjr commented 3 months ago

The patch file for the pdb modules changes from 3.12.3 to 3.13 which might be of interest:

pdb-3.12-to-3.13-changes-patch.txt