diff -dur .\libs\python\src\object_bak/function.cpp .\libs\python\src\object/function.cpp --- .\libs\python\src\object_bak/function.cpp 2009-12-04 11:22:42.906250000 -0500 +++ .\libs\python\src\object/function.cpp 2009-12-04 11:43:06.281250000 -0500 @@ -51,7 +51,8 @@ return this->min_arity(); } -extern PyTypeObject function_type; +extern PyTypeObject function_type_skel; +extern PyTypeObject * function_type_ptr; function::function( py_function const& implementation @@ -105,14 +106,15 @@ } PyObject* p = this; - if (Py_TYPE(&function_type) == 0) + if ( function_type_ptr == NULL ) { - Py_TYPE(&function_type) = &PyType_Type; - ::PyType_Ready(&function_type); + function_type_ptr = PyObject_New( PyTypeObject, &PyType_Type ); + *function_type_ptr = function_type_skel; + ::PyType_Ready(function_type_ptr); } (void)( // warning suppression for GCC - PyObject_INIT(p, &function_type) + PyObject_INIT(p, function_type_ptr) ); } @@ -430,7 +432,7 @@ str const name(name_); PyObject* const ns = name_space.ptr(); - if (attribute.ptr()->ob_type == &function_type) + if (attribute.ptr()->ob_type == function_type_ptr) { function* new_func = downcast(attribute.ptr()); PyObject* dict = 0; @@ -453,7 +455,7 @@ if (existing) { - if (existing->ob_type == &function_type) + if (existing->ob_type == function_type_ptr) { new_func->add_overload( handle( @@ -681,8 +683,9 @@ {NULL, 0, 0, 0, 0} /* Sentinel */ }; -PyTypeObject function_type = { - PyVarObject_HEAD_INIT(NULL, 0) +PyTypeObject * function_type_ptr = NULL; +PyTypeObject function_type_skel = { + PyVarObject_HEAD_INIT(&PyType_Type, 0) const_cast("Boost.Python.function"), sizeof(function), 0,