diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2022-11-06 13:52:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 13:52:06 (GMT) |
commit | 99e2e60cb25bfcf77ba1386d331cfa85864e6a65 (patch) | |
tree | 9aec45b4196922f64b17f82a52761514347c8d25 /Include | |
parent | a0bc75e2fdd53680cb147881bcb3754bd56aa2fa (diff) | |
download | cpython-99e2e60cb25bfcf77ba1386d331cfa85864e6a65.zip cpython-99e2e60cb25bfcf77ba1386d331cfa85864e6a65.tar.gz cpython-99e2e60cb25bfcf77ba1386d331cfa85864e6a65.tar.bz2 |
gh-99139: Improve NameError error suggestion for instances (#99140)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_global_strings.h | 1 | ||||
-rw-r--r-- | Include/internal/pycore_runtime_init_generated.h | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h index e60bd4b..8912895 100644 --- a/Include/internal/pycore_global_strings.h +++ b/Include/internal/pycore_global_strings.h @@ -600,6 +600,7 @@ struct _Py_global_strings { STRUCT_FOR_ID(seek) STRUCT_FOR_ID(seekable) STRUCT_FOR_ID(selectors) + STRUCT_FOR_ID(self) STRUCT_FOR_ID(send) STRUCT_FOR_ID(sep) STRUCT_FOR_ID(sequence) diff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h index 8ce1037..a1f1efd 100644 --- a/Include/internal/pycore_runtime_init_generated.h +++ b/Include/internal/pycore_runtime_init_generated.h @@ -1109,6 +1109,7 @@ extern "C" { INIT_ID(seek), \ INIT_ID(seekable), \ INIT_ID(selectors), \ + INIT_ID(self), \ INIT_ID(send), \ INIT_ID(sep), \ INIT_ID(sequence), \ @@ -2567,6 +2568,8 @@ _PyUnicode_InitStaticStrings(void) { PyUnicode_InternInPlace(&string); string = &_Py_ID(selectors); PyUnicode_InternInPlace(&string); + string = &_Py_ID(self); + PyUnicode_InternInPlace(&string); string = &_Py_ID(send); PyUnicode_InternInPlace(&string); string = &_Py_ID(sep); @@ -7104,6 +7107,10 @@ _PyStaticObjects_CheckRefcnt(void) { _PyObject_Dump((PyObject *)&_Py_ID(selectors)); Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT"); }; + if (Py_REFCNT((PyObject *)&_Py_ID(self)) < _PyObject_IMMORTAL_REFCNT) { + _PyObject_Dump((PyObject *)&_Py_ID(self)); + Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT"); + }; if (Py_REFCNT((PyObject *)&_Py_ID(send)) < _PyObject_IMMORTAL_REFCNT) { _PyObject_Dump((PyObject *)&_Py_ID(send)); Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT"); |