#813 Errors debugging .throw() generator function

debugger (210)
Cyrus Daboo

When running the attached file under the PyDev debugger a RuntimeWarning occurs for threading.py plus a "SystemError: error return without exception set" is raised. That does not happen when running normally without the debugger and it does not happen if the .throw() is commented out. So it looks like this is a combination of PyDev debugger's tracing and the generator .throw() (new in Python 2.5) causing a problem.

This is a big problem for me as the project I am working on uses generator .throw() a lot. Most of the time this just spews the "SystemError" to the log and the app continues to run - but that makes it really hard to see legitimate debug messages. Sometimes when trying to debug an exception thrown inside a generator, the SystemError exception is propagated out instead of the actual exception raised. This makes it impossible to debug.

The attached testing.py clearly illustrates the problem - run under the debugger the output is:

pydev debugger: starting
called send
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py:697: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
return _active[_get_ident()]
Traceback (most recent call last):
File "/Volumes/Data/Users/cyrusdaboo/Documents/Development/Tools/eclipse-3.4/plugins/org.python.pydev.debug_1.3.24/pysrc/pydevd.py", line 867, in <module>
debugger.run(setup['file'], None, None)
File "/Volumes/Data/Users/cyrusdaboo/Documents/Development/Tools/eclipse-3.4/plugins/org.python.pydev.debug_1.3.24/pysrc/pydevd.py", line 701, in run
execfile(file, globals, locals) #execute the script
File "/Volumes/Data/Users/cyrusdaboo/Documents/Development/Apple/eclipse/CalendarServer/testing.py", line 16, in <module>
result = i.throw(ValueError("Raised ValueError"))
File "/Volumes/Data/Users/cyrusdaboo/Documents/Development/Apple/eclipse/CalendarServer/testing.py", line 6, in gener
k = yield i
SystemError: error return without exception set

I am on OS X 10.5.5 using Python 2.5. This has been a problem for quite a while and mostly I ignored it, but now that the wrong exception seems to be propagating up, things are really bad!

A quick fix or patch I can apply locally would be appreciated.


  • Cyrus Daboo

    Cyrus Daboo - 2008-12-03
  • Fabio Zadrozny

    Fabio Zadrozny - 2008-12-05

    Actually, that's a Python bug (not solvable by the debugger). I believe it's already fixed in the latest 2.6 version (or maybe even 2.5.2)

  • Fabio Zadrozny

    Fabio Zadrozny - 2008-12-05
    • status: open --> closed-works-for-me
  • Cyrus Daboo

    Cyrus Daboo - 2008-12-05

    OK. I pulled down Python 2.6.1 and checked and that was fine.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks