This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Don't rely on borrowed _PyType_Lookup() reference in PyObject_GenericSetAttr()
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, vstinner
Priority: normal Keywords: patch

Created on 2012-03-06 17:19 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
type_lookup_ref.patch vstinner, 2012-03-06 17:19 review
Messages (3)
msg155025 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-03-06 17:19
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.
msg155187 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-08 23:47
New changeset 579f845ac396 by Victor Stinner in branch 'default':
Issue #14211: _PyObject_GenericSetAttrWithDict() keeps a strong reference to
http://hg.python.org/cpython/rev/579f845ac396
msg155189 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-08 23:52
New changeset 2cc44cd8098e by Victor Stinner in branch 'default':
Issue #14211: Oops, I removed the wrong file :-)
http://hg.python.org/cpython/rev/2cc44cd8098e
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58419
2012-03-09 00:06:11vstinnersetstatus: open -> closed
resolution: fixed
2012-03-08 23:52:34python-devsetmessages: + msg155189
2012-03-08 23:47:22python-devsetnosy: + python-dev
messages: + msg155187
2012-03-06 17:20:03vstinnersetcomponents: + Interpreter Core
versions: + Python 3.3
2012-03-06 17:19:56vstinnersettype: crash
2012-03-06 17:19:05vstinnercreate