Message331047
> Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK
It's unrelated. Your must not use the Python API before Python is initialized. If you modify your code like that, it works as expected:
int main()
{
Py_Initialize();
PyMethodDef methoddef_ = {
const_cast< char* >( "myfun" ),
(PyCFunction) myfun,
METH_O,
NULL
};
PyObject* myFunPtr = PyCFunction_New( &methoddef_, NULL );
Py_Finalize();
return 0;
}
I don't think that it's a regression.
Python initialization is now well documented:
https://docs.python.org/dev/c-api/init.html
The documentation starts with:
"In an application embedding Python, the Py_Initialize() function must be called before using any other Python/C API functions; with the exception of a few functions and the global configuration variables."
PyCFunction_New() is an example of function of the Python C API. |
|
Date |
User |
Action |
Args |
2018-12-04 14:24:56 | vstinner | set | recipients:
+ vstinner, etejedor |
2018-12-04 14:24:56 | vstinner | set | messageid: <1543933496.38.0.788709270274.issue35408@psf.upfronthosting.co.za> |
2018-12-04 14:24:56 | vstinner | link | issue35408 messages |
2018-12-04 14:24:56 | vstinner | create | |
|