[PEAK] setuptools: Test works only after second invocation

Nikolaus Rath Nikolaus at rath.org
Thu Apr 29 15:38:45 EDT 2010


On 04/29/2010 02:36 PM, P.J. Eby wrote:
> At 12:34 PM 4/29/2010 -0400, Nikolaus Rath wrote:
>> Is setuptools by any chance doing more of this kind of black magic?
> 
> Sure, lots.  ;-)
> 
>> I'm about to start debugging a second, even more mysterious looking
>> problem when running the test command. If it is used in combination
>> with Psyco, I get exceptions after all the tests have completed:
> 
> These exceptions are happening at Python shutdown.  You can tell by this
> bit:
> 
>>     return embedframe(_psyco.getframe(depth+1))
>> AttributeError: 'NoneType' object has no attribute 'getframe'
> 
> _psyco is obviously 'None' here -- which would only happen during the
> Python shutdown phase where the interpreter sets *all* module globals to
> None.  So the problem is that your excepthook implementation is running
> during that phase.  It probably doesn't have anything to do with
> setuptools, but you'll need to change your code to work correctly at
> shutdown time in order to find out what the real error(s) are.

Actually I don't provide my own sys.excepthook implemention. But I think Ubuntu's apport may be messing with this, so I explicitly reset it to sys.__excepthook__ now.

This is the error message that I get: (note that it only happens if the test is run by setuptools *and* if Psyco is enabled. If the test is run directly, or if Psyco is not enabled, everything works fine):

Ran 1 test in 4.193s

OK
Exception TypeError: "'NoneType' object is not callable" in <frame object at 0x8ecb9fc> ignored
Exception TypeError: "'NoneType' object is not callable" in <frame object at 0x8ecb9fc> ignored
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.6/dist-packages/psyco/profiler.py", line 38, in go
    go_lock.acquire()
AttributeError: 'NoneType' object has no attribute 'acquire'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.6/dist-packages/psyco/profiler.py", line 38, in go
    go_lock.acquire()
AttributeError: 'NoneType' object has no attribute 'acquire'
[0] inspiron:~/projekte/s3ql$ 


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


More information about the PEAK mailing list