You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make pdb.set_trace() accept debugger commands as arguments and run them after entering the debugger #70915
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2016-04-10.12:22:09.028>labels= ['extension-modules', 'type-feature', 'library']
title='make pdb.set_trace() accept debugger commands as arguments and run them after entering the debugger'updated_at=<Date2016-04-10.14:58:11.509>user='https://bugs.python.org/THRlWiTi'
I usually insert the following line in the middle of code to start the debugger from there:
importpdb; pdb.set_trace()
More often than not, I need to run some commands immediately after entering the debug mode, e.g. watch (display) some variables, create some additional break points, etc.
AFAIK currently you have to enter those commands manually on each run and there is no simple way to pass those commands from the source code.
Of-course one can invoke pdb as a script ("python3 -m pdb -c ...") and pass the desired commands to the script. But still using pdb.set_trace() is a popular method and I think it would be very useful to have set_trace() accept a list of strings as arguments and execute them right after entering the debugger.
Activity
THRlWiTi commentedon Apr 10, 2016
I usually insert the following line in the middle of code to start the debugger from there:
More often than not, I need to run some commands immediately after entering the debug mode, e.g. watch (display) some variables, create some additional break points, etc.
AFAIK currently you have to enter those commands manually on each run and there is no simple way to pass those commands from the source code.
Of-course one can invoke pdb as a script ("python3 -m pdb -c ...") and pass the desired commands to the script. But still using pdb.set_trace() is a popular method and I think it would be very useful to have set_trace() accept a list of strings as arguments and execute them right after entering the debugger.
gaogaotiantian commentedon Feb 18, 2025
This is done in #120255