diff -r a39d2223be23 Doc/c-api/typeobj.rst --- a/Doc/c-api/typeobj.rst Sun Jun 23 15:53:09 2013 +0200 +++ b/Doc/c-api/typeobj.rst Sun Jun 23 17:02:10 2013 +0200 @@ -116,7 +116,8 @@ If no dot is present, the entire :attr:`tp_name` field is made accessible as the :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your - type will be impossible to pickle. + type will be impossible to pickle. Additionally, it will not be listed in + module documentations created with pydoc. This field is not inherited by subtypes. diff -r a39d2223be23 Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst Sun Jun 23 15:53:09 2013 +0200 +++ b/Doc/extending/newtypes.rst Sun Jun 23 17:02:10 2013 +0200 @@ -125,7 +125,9 @@ Note that the name is a dotted name that includes both the module name and the name of the type within the module. The module in this case is :mod:`noddy` and -the type is :class:`Noddy`, so we set the type name to :class:`noddy.Noddy`. :: +the type is :class:`Noddy`, so we set the type name to :class:`noddy.Noddy`. +One side effect of using an undotted name is that the pydoc documentation tool +will not list the new type in the module documentation. :: sizeof(noddy_NoddyObject), /* tp_basicsize */ diff -r a39d2223be23 Objects/typeobject.c --- a/Objects/typeobject.c Sun Jun 23 15:53:09 2013 +0200 +++ b/Objects/typeobject.c Sun Jun 23 17:02:10 2013 +0200 @@ -4143,6 +4143,9 @@ _Py_AddToAllObjects((PyObject *)type, 0); #endif + if (type->tp_name == NULL) + goto error; + /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; if (base == NULL && type != &PyBaseObject_Type) {