mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)
This commit is contained in:
parent
803187796f
commit
88c2cfd9ff
7 changed files with 44 additions and 4 deletions
|
@ -3012,6 +3012,10 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
|
|||
else if (slot->slot == Py_tp_doc) {
|
||||
/* For the docstring slot, which usually points to a static string
|
||||
literal, we need to make a copy */
|
||||
if (slot->pfunc == NULL) {
|
||||
type->tp_doc = NULL;
|
||||
continue;
|
||||
}
|
||||
size_t len = strlen(slot->pfunc)+1;
|
||||
char *tp_doc = PyObject_MALLOC(len);
|
||||
if (tp_doc == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue