[issue3611] invalid exception context

STINNER Victor report at bugs.python.org
Thu Aug 21 19:16:29 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Here is a new snippet with strange exception handling:
--------------------- 8< -------------------------
from gc import collect
import _weakref

class FuzzingUserClass:
    pass

obj = _weakref.ref(FuzzingUserClass)

# Exception not raised??
obj.__init__(
    0,
    0,
    0,
)

# Exception catched here??
collect()
--------------------- 8< -------------------------

Result:
    Exception TypeError: '__init__ expected at most 2 arguments, 
    got 3' in 'garbage collection' ignored
    Fatal Python error: unexpected exception during garbage collection
    Abandon (core dumped)

The exception is raised in Objects/weakrefobject.c:
  weakref___init__() 
  => parse_weakref_init_args() 
  => PyArg_UnpackTuple() *here*

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


More information about the Python-bugs-list mailing list