Menu

"RuntimeWarning: tp_compare" error debugging

jaimecham
2007-03-14
2013-03-15
  • jaimecham

    jaimecham - 2007-03-14

    Strange problem while running PyDev 1.2.9 with Eclipse SDK 3.2.1 on Windows XP.
    The following simple script:

    import simplejson
    print simplejson.loads('"foo"')

    Produces the following on the Console when under "Debug":

    pydev debugger
    C:\Python25\Lib\threading.py:699: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
      return _active[_get_ident()]
    Traceback (most recent call last):
      File "C:\Program Files\Eclipse-WTP\plugins\org.python.pydev.debug_1.2.9\pysrc\pydevd.py", line 475, in trace_dispatch
        t = threading.currentThread()
      File "c:\python25\lib\threading.py", line 699, in currentThread
        return _active[_get_ident()]
    GeneratorExit
    Exception exceptions.SystemError: 'error return without exception set' in <generator object at 0x00C76378> ignored
    pydev debugger
    C:\Python25\Lib\threading.py:699: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
      return _active[_get_ident()]
    Traceback (most recent call last):
      File "C:\Program Files\Eclipse-WTP\plugins\org.python.pydev.debug_1.2.9\pysrc\pydevd.py", line 475, in trace_dispatch
        t = threading.currentThread()
      File "c:\python25\lib\threading.py", line 699, in currentThread
        return _active[_get_ident()]
    GeneratorExit
    Exception exceptions.SystemError: 'error return without exception set' in <generator object at 0x00C76378> ignored
    foo

    Under "Run", no such trouble.

    This is with several versions of the Cheeseshop's simplejson module. I haven't been able to reproduce this with other modules, but what could simplejson be doing to cause this.

    Awesome tool PyDev, btw, thanks!

    Jaime

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-03-18

      Strange... I really don't know what could be doing 'threading.currentThread()' give an error... it could be that simplejson does something in this regard (have you asked to the simplejson developers? -- it might be that they are doing some strange interaction with the threading or tracing facility that is making this appear while in debug mode)

       
      • Aaron Bingham

        Aaron Bingham - 2007-06-07

        We observed a similar error with our system which has nothing to do with JSON.  I was able to narrow it down to this little script:

        import tokenize
        def next(token, string, start, end, line):
            raise tokenize.StopTokenizing()
        def getEmptyString():
            return ''
        tokenize.tokenize(getEmptyString, next)

        The script reliably produces the below output when debugging under PyDev with Python 2.5.  The script completes with out error when "Running" under PyDev or when using Python 2.4.

        pydev debugger
        /usr/lib64/python2.5/threading.py:699: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
          return _active[_get_ident()]
        Traceback (most recent call last):
          File "/home/bingham/eclipse/plugins/org.python.pydev.debug_1.3.4/pysrc/pydevd.py", line 520, in trace_dispatch
            t = threading.currentThread()
          File "/usr/lib64/python2.5/threading.py", line 699, in currentThread
            return _active[_get_ident()]
        GeneratorExit
        Exception exceptions.SystemError: 'error return without exception set' in <generator object at 0x8563f8> ignored

        Aaron

         
        • Fabio Zadrozny

          Fabio Zadrozny - 2007-06-08

          It appears a python bug... I can reproduce it with the code below (without the debugger)

          import threading

          def func(frame, event, arg):
              try:
                  threading.currentThread()
              except:
                  print 'Ok, I have no clues why an exception is raised here'
              return func

          import sys
          sys.settrace(func)

          import tokenize
          def next(token, string, start, end, line):
             raise tokenize.StopTokenizing()
          def getEmptyString():
             return ''
          tokenize.tokenize(getEmptyString, next)

           
    • jaimecham

      jaimecham - 2007-03-21

      Not sure, looking through their source, there is no mention or usage of threading related modules. You wouldn't expect them to be as, as the name implies, it's just a simple JSON encoder/decoder.

       
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-06-08