-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141781: Fix pdb line prefix binding #141779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-141781: Fix pdb line prefix binding #141779
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Okay even though this is not an officially documented behavior, it has been like this for a long time and there is some comments in the source code about it. Also it does not cost us too much to revert the behavior back (the old behavior also makes more sense). In order to prevent cases like this happen in the future, could you also add a quick regression test on it? To make sure changing Also, even though minor, this still is still a behavior change. You need to add a news entry to it. Click the failed Let me know if you are stuck. |
|
Thank you @gaogaotiantian sir for the guidance. Please let me know if anything needs to be adjusted or improved. Thank you again for your help.❤️ |
Remove unnecessary newline in test case.
Added a test for function finding with encoding cookie.
|
Okay this behavior has been like this since the beginning, at least 25 years ago. However I still don't think it makes sense to be like this. I won't backport this because it's hardly a bug fix and it's definitely not a regression. Let's just silently fix this and keep this as an unsupported undocumented thing. |
Description
This PR fixes a logic issue in
pdb.print_stack_entry. Previously,prompt_prefixusedline_prefixas a default argument, which caused the value to be bound at definition time (when the module is imported).This prevented users from customizing
pdb.line_prefixdynamically after import, as the function would continue using the initial value.Changes:
prompt_prefixtoNone.line_prefixifprompt_prefixisNone._get_tb_and_exceptions("tracecack" -> "traceback").Linked Issue
Fixes #141781