summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pyerrors.h8
-rw-r--r--Include/internal/pycore_global_strings.h1
-rw-r--r--Include/internal/pycore_runtime_init_generated.h7
3 files changed, 16 insertions, 0 deletions
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h
index f33d3caaa2..1413416677 100644
--- a/Include/cpython/pyerrors.h
+++ b/Include/cpython/pyerrors.h
@@ -37,6 +37,7 @@ typedef struct {
PyObject *msg;
PyObject *name;
PyObject *path;
+ PyObject *name_from;
} PyImportErrorObject;
typedef struct {
@@ -176,4 +177,11 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
const char *format,
...);
+extern PyObject *_PyErr_SetImportErrorWithNameFrom(
+ PyObject *,
+ PyObject *,
+ PyObject *,
+ PyObject *);
+
+
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))
diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h
index 9c716a3012..43f4dac893 100644
--- a/Include/internal/pycore_global_strings.h
+++ b/Include/internal/pycore_global_strings.h
@@ -478,6 +478,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(n_sequence_fields)
STRUCT_FOR_ID(n_unnamed_fields)
STRUCT_FOR_ID(name)
+ STRUCT_FOR_ID(name_from)
STRUCT_FOR_ID(namespace_separator)
STRUCT_FOR_ID(namespaces)
STRUCT_FOR_ID(narg)
diff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h
index 55c7c9e319..f7823d36ef 100644
--- a/Include/internal/pycore_runtime_init_generated.h
+++ b/Include/internal/pycore_runtime_init_generated.h
@@ -987,6 +987,7 @@ extern "C" {
INIT_ID(n_sequence_fields), \
INIT_ID(n_unnamed_fields), \
INIT_ID(name), \
+ INIT_ID(name_from), \
INIT_ID(namespace_separator), \
INIT_ID(namespaces), \
INIT_ID(narg), \
@@ -2286,6 +2287,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(name);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(name_from);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(namespace_separator);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(namespaces);
@@ -6505,6 +6508,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(name));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(name_from)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(name_from));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(namespace_separator)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(namespace_separator));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");