Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.
This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this). Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right. Apologies if they're
not. This also touches the weakref docs, which contains a sample type
object initializer. It also touches the mmap test output, because the
mmap type's repr is included in that output. It touches object.h to
put the correct description in a comment.
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 85fb7cc..425ff10 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -167,7 +167,7 @@
}
static PyTypeObject PdataType = {
- PyObject_HEAD_INIT(NULL) 0, "Pdata", sizeof(Pdata), 0,
+ PyObject_HEAD_INIT(NULL) 0, "cPickle.Pdata", sizeof(Pdata), 0,
(destructor)Pdata_dealloc,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0L,0L,0L,0L, ""
};
@@ -2479,7 +2479,7 @@
static PyTypeObject Picklertype = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Pickler", /*tp_name*/
+ "cPickle.Pickler", /*tp_name*/
sizeof(Picklerobject), /*tp_basicsize*/
0,
(destructor)Pickler_dealloc, /* tp_dealloc */
@@ -4478,7 +4478,7 @@
static PyTypeObject Unpicklertype = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Unpickler", /*tp_name*/
+ "cPickle.Unpickler", /*tp_name*/
sizeof(Unpicklerobject), /*tp_basicsize*/
0, /*tp_itemsize*/
/* methods */