Skip to content

Commit 2b5ef3c

Browse files
author
Ralf W. Grosse-Kunstleve
committed
Python 2.3 compatibility
[SVN r17271]
1 parent 9c50496 commit 2b5ef3c

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/object/class.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,11 @@ namespace objects
277277

278278
object module_prefix()
279279
{
280-
object result(
280+
return object(
281281
PyObject_IsInstance(scope().ptr(), upcast<PyObject>(&PyModule_Type))
282282
? object(scope().attr("__name__"))
283283
: api::getattr(scope(), "__module__", str())
284284
);
285-
286-
if (result)
287-
result += '.';
288-
289-
return result;
290285
}
291286

292287
namespace
@@ -348,11 +343,14 @@ namespace objects
348343

349344
// Call the class metatype to create a new class
350345
dict d;
351-
346+
347+
object m = module_prefix();
348+
if (m) d["__module__"] = m;
349+
352350
if (doc != 0)
353351
d["__doc__"] = doc;
354352

355-
object result = object(class_metatype())(module_prefix() + name, bases, d);
353+
object result = object(class_metatype())(name, bases, d);
356354
assert(PyType_IsSubtype(result.ptr()->ob_type, &PyType_Type));
357355

358356
if (scope().ptr() != Py_None)

0 commit comments

Comments
 (0)