abseil/abseil-py

absl.logging possibly causing PyCharm debugger to crash during tests

gabrielcnr opened this issue · 1 comments

After absl.logging is imported (it calls automatically _initialize() at the end of the module), when debugging a test in PyCharm and interacting with the Console, it crashes with:

object address  : 0x7fb070177a60
object refcount : 7
object type     : 0x55a849bb83c0
object type name: ValueError
object repr     : ValueError('I/O operation on closed file.')
lost sys.stderr

After that, any further interaction in the Console crashes with:

  File "/home/cforgie/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1850, in do_it
    result, exception_occurred = pydevd_console_integration.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cforgie/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 191, in console_exec
    updated_globals.update(frame.f_globals)
                           ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'f_globals'

I believe there is a conflict between absl.logging and the console used by the PyCharm debugger (@fabioz)

Since the traceback is from pydevd, and absl.logging. _initialize() itself only tries to create the ABSLLogger instance (and doesn't install loggers, which only happens by calling use_absl_handler), it's unclear if there is an action item on the absl.logging side. So closing.