Skip to content

gh-117953: Always Run Extension Init Func in Main Interpreter First #117487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Include/internal/pycore_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern int _PyImport_FixupBuiltin(
const char *name, /* UTF-8 encoded string */
PyObject *modules
);
// We could probably drop this:
extern int _PyImport_FixupExtensionObject(PyObject*, PyObject *,
PyObject *, PyObject *);

Expand Down
23 changes: 21 additions & 2 deletions Include/internal/pycore_importdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,29 @@ extern "C" {

extern const char *_PyImport_DynLoadFiletab[];

extern PyObject *_PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *);

typedef PyObject *(*PyModInitFunction)(void);

struct _Py_ext_module_loader_info {
PyObject *path;
PyObject *name;
PyObject *name_encoded;
const char *hook_prefix;
};
extern void _Py_ext_module_loader_info_clear(
struct _Py_ext_module_loader_info *info);
extern int _Py_ext_module_loader_info_from_spec(
PyObject *spec,
struct _Py_ext_module_loader_info *info);

struct _Py_ext_module_loader_result {
PyModuleDef *def;
PyObject *module;
};
extern int _PyImport_RunDynamicModule(
struct _Py_ext_module_loader_info *info,
FILE *fp,
struct _Py_ext_module_loader_result *res);

/* Max length of module suffix searched for -- accommodates "module.slb" */
#define MAXSUFFIXSIZE 12

Expand Down
Loading
Loading