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
pdb help fails with AttributeError when using Windows embeddable package #90592
Comments
When running python from an embeddable windows zip file such as: the Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
>>> import pdb
>>> pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) help interact
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bdb.py", line 92, in trace_dispatch
File "bdb.py", line 151, in dispatch_return
File "pdb.py", line 294, in user_return
File "pdb.py", line 357, in interaction
File "pdb.py", line 322, in _cmdloop
File "cmd.py", line 138, in cmdloop
File "pdb.py", line 422, in onecmd
File "cmd.py", line 217, in onecmd
File "pdb.py", line 1496, in do_help
AttributeError: 'NoneType' object has no attribute 'rstrip'
>>>
>>> print(pdb.Pdb.do_interact.__doc__)
None |
Perhaps we should have a more generic check for https://github.com/python/cpython/blob/v3.9.10/Lib/pdb.py#L1492-L1496 |
The PR looks good. I assume you've started the CLA process, so once that clears we'll be fine to merge. |
Thanks, yes CLA should now be working its way through the system. I guess a side question is: is it expected for docstring to have been stripped from the windows embeddable distribution, and how is that done if not with -OO? (I found --without-doc-strings but not any build scripts using it) This patch is still valid either way I think - better to show a helpful error than to explode - but I am intrigued as to the reason behind this case, deliberate or not. e.g. is there an assumption that the embed redistributable is never going to be used interactively & thus we might as well save space? |
See Lines 256 to 289 in b04dfbb
Basically, the .pyc files in the embeddable distro have been compiled with optimize=2, which is the equivalent of -OO. So yes, docstrings (and asserts) are expected to have been removed. It shouldn't be removing docstrings from other modules that you provide yourself. |
Gottit thanks for explaining - so the existing check in |
Precisely. Your check is much more appropriate for what the actual issue |
Thanks for the contribution! |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: