Author serhiy.storchaka
Recipients Ricyteach, pitrou, serhiy.storchaka, yselivanov
Date 2018-04-22.05:45:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1524375939.74.0.682650639539.issue33328@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you for your report Rick. But I get the same error in 3.6.

An AttributeError is raised if the debugger runs at the interpreter shutdown stage (sys.is_finalizing() returns True). sys.path was set to None at the beginning of modules cleanup. The debugger traces the _ag() asynchronous generator in types.py. You can see some details when run Python with option -v.

$ ./python -v ../demo.py
...
import 'pdb' # <_frozen_importlib_external.SourceFileLoader object at 0x7f5b45debae8>
# extension module 'readline' loaded from '/home/serhiy/py/cpython/build/lib.linux-x86_64-3.8-pydebug/readline.cpython-38dm-x86_64-linux-gnu.so'
# extension module 'readline' executed from '/home/serhiy/py/cpython/build/lib.linux-x86_64-3.8-pydebug/readline.cpython-38dm-x86_64-linux-gnu.so'
import 'readline' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7f5b45d94608>
GeneratorExit

# clear builtins._
# clear sys.path
# clear sys.argv
...
# cleanup[3] wiping re
# destroy _locale
# destroy sre_compile
# destroy copyreg
# cleanup[3] wiping enum
# cleanup[3] wiping types
Exception ignored in: <async_generator object _ag at 0x7f6de03f0eb8>
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/types.py", line 27, in _ag
  File "/home/serhiy/py/cpython/Lib/bdb.py", line 90, in trace_dispatch
  File "/home/serhiy/py/cpython/Lib/bdb.py", line 128, in dispatch_call
  File "/home/serhiy/py/cpython/Lib/bdb.py", line 250, in break_anywhere
  File "/home/serhiy/py/cpython/Lib/bdb.py", line 49, in canonic
AttributeError: 'NoneType' object has no attribute 'abspath'

Adding "del _ag" in types.py fixes this issue. But there are open questions.

Is it good that the debugger is enabled at the shutdown stage?

Why the code of the never used asynchronous generator is executed at all?
History
Date User Action Args
2018-04-22 05:45:39serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, yselivanov, Ricyteach
2018-04-22 05:45:39serhiy.storchakasetmessageid: <1524375939.74.0.682650639539.issue33328@psf.upfronthosting.co.za>
2018-04-22 05:45:39serhiy.storchakalinkissue33328 messages
2018-04-22 05:45:38serhiy.storchakacreate