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.

Author fancitron
Recipients corona10, fancitron, petr.viktorin
Date 2020-10-22.13:22:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603372932.12.0.669490145324.issue42035@roundup.psfhosted.org>
In-reply-to
Content
True enough.  Btw, PyType_FromSpec accepts Py_tp_doc (char *), Py_tp_base (PyTypeObject *), etc ... so to be strictly standard compliant, a union would be necessary.

PyType_GetName() sounds great.

One "proper" workaround at the moment is PyObject_GetAttrString(Py_TYPE(x), "__name__") and then process the result.  This is somewhat "heavy" and strips the module name.  "Py_tp_name" provides a convenient, exception safe, and backward compatible way to access tp_name.

What I actually do right now is to access the (opaque) PyTypeObject::tp_name by pointer offset.  This certain defies the purpose of stable ABI!
History
Date User Action Args
2020-10-22 13:22:12fancitronsetrecipients: + fancitron, petr.viktorin, corona10
2020-10-22 13:22:12fancitronsetmessageid: <1603372932.12.0.669490145324.issue42035@roundup.psfhosted.org>
2020-10-22 13:22:12fancitronlinkissue42035 messages
2020-10-22 13:22:11fancitroncreate