fabioz / PyDev.Debugger

Sources for the debugger used in PyDev, PyCharm and VSCode Python
Eclipse Public License 1.0
425 stars 122 forks source link

pydevd_sys_monitoring crashing with inexplicable TypeError #280

Open bernd-wechner opened 3 months ago

bernd-wechner commented 3 months ago

A strange crash in the debugger:

    for filename in os.listdir(target):
  File "<stringsource>", line 69, in cfunc.to_py.__Pyx_CFunc_7f6725__29_pydevd_sys_monitoring_cython_object__lParen__etc_to_py_4code_11from_offset_9to_offset.wrap
  File "_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx", line 1332, in _pydevd_sys_monitoring_cython._jump_event
TypeError: an integer is required

I am using:

  PyDev for Eclipse 12.1.0.202405272215 org.python.pydev.feature.feature.group  Fabio Zadrozny
  PyDev for Eclipse Developer Resources 12.1.0.202405272215 org.python.pydev.feature.source.feature.group   Fabio Zadrozny

in Eclipse:

Version: 2024-03 (4.31.0)
Build id: 20240307-1437

I restarted Eclipse, no change. I pulled an age old trick I picked up in the 1980s no less, of inserting a null statement just before the crash line (in Python a pass statement). And voila, the crash disappeared.

Essentially:

for filename in os.listdir(target):
      <my guff>

crashes, and this:

for filename in os.listdir(target):
      <my guff>
      pass

does not. So my code moving forwards reads:

for filename in os.listdir(target):
      <my guff>
      pass # Debugger 12.1 bug crashes here without this statement

I reckon there's still a line thus annotated in FORTRAN code I wrote in the '80s and maybe a few other code bases around the world ;-).

fabioz commented 3 months ago

Thank you for the report (this may need a bit of investigation on my side...).