-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
py.ml references __main__.__builtins__ in a couple places. According to the docs, this attribute is an implementation detail and its behavior can't be relied upon:
CPython implementation detail: Users should not touch
__builtins__; it is strictly an implementation detail.
This causes problems when running code under pdb. In pdb __main__.__builtins__ is a dict, not a module:
$ echo 'import __main__; print(type(__main__.__builtins__))' > foo.py
$ python3 foo.py
<class 'module'>
$ python3 -m pdb -c c -c q foo.py
<class 'dict'>
The program finished and will be restarted
This causes exceptions like
AttributeError: 'dict' object has no attribute 'SomeBuiltinThing'
when you try to reference attributes on this module.
Instead, py.ml should import the builtins module or reference sys.modules['builtins'].
Metadata
Metadata
Assignees
Labels
No labels