[New-bugs-announce] [issue3643] Add more checks to testcapi

STINNER Victor report at bugs.python.org
Fri Aug 22 03:41:23 CEST 2008


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

test_thread_state() doesn't check that the argument is a function and 
doesn't check function call result and so the exception is catched 
later:

Non callable argument:
   import _testcapi
   _testcapi._test_thread_state(10)
   # no exception raise here
   import gc
   # exception raised too late!
=> TypeError: 'int' object is not callable

Callback error:
   import _testcapi
   def err():
      raise ValueError("xxx")
   _testcapi._test_thread_state(err)
   # no exception raise here
   import gc
   # exception raised too late!
=> ValueError: xxx

So I wrote a patch which fixes that but also raise_exception() which 
have to check that the argument is an exception class.

----------
components: Library (Lib)
files: testcapi_py26.patch
keywords: patch
messages: 71714
nosy: haypo
severity: normal
status: open
title: Add more checks to testcapi
type: feature request
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11204/testcapi_py26.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3643>
_______________________________________


More information about the New-bugs-announce mailing list