This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author shihai1991
Recipients enometh, shihai1991
Date 2021-08-22.03:42:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629603770.32.0.682495978946.issue44913@roundup.psfhosted.org>
In-reply-to
Content
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;
}
History
Date User Action Args
2021-08-22 03:42:50shihai1991setrecipients: + shihai1991, enometh
2021-08-22 03:42:50shihai1991setmessageid: <1629603770.32.0.682495978946.issue44913@roundup.psfhosted.org>
2021-08-22 03:42:50shihai1991linkissue44913 messages
2021-08-22 03:42:50shihai1991create