From 8c6c90798b5d969565cd1389ce5a68782a921d58 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 11 Dec 2025 18:12:31 +0100 Subject: [PATCH] gh-140550: Correct error message for PyModExport (PEP 793) hook --- Python/import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/import.c b/Python/import.c index 4dd247fac27654..2860ae032dfe29 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2003,7 +2003,7 @@ import_run_modexport(PyThreadState *tstate, PyModExportFunction ex0, if (!PyErr_Occurred()) { PyErr_Format( PyExc_SystemError, - "slot export function for module %s failed without setting an exception", + "module export hook for module %R failed without setting an exception", info->name); } return NULL; @@ -2011,7 +2011,7 @@ import_run_modexport(PyThreadState *tstate, PyModExportFunction ex0, if (PyErr_Occurred()) { PyErr_Format( PyExc_SystemError, - "slot export function for module %s raised unreported exception", + "module export hook for module %R raised unreported exception", info->name); } PyObject *result = PyModule_FromSlotsAndSpec(slots, spec);