mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-99139: Improve NameError error suggestion for instances (#99140)
This commit is contained in:
parent
a0bc75e2fd
commit
99e2e60cb2
7 changed files with 92 additions and 0 deletions
|
@ -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)
|
||||
|
|
7
Include/internal/pycore_runtime_init_generated.h
generated
7
Include/internal/pycore_runtime_init_generated.h
generated
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue