Skip to content
Draft
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
6 changes: 4 additions & 2 deletions Include/internal/pycore_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ extern PyObject * _PyImport_GetAbsName(
// Symbol is exported for the JIT on Windows builds.
PyAPI_FUNC(PyObject *) _PyImport_LoadLazyImportTstate(
PyThreadState *tstate, PyObject *lazy_import);
extern PyObject * _PyImport_TryLoadLazySubmodule(
PyObject *mod_name, PyObject *attr_name);
// Returns 1 with a new reference in result, 0 if not pending, or -1 on error.
extern int _PyImport_TryLoadLazySubmodule(
PyObject *mod_name, PyObject *attr_name, PyObject *mod_dict,
PyObject **result);
extern PyObject * _PyImport_LazyImportModuleLevelObject(
PyThreadState *tstate, PyObject *name, PyObject *builtins,
PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
Expand Down
12 changes: 12 additions & 0 deletions Include/internal/pycore_lazyimportobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@ typedef struct {
PyObject *lz_builtins;
PyObject *lz_from;
PyObject *lz_attr;
PyObject *lz_globals;
PyObject *lz_key;
PyObject *lz_resolved; // Protected by the lazy object lock.
Py_hash_t lz_key_hash;
// Frame information for the original import location.
PyCodeObject *lz_code; // Code object where the lazy import was created.
int lz_instr_offset; // Instruction offset where the lazy import was created.
} PyLazyImportObject;


PyAPI_FUNC(PyObject *) _PyLazyImport_GetName(PyObject *lazy_import);
PyAPI_FUNC(PyObject *) _PyLazyImport_GetResolved(PyObject *lazy_import);
PyAPI_FUNC(int) _PyLazyImport_FinishResolve(
PyObject *lazy_import, PyObject *resolved);
PyAPI_FUNC(int) _PyLazyImport_ReplaceDictItemIfCurrent(
PyObject *lazy_import, PyObject *dict, PyObject *name,
PyObject *resolved);
PyAPI_FUNC(int) _PyLazyImport_SetGlobalBindingAndDictItem(
PyObject *lazy_import, PyObject *globals, PyObject *name);
PyAPI_FUNC(PyObject *) _PyLazyImport_New(
struct _PyInterpreterFrame *frame, PyObject *import_func, PyObject *from, PyObject *attr);

Expand Down
Loading
Loading