[New-bugs-announce] [issue14211] Don't rely on borrowed _PyType_Lookup() reference in PyObject_GenericSetAttr()

STINNER Victor report at bugs.python.org
Tue Mar 6 18:19:05 CET 2012


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

PyObject_GenericSetAttr() doesn't keep a reference to the descriptor: Python does crash if the descriptor is destroyed while the attribute is set. Attached patch keeps a reference to the desriptor to avoid the crash.

A smililar was done in PyObject_GenericGetAttr() 8 years with the changelog "fix obscure crash in descriptor handling", see the changeset 941d49a65f06.

The patch fixes Lib/test/crashers/borrowed_ref_2.py and so removes it.

----------
files: type_lookup_ref.patch
keywords: patch
messages: 155025
nosy: haypo
priority: normal
severity: normal
status: open
title: Don't rely on borrowed _PyType_Lookup() reference in PyObject_GenericSetAttr()
Added file: http://bugs.python.org/file24746/type_lookup_ref.patch

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


More information about the New-bugs-announce mailing list