mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
This commit is contained in:
parent
bd928fef42
commit
1c67dd9b15
12 changed files with 200 additions and 183 deletions
|
|
@ -4422,7 +4422,9 @@ import_from(PyObject *v, PyObject *name)
|
|||
static int
|
||||
import_all_from(PyObject *locals, PyObject *v)
|
||||
{
|
||||
PyObject *all = PyObject_GetAttrString(v, "__all__");
|
||||
_Py_IDENTIFIER(__all__);
|
||||
_Py_IDENTIFIER(__dict__);
|
||||
PyObject *all = _PyObject_GetAttrId(v, &PyId___all__);
|
||||
PyObject *dict, *name, *value;
|
||||
int skip_leading_underscores = 0;
|
||||
int pos, err;
|
||||
|
|
@ -4431,7 +4433,7 @@ import_all_from(PyObject *locals, PyObject *v)
|
|||
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
return -1; /* Unexpected error */
|
||||
PyErr_Clear();
|
||||
dict = PyObject_GetAttrString(v, "__dict__");
|
||||
dict = _PyObject_GetAttrId(v, &PyId___dict__);
|
||||
if (dict == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue