[issue47148] sys.path.append before import the module causing module don't have doc-string?
Zachary Ware
report at bugs.python.org
Tue Mar 29 09:42:30 EDT 2022
Zachary Ware <zachary.ware at gmail.com> added the comment:
I can't reproduce this without the `-OO` option:
-OO : do -O changes and also discard docstrings; add .opt-2 before
.pyc extension
Note that I did slightly adjust your `b.py` script to do `print(a.multiply.__doc__)`, but here's what I tried:
~/issue47148_test/parent/another folder $ cat ../a.py
def multiply():
"""multiply stuff"""
return 69*420
~/issue47148_test/parent/another folder $ cat b.py
import sys
sys.path.append('..')
import a
print(a.multiply.__doc__)
~/issue47148_test/parent/another folder $ python b.py
multiply stuff
~/issue47148_test/parent/another folder $ python -O b.py
multiply stuff
~/issue47148_test/parent/another folder $ python -OO b.py
None
----------
nosy: +zach.ware
resolution: -> works for me
status: open -> pending
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47148>
_______________________________________
More information about the Python-bugs-list
mailing list