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
/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
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.