diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-11-07 00:04:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 17:04:47 +0100 |
commit | 88c2cfd9ffbcfc43fd1364f2984852a819547d43 (patch) | |
tree | 85571ab2d826b5eed1e084c9b973e3f9016fecd9 /Objects | |
parent | Minor grammar edits for the descriptor howto guide (GH-#23175) (diff) | |
download | cpython-88c2cfd9ffbcfc43fd1364f2984852a819547d43.tar.gz cpython-88c2cfd9ffbcfc43fd1364f2984852a819547d43.tar.bz2 cpython-88c2cfd9ffbcfc43fd1364f2984852a819547d43.zip |
bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 2daf374f170..3822b8cf813 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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) { |