hai shi <shihai1...@126.com> added the comment:
How about this one? int foo(void) { printf(stderr, "foo BEGIN\n"); if (!Py_IsInitialized()) { fprintf(stderr, "python already initialized\n"); return -1; } const char *module_name = "foo"; PyGILState_STATE state = PyGILState_Ensure(); PyObject *module_handle = PyModule_New(module_name); if (module_handle == 0) { fprintf(stderr,"PyModule_New(module_data_name=%s) failed\n", module_name); exit(1); } fprintf(stdout, "point is: %p\n", module_handle); fprintf(stderr, "foo END\n"); PyGILState_Release(state); return 0; } ---------- nosy: +shihai1991 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44913> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com