Skip to content

Commit cf15a99

Browse files
committed
Repair type initialization problem
[SVN r14736]
1 parent a3102b5 commit cf15a99

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/object/function.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ function::function(py_function const& implementation, unsigned min_args, unsigne
2424
, m_max_args(std::max(max_args,min_args))
2525
{
2626
PyObject* p = this;
27-
::PyType_Ready(&function_type);
27+
if (function_type.ob_type == 0)
28+
{
29+
function_type.ob_type = &PyType_Type;
30+
::PyType_Ready(&function_type);
31+
}
2832
PyObject_INIT(p, &function_type);
2933
}
3034

@@ -305,7 +309,7 @@ extern "C"
305309
}
306310

307311
PyTypeObject function_type = {
308-
PyObject_HEAD_INIT(&PyType_Type)
312+
PyObject_HEAD_INIT(0)
309313
0,
310314
"Boost.Python.function",
311315
sizeof(function),

0 commit comments

Comments
 (0)