cpython/Include/internal/pycore_lazyimportobject.h
Miss Islington (bot) 03bb26f89e
[3.15] gh-158140: Resolve lazily imported sibling submodules independently (GH-158521) (#158613)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-10-02 18:48:03 +00:00

37 lines
1.1 KiB
C

// Lazy object interface.
#ifndef Py_INTERNAL_LAZYIMPORTOBJECT_H
#define Py_INTERNAL_LAZYIMPORTOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
PyAPI_DATA(PyTypeObject) PyLazyImport_Type;
#define PyLazyImport_CheckExact(op) Py_IS_TYPE((op), &PyLazyImport_Type)
PyAPI_FUNC(PyObject *) _PyLazyImport_New(
struct _PyInterpreterFrame *frame, PyObject *builtins,
PyObject *name, PyObject *fromlist);
extern PyObject *_PyLazyImport_LoadChild(
PyThreadState *tstate, PyObject *declaration, PyObject *name);
extern int _PyLazyImport_IsActive(PyObject *declaration);
extern int _PyLazyImport_IsResolving(PyThreadState *tstate, PyObject *op);
// Resolve a placeholder and replace its binding if it is unchanged or holds
// the child module published by the normal importer during resolution.
// namespace is the source captured during lookup, before resolution runs.
PyAPI_FUNC(PyObject *) _PyLazyImport_Reify(
PyThreadState *tstate, PyObject *placeholder,
PyObject *name, PyObject *ns);
#ifdef __cplusplus
}
#endif
#endif // !Py_INTERNAL_LAZYIMPORTOBJECT_H