summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-05-01 23:40:28 (GMT)
committerGitHub <noreply@github.com>2024-05-01 23:40:28 (GMT)
commit526ca4c09eed63e19ea5ffc46a76c5d8077a8bc9 (patch)
tree8b7f86990eb8497a743e24cd3afc76e8a72045a0 /Include
parenta524152b8c56f82d807ecdd7ae9d39cfd643c469 (diff)
downloadcpython-526ca4c09eed63e19ea5ffc46a76c5d8077a8bc9.zip
cpython-526ca4c09eed63e19ea5ffc46a76c5d8077a8bc9.tar.gz
cpython-526ca4c09eed63e19ea5ffc46a76c5d8077a8bc9.tar.bz2
gh-117953: Work Relative to Specific Extension Kinds in the Import Machinery (gh-118205)
This change will make some later changes simpler.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_importdl.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/Include/internal/pycore_importdl.h b/Include/internal/pycore_importdl.h
index adb8916..b0af28d 100644
--- a/Include/internal/pycore_importdl.h
+++ b/Include/internal/pycore_importdl.h
@@ -15,8 +15,15 @@ extern "C" {
extern const char *_PyImport_DynLoadFiletab[];
-typedef PyObject *(*PyModInitFunction)(void);
+typedef enum ext_module_kind {
+ _Py_ext_module_kind_UNKNOWN = 0,
+ _Py_ext_module_kind_SINGLEPHASE = 1,
+ _Py_ext_module_kind_MULTIPHASE = 2,
+ _Py_ext_module_kind_INVALID = 3,
+} _Py_ext_module_kind;
+
+/* Input for loading an extension module. */
struct _Py_ext_module_loader_info {
PyObject *filename;
#ifndef MS_WINDOWS
@@ -43,10 +50,33 @@ extern int _Py_ext_module_loader_info_init_from_spec(
struct _Py_ext_module_loader_info *info,
PyObject *spec);
+/* The result from running an extension module's init function. */
struct _Py_ext_module_loader_result {
PyModuleDef *def;
PyObject *module;
+ _Py_ext_module_kind kind;
+ struct _Py_ext_module_loader_result_error *err;
+ struct _Py_ext_module_loader_result_error {
+ enum _Py_ext_module_loader_result_error_kind {
+ _Py_ext_module_loader_result_EXCEPTION = 0,
+ _Py_ext_module_loader_result_ERR_MISSING = 1,
+ _Py_ext_module_loader_result_ERR_UNREPORTED_EXC = 2,
+ _Py_ext_module_loader_result_ERR_UNINITIALIZED = 3,
+ _Py_ext_module_loader_result_ERR_NONASCII_NOT_MULTIPHASE = 4,
+ _Py_ext_module_loader_result_ERR_NOT_MODULE = 5,
+ _Py_ext_module_loader_result_ERR_MISSING_DEF = 6,
+ } kind;
+ PyObject *exc;
+ } _err;
};
+extern void _Py_ext_module_loader_result_clear(
+ struct _Py_ext_module_loader_result *res);
+extern void _Py_ext_module_loader_result_apply_error(
+ struct _Py_ext_module_loader_result *res,
+ const char *name);
+
+/* The module init function. */
+typedef PyObject *(*PyModInitFunction)(void);
extern PyModInitFunction _PyImport_GetModInitFunc(
struct _Py_ext_module_loader_info *info,
FILE *fp);