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
Traceback (most recent call last):
File "/home/noel/Work/20231226-doctest-bug/tokenize.py", line 3, in <module>
doctest.testmod()
File "/usr/lib/python3.10/doctest.py", line 1969, in testmod
for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
File "/usr/lib/python3.10/doctest.py", line 917, in find
source_lines = linecache.getlines(file, module.__dict__)
File "/usr/lib/python3.10/linecache.py", line 46, in getlines
return updatecache(filename, module_globals)
File "/usr/lib/python3.10/linecache.py", line 136, in updatecache
with tokenize.open(fullname) as fp:
AttributeError: module 'tokenize' has no attribute 'open'
CPython versions tested on:
3.10, 3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered:
This is expected behavior, not a bug. Your modules take precedence over the standard library, so if you shadow a standard library module name, your module will be imported in place of the standard library one, and won't have the contents expected by other standard library modules using it. The solution is not to shadow standard library module names with your modules.
In #95754 we recently merged a change to help clarify the error messages in this situation.
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
If the following file is saved as
tokenize.py
orlinecache.py
, then it fails with an error when run:For
tokenize.py
:CPython versions tested on:
3.10, 3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: