[issue45315] `PyType_FromSpec` does not copy the name

2021-10-21 Thread Petr Viktorin
Petr Viktorin added the comment: Since the fix changes the size of PyObject, it can't be backported. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue45315] `PyType_FromSpec` does not copy the name

2021-10-21 Thread Petr Viktorin
Petr Viktorin added the comment: New changeset 8a310dd5f4242b5d28013c1905c6573477e3b957 by Petr Viktorin in branch 'main': bpo-45315: PyType_FromSpec: Copy spec->name and have the type own the memory for its name (GH-29103)

[issue45315] `PyType_FromSpec` does not copy the name

2021-10-20 Thread Petr Viktorin
Change by Petr Viktorin : -- keywords: +patch pull_requests: +27371 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29103 ___ Python tracker ___

[issue45315] `PyType_FromSpec` does not copy the name

2021-10-20 Thread Petr Viktorin
Petr Viktorin added the comment: > the simplest solution is calling `type_set_name`, even if that runs some > unnecessary checks. Unfortunately this won't work, because it sets ht_name to the same value as tp_name. For historical reasons, the two can be different (and often are) for types

[issue45315] `PyType_FromSpec` does not copy the name

2021-10-12 Thread Petr Viktorin
Petr Viktorin added the comment: > Hm, I haven't find any case who use dynamical tp_name of Type_Spec > temporarily. The use case is creating types entirely on demand, with dynamically created specs. This is useful e.g. for wrapping objects of a different object system, like C++ classes

[issue45315] `PyType_FromSpec` does not copy the name

2021-10-06 Thread Hai Shi
Hai Shi added the comment: > the simplest solution is calling `type_set_name`, even if that runs some > unnecessary checks. Hm, I haven't find any case who use dynamical tp_name of Type_Spec temporarily. If we meet this user case, Adding a new object pointer of type name in is an other

[issue45315] `PyType_FromSpec` does not copy the name

2021-09-28 Thread Sebastian Berg
New submission from Sebastian Berg : As noted in the issue: https://bugs.python.org/issue15870#msg402800 `PyType_FromSpec` assumes that the `name` passed is persistent for the program lifetime. This seems wrong/unnecessary: We are creating a heap-type, a heap-type's name is stored as a