From 2b5ef3c572416eb3c4848b7db884083b191ba232 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 7 Feb 2003 18:56:16 +0000 Subject: [PATCH] Python 2.3 compatibility [SVN r17271] --- src/object/class.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/object/class.cpp b/src/object/class.cpp index dc560fef..ff14c9b7 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -277,16 +277,11 @@ namespace objects object module_prefix() { - object result( + return object( PyObject_IsInstance(scope().ptr(), upcast(&PyModule_Type)) ? object(scope().attr("__name__")) : api::getattr(scope(), "__module__", str()) ); - - if (result) - result += '.'; - - return result; } namespace @@ -348,11 +343,14 @@ namespace objects // Call the class metatype to create a new class dict d; - + + object m = module_prefix(); + if (m) d["__module__"] = m; + if (doc != 0) d["__doc__"] = doc; - object result = object(class_metatype())(module_prefix() + name, bases, d); + object result = object(class_metatype())(name, bases, d); assert(PyType_IsSubtype(result.ptr()->ob_type, &PyType_Type)); if (scope().ptr() != Py_None)