[New-bugs-announce] [issue45983] PyType_Spec.name must remain valid after PyType_FromSpec

Ronald Oussoren report at bugs.python.org
Sat Dec 4 11:32:04 EST 2021


New submission from Ronald Oussoren <ronaldoussoren at mac.com>:

The documentation for PyType_Spec and the related functions is not clear about the required lifetime of fields of PyType_Spec. 

In particular, PyType_Spec.name must remain valid for the entire lifetime of types created with PyType_FromSpec*.  The documentation doesn't mention this.

I ran into this with code that calculates the name as needed an cleans up the memory used for the type spec after creating the type. The type appears to work fine when looking at it in Python scripts, but the tp_name slot is wrong.

----------
assignee: docs at python
components: Documentation
messages: 407676
nosy: docs at python, ronaldoussoren
priority: normal
severity: normal
status: open
title: PyType_Spec.name must remain valid after PyType_FromSpec
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45983>
_______________________________________


More information about the New-bugs-announce mailing list