mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
Issue 5021: doctest.testfile should set __name__
This commit is contained in:
parent
cdc9f2c1d5
commit
8c0cee814f
3 changed files with 8 additions and 1 deletions
|
@ -103,7 +103,7 @@ def namedtuple(typename, field_names, verbose=False):
|
|||
# where the named tuple is created. Bypass this step in enviroments where
|
||||
# sys._getframe is not defined (Jython for example).
|
||||
if hasattr(_sys, '_getframe'):
|
||||
result.__module__ = _sys._getframe(1).f_globals['__name__']
|
||||
result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue