[issue3634] invalid result value of _weakref.__init__()

STINNER Victor report at bugs.python.org
Thu Aug 21 19:25:01 CEST 2008


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

_weakref.__init__() doesn't catch errors correctly. Example:
--------------------- 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< -------------------------

Attached patch fix the bug for py3k branch: return -1 on error 
(instead of 1).

----------
components: Library (Lib)
files: weakref_init.patch
keywords: patch
messages: 71662
nosy: haypo
severity: normal
status: open
title: invalid result value of _weakref.__init__()
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11195/weakref_init.patch

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


More information about the Python-bugs-list mailing list