Skip to content

Commit dd3c25f

Browse files
committed
Lose the spec argument
1 parent 71e043f commit dd3c25f

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

Include/internal/pycore_importdl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ extern void _Py_ext_module_loader_result_apply_error(
9696

9797
/* The module init function. */
9898
typedef PyObject *(*PyModInitFunction)(void);
99-
typedef PyModuleDef_Slot *(*PyModExportFunction)(PyObject *spec);
99+
typedef PyModuleDef_Slot *(*PyModExportFunction)(void);
100100
#ifdef HAVE_DYNAMIC_LOADING
101101
// function changed signature, the "2" suffix helps avoid ABI issues
102102
extern int _PyImport_GetModInitFunc2(

Modules/_testmultiphase.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ PyInit__test_no_multiple_interpreter_slot(void)
10191019
/* PyModExport_* hooks */
10201020

10211021
PyMODEXPORT_FUNC
1022-
PyModExport__test_from_modexport(PyObject *spec)
1022+
PyModExport__test_from_modexport(void)
10231023
{
10241024
static PyModuleDef_Slot slots[] = {
10251025
{Py_mod_name, "_test_from_modexport"},
@@ -1029,21 +1029,13 @@ PyModExport__test_from_modexport(PyObject *spec)
10291029
}
10301030

10311031
PyMODEXPORT_FUNC
1032-
PyModExport__test_from_modexport_null(PyObject *spec)
1032+
PyModExport__test_from_modexport_null(void)
10331033
{
1034-
PyObject *exc;
1035-
if (PyObject_GetOptionalAttrString(spec, "_test_exception", &exc) < 0) {
1036-
return NULL;
1037-
}
1038-
if (exc) {
1039-
PyErr_SetObject((PyObject*)Py_TYPE(exc), exc);
1040-
}
1041-
Py_XDECREF(exc);
10421034
return NULL;
10431035
}
10441036

10451037
PyMODINIT_FUNC
1046-
PyModInit__test_from_modexport_null(PyObject *spec)
1038+
PyModInit__test_from_modexport_null(void)
10471039
{
10481040
// This is not called as fallback for failed PyModExport_*
10491041
assert(0);
@@ -1052,14 +1044,14 @@ PyModInit__test_from_modexport_null(PyObject *spec)
10521044
}
10531045

10541046
PyMODEXPORT_FUNC
1055-
PyModExport__test_from_modexport_exception(PyObject *spec)
1047+
PyModExport__test_from_modexport_exception(void)
10561048
{
10571049
PyErr_SetString(PyExc_ValueError, "failed as requested");
10581050
return NULL;
10591051
}
10601052

10611053
PyMODINIT_FUNC
1062-
PyModInit__test_from_modexport_exception(PyObject *spec)
1054+
PyModInit__test_from_modexport_exception(void)
10631055
{
10641056
// This is not called as fallback for failed PyModExport_*
10651057
assert(0);
@@ -1075,7 +1067,7 @@ modexport_create_string(PyObject *spec, PyObject *def)
10751067
}
10761068

10771069
PyMODEXPORT_FUNC
1078-
PyModExport__test_from_modexport_create_nonmodule(PyObject *spec)
1070+
PyModExport__test_from_modexport_create_nonmodule(void)
10791071
{
10801072
static PyModuleDef_Slot slots[] = {
10811073
{Py_mod_name, "_test_from_modexport_create_nonmodule"},
@@ -1090,7 +1082,7 @@ static PyModuleDef_Slot modexport_empty_slots[] = {
10901082
};
10911083

10921084
PyMODEXPORT_FUNC
1093-
PyModExport__test_from_modexport_empty_slots(PyObject *spec)
1085+
PyModExport__test_from_modexport_empty_slots(void)
10941086
{
10951087
return modexport_empty_slots;
10961088
}
@@ -1155,7 +1147,7 @@ modexport_smoke_free(PyObject *mod)
11551147
}
11561148

11571149
PyMODEXPORT_FUNC
1158-
PyModExport__test_from_modexport_smoke(PyObject *spec)
1150+
PyModExport__test_from_modexport_smoke(void)
11591151
{
11601152
static PyMethodDef methods[] = {
11611153
{"get_state_int", modexport_smoke_get_state_int, METH_NOARGS},

Python/import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ import_run_modexport(PyThreadState *tstate, PyModExportFunction ex0,
19911991
/* This is like import_run_extension, but avoids interpreter switching
19921992
* and code for for single-phase modules.
19931993
*/
1994-
PyModuleDef_Slot *slots = ex0(spec);
1994+
PyModuleDef_Slot *slots = ex0();
19951995
if (!slots) {
19961996
if (!PyErr_Occurred()) {
19971997
PyErr_Format(

0 commit comments

Comments
 (0)