Fix missing lazy-related symbols for the JIT (#34)

* fix missing `PyLazyImport_CheckExact`

* fix missing lazy-related symbols

* fix missing lazy-related symbols

* `extern` seems enough

* Export _PyImport_LoadLazyImportTstate for JIT
This commit is contained in:
Bénédikt Tran 2025-12-08 00:57:22 +01:00 committed by GitHub
parent c4ed3c4119
commit 5000033162
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 5 deletions

View file

@ -36,7 +36,8 @@ extern PyObject *
_PyImport_ResolveName(PyThreadState *tstate, PyObject *name, PyObject *globals, int level);
extern PyObject *
_PyImport_GetAbsName(PyThreadState *tstate, PyObject *name, PyObject *globals, int level);
extern PyObject *
// Symbol is exported for the JIT on Windows builds.
PyAPI_FUNC(PyObject *)
_PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import);
extern PyObject *
_PyImport_LazyImportModuleLevelObject(PyThreadState *tstate, PyObject *name, PyObject *builtins, PyObject *globals,

View file

@ -2,12 +2,17 @@
/* Lazy object interface */
#ifndef Py_LAZYIMPORTOBJECT_H
#define Py_LAZYIMPORTOBJECT_H
#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)
@ -28,4 +33,4 @@ PyAPI_FUNC(PyObject *) _PyLazyImport_New(PyObject *import_func, PyObject *from,
#ifdef __cplusplus
}
#endif
#endif /* !Py_LAZYIMPORTOBJECT_H */
#endif /* !Py_INTERNAL_LAZYIMPORTOBJECT_H */

View file

@ -11,12 +11,15 @@
#include "pycore_audit.h" // _PySys_Audit()
#include "pycore_backoff.h"
#include "pycore_cell.h" // PyCell_GetRef()
#include "pycore_ceval.h" // _PyEval_LazyImportName(), _PyEval_LazyImportFrom()
#include "pycore_code.h"
#include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS
#include "pycore_function.h"
#include "pycore_import.h" // _PyImport_LoadLazyImportTstate()
#include "pycore_instruments.h"
#include "pycore_interpolation.h" // _PyInterpolation_Build()
#include "pycore_intrinsics.h"
#include "pycore_lazyimportobject.h" // PyLazyImport_CheckExact()
#include "pycore_long.h" // _PyLong_ExactDealloc(), _PyLong_GetZero()
#include "pycore_moduleobject.h" // PyModuleObject
#include "pycore_object.h" // _PyObject_GC_TRACK()

View file

@ -11,9 +11,11 @@
#include "pycore_floatobject.h"
#include "pycore_frame.h"
#include "pycore_function.h"
#include "pycore_import.h"
#include "pycore_interpframe.h"
#include "pycore_interpolation.h"
#include "pycore_intrinsics.h"
#include "pycore_lazyimportobject.h"
#include "pycore_list.h"
#include "pycore_long.h"
#include "pycore_opcode_metadata.h"

View file

@ -12,9 +12,11 @@
#include "pycore_frame.h"
#include "pycore_function.h"
#include "pycore_genobject.h"
#include "pycore_import.h"
#include "pycore_interpframe.h"
#include "pycore_interpolation.h"
#include "pycore_intrinsics.h"
#include "pycore_lazyimportobject.h"
#include "pycore_jit.h"
#include "pycore_list.h"
#include "pycore_long.h"