[issue45983] PyType_Spec.name must remain valid after PyType_FromSpec

2021-12-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I just noticed this duplicates #45315, sorry about the noise.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> `PyType_FromSpec` does not copy the name

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45983] PyType_Spec.name must remain valid after PyType_FromSpec

2021-12-04 Thread Ronald Oussoren


New submission from Ronald Oussoren :

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@python
components: Documentation
messages: 407676
nosy: docs@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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com