| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,7 +294,6 @@ PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); | |||
| 294 | 294 | PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); | |
| 295 | 295 | PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, _Py_Identifier *); | |
| 296 | 296 | PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, _Py_Identifier *, PyObject *); | |
| 297 | - #define _PyObject_LookupAttr PyObject_GetOptionalAttr | ||
| 298 | 297 | ||
| 299 | 298 | PyAPI_FUNC(int) _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); | |
| 300 | 299 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -361,7 +361,7 @@ compute_abstract_methods(PyObject *self) | |||
| 361 | 361 | PyObject *item = PyTuple_GET_ITEM(bases, pos); // borrowed | |
| 362 | 362 | PyObject *base_abstracts, *iter; | |
| 363 | 363 | ||
| 364 | - if (_PyObject_LookupAttr(item, &_Py_ID(__abstractmethods__), | ||
| 364 | + if (PyObject_GetOptionalAttr(item, &_Py_ID(__abstractmethods__), | ||
| 365 | 365 | &base_abstracts) < 0) { | |
| 366 | 366 | goto error; | |
| 367 | 367 | } | |
@@ -375,7 +375,7 @@ compute_abstract_methods(PyObject *self) | |||
| 375 | 375 | Py_DECREF(base_abstracts); | |
| 376 | 376 | PyObject *key, *value; | |
| 377 | 377 | while ((key = PyIter_Next(iter))) { | |
| 378 | - if (_PyObject_LookupAttr(self, key, &value) < 0) { | ||
| 378 | + if (PyObject_GetOptionalAttr(self, key, &value) < 0) { | ||
| 379 | 379 | Py_DECREF(key); | |
| 380 | 380 | Py_DECREF(iter); | |
| 381 | 381 | goto error; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -248,7 +248,7 @@ get_future_loop(asyncio_state *state, PyObject *fut) | |||
| 248 | 248 | return Py_NewRef(loop); | |
| 249 | 249 | } | |
| 250 | 250 | ||
| 251 | - if (_PyObject_LookupAttr(fut, &_Py_ID(get_loop), &getloop) < 0) { | ||
| 251 | + if (PyObject_GetOptionalAttr(fut, &_Py_ID(get_loop), &getloop) < 0) { | ||
| 252 | 252 | return NULL; | |
| 253 | 253 | } | |
| 254 | 254 | if (getloop != NULL) { | |
@@ -2966,7 +2966,7 @@ task_step_handle_result_impl(asyncio_state *state, TaskObj *task, PyObject *resu | |||
| 2966 | 2966 | } | |
| 2967 | 2967 | ||
| 2968 | 2968 | /* Check if `result` is a Future-compatible object */ | |
| 2969 | - if (_PyObject_LookupAttr(result, &_Py_ID(_asyncio_future_blocking), &o) < 0) { | ||
| 2969 | + if (PyObject_GetOptionalAttr(result, &_Py_ID(_asyncio_future_blocking), &o) < 0) { | ||
| 2970 | 2970 | goto fail; | |
| 2971 | 2971 | } | |
| 2972 | 2972 | if (o != NULL && o != Py_None) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1450,7 +1450,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args) | |||
| 1450 | 1450 | Py_DECREF(self); | |
| 1451 | 1451 | return NULL; | |
| 1452 | 1452 | } | |
| 1453 | - if (_PyObject_LookupAttr(output_file, | ||
| 1453 | + if (PyObject_GetOptionalAttr(output_file, | ||
| 1454 | 1454 | module_state->str_write, | |
| 1455 | 1455 | &self->write) < 0) { | |
| 1456 | 1456 | Py_DECREF(self); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -851,7 +851,7 @@ CDataType_from_param(PyObject *type, PyObject *value) | |||
| 851 | 851 | return NULL; | |
| 852 | 852 | } | |
| 853 | 853 | ||
| 854 | - if (_PyObject_LookupAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 854 | + if (PyObject_GetOptionalAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 855 | 855 | return NULL; | |
| 856 | 856 | } | |
| 857 | 857 | if (as_parameter) { | |
@@ -1495,7 +1495,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 1495 | 1495 | stgdict = NULL; | |
| 1496 | 1496 | type_attr = NULL; | |
| 1497 | 1497 | ||
| 1498 | - if (_PyObject_LookupAttr((PyObject *)result, &_Py_ID(_length_), &length_attr) < 0) { | ||
| 1498 | + if (PyObject_GetOptionalAttr((PyObject *)result, &_Py_ID(_length_), &length_attr) < 0) { | ||
| 1499 | 1499 | goto error; | |
| 1500 | 1500 | } | |
| 1501 | 1501 | if (!length_attr) { | |
@@ -1528,7 +1528,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 1528 | 1528 | goto error; | |
| 1529 | 1529 | } | |
| 1530 | 1530 | ||
| 1531 | - if (_PyObject_LookupAttr((PyObject *)result, &_Py_ID(_type_), &type_attr) < 0) { | ||
| 1531 | + if (PyObject_GetOptionalAttr((PyObject *)result, &_Py_ID(_type_), &type_attr) < 0) { | ||
| 1532 | 1532 | goto error; | |
| 1533 | 1533 | } | |
| 1534 | 1534 | if (!type_attr) { | |
@@ -1720,7 +1720,7 @@ c_wchar_p_from_param(PyObject *type, PyObject *value) | |||
| 1720 | 1720 | } | |
| 1721 | 1721 | } | |
| 1722 | 1722 | ||
| 1723 | - if (_PyObject_LookupAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1723 | + if (PyObject_GetOptionalAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1724 | 1724 | return NULL; | |
| 1725 | 1725 | } | |
| 1726 | 1726 | if (as_parameter) { | |
@@ -1784,7 +1784,7 @@ c_char_p_from_param(PyObject *type, PyObject *value) | |||
| 1784 | 1784 | } | |
| 1785 | 1785 | } | |
| 1786 | 1786 | ||
| 1787 | - if (_PyObject_LookupAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1787 | + if (PyObject_GetOptionalAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1788 | 1788 | return NULL; | |
| 1789 | 1789 | } | |
| 1790 | 1790 | if (as_parameter) { | |
@@ -1919,7 +1919,7 @@ c_void_p_from_param(PyObject *type, PyObject *value) | |||
| 1919 | 1919 | } | |
| 1920 | 1920 | } | |
| 1921 | 1921 | ||
| 1922 | - if (_PyObject_LookupAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1922 | + if (PyObject_GetOptionalAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 1923 | 1923 | return NULL; | |
| 1924 | 1924 | } | |
| 1925 | 1925 | if (as_parameter) { | |
@@ -2054,7 +2054,7 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 2054 | 2054 | if (result == NULL) | |
| 2055 | 2055 | return NULL; | |
| 2056 | 2056 | ||
| 2057 | - if (_PyObject_LookupAttr((PyObject *)result, &_Py_ID(_type_), &proto) < 0) { | ||
| 2057 | + if (PyObject_GetOptionalAttr((PyObject *)result, &_Py_ID(_type_), &proto) < 0) { | ||
| 2058 | 2058 | return NULL; | |
| 2059 | 2059 | } | |
| 2060 | 2060 | if (!proto) { | |
@@ -2266,7 +2266,7 @@ PyCSimpleType_from_param(PyObject *type, PyObject *value) | |||
| 2266 | 2266 | PyObject *exc = PyErr_GetRaisedException(); | |
| 2267 | 2267 | Py_DECREF(parg); | |
| 2268 | 2268 | ||
| 2269 | - if (_PyObject_LookupAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 2269 | + if (PyObject_GetOptionalAttr(value, &_Py_ID(_as_parameter_), &as_parameter) < 0) { | ||
| 2270 | 2270 | Py_XDECREF(exc); | |
| 2271 | 2271 | return NULL; | |
| 2272 | 2272 | } | |
@@ -2429,7 +2429,7 @@ converters_from_argtypes(PyObject *ob) | |||
| 2429 | 2429 | } | |
| 2430 | 2430 | */ | |
| 2431 | 2431 | ||
| 2432 | - if (_PyObject_LookupAttr(tp, &_Py_ID(from_param), &cnv) <= 0) { | ||
| 2432 | + if (PyObject_GetOptionalAttr(tp, &_Py_ID(from_param), &cnv) <= 0) { | ||
| 2433 | 2433 | Py_DECREF(converters); | |
| 2434 | 2434 | Py_DECREF(ob); | |
| 2435 | 2435 | if (!PyErr_Occurred()) { | |
@@ -2489,7 +2489,7 @@ make_funcptrtype_dict(StgDictObject *stgdict) | |||
| 2489 | 2489 | return -1; | |
| 2490 | 2490 | } | |
| 2491 | 2491 | stgdict->restype = Py_NewRef(ob); | |
| 2492 | - if (_PyObject_LookupAttr(ob, &_Py_ID(_check_retval_), | ||
| 2492 | + if (PyObject_GetOptionalAttr(ob, &_Py_ID(_check_retval_), | ||
| 2493 | 2493 | &stgdict->checker) < 0) | |
| 2494 | 2494 | { | |
| 2495 | 2495 | return -1; | |
@@ -3275,7 +3275,7 @@ PyCFuncPtr_set_restype(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ign | |||
| 3275 | 3275 | "restype must be a type, a callable, or None"); | |
| 3276 | 3276 | return -1; | |
| 3277 | 3277 | } | |
| 3278 | - if (_PyObject_LookupAttr(ob, &_Py_ID(_check_retval_), &checker) < 0) { | ||
| 3278 | + if (PyObject_GetOptionalAttr(ob, &_Py_ID(_check_retval_), &checker) < 0) { | ||
| 3279 | 3279 | return -1; | |
| 3280 | 3280 | } | |
| 3281 | 3281 | oldchecker = self->checker; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -727,7 +727,7 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa) | |||
| 727 | 727 | ||
| 728 | 728 | { | |
| 729 | 729 | PyObject *arg; | |
| 730 | - if (_PyObject_LookupAttr(obj, &_Py_ID(_as_parameter_), &arg) < 0) { | ||
| 730 | + if (PyObject_GetOptionalAttr(obj, &_Py_ID(_as_parameter_), &arg) < 0) { | ||
| 731 | 731 | return -1; | |
| 732 | 732 | } | |
| 733 | 733 | /* Which types should we exactly allow here? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -295,7 +295,7 @@ MakeAnonFields(PyObject *type) | |||
| 295 | 295 | PyObject *anon_names; | |
| 296 | 296 | Py_ssize_t i; | |
| 297 | 297 | ||
| 298 | - if (_PyObject_LookupAttr(type, &_Py_ID(_anonymous_), &anon) < 0) { | ||
| 298 | + if (PyObject_GetOptionalAttr(type, &_Py_ID(_anonymous_), &anon) < 0) { | ||
| 299 | 299 | return -1; | |
| 300 | 300 | } | |
| 301 | 301 | if (anon == NULL) { | |
@@ -385,7 +385,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct | |||
| 385 | 385 | if (fields == NULL) | |
| 386 | 386 | return 0; | |
| 387 | 387 | ||
| 388 | - if (_PyObject_LookupAttr(type, &_Py_ID(_swappedbytes_), &tmp) < 0) { | ||
| 388 | + if (PyObject_GetOptionalAttr(type, &_Py_ID(_swappedbytes_), &tmp) < 0) { | ||
| 389 | 389 | return -1; | |
| 390 | 390 | } | |
| 391 | 391 | if (tmp) { | |
@@ -396,7 +396,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct | |||
| 396 | 396 | big_endian = PY_BIG_ENDIAN; | |
| 397 | 397 | } | |
| 398 | 398 | ||
| 399 | - if (_PyObject_LookupAttr(type, &_Py_ID(_pack_), &tmp) < 0) { | ||
| 399 | + if (PyObject_GetOptionalAttr(type, &_Py_ID(_pack_), &tmp) < 0) { | ||
| 400 | 400 | return -1; | |
| 401 | 401 | } | |
| 402 | 402 | if (tmp) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3791,7 +3791,7 @@ tzinfo_reduce(PyObject *self, PyObject *Py_UNUSED(ignored)) | |||
| 3791 | 3791 | PyObject *args, *state; | |
| 3792 | 3792 | PyObject *getinitargs; | |
| 3793 | 3793 | ||
| 3794 | - if (_PyObject_LookupAttr(self, &_Py_ID(__getinitargs__), &getinitargs) < 0) { | ||
| 3794 | + if (PyObject_GetOptionalAttr(self, &_Py_ID(__getinitargs__), &getinitargs) < 0) { | ||
| 3795 | 3795 | return NULL; | |
| 3796 | 3796 | } | |
| 3797 | 3797 | if (getinitargs != NULL) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3530,7 +3530,7 @@ expat_start_doctype_handler(XMLParserObject *self, | |||
| 3530 | 3530 | sysid_obj, NULL); | |
| 3531 | 3531 | Py_XDECREF(res); | |
| 3532 | 3532 | } | |
| 3533 | - else if (_PyObject_LookupAttr((PyObject *)self, st->str_doctype, &res) > 0) { | ||
| 3533 | + else if (PyObject_GetOptionalAttr((PyObject *)self, st->str_doctype, &res) > 0) { | ||
| 3534 | 3534 | (void)PyErr_WarnEx(PyExc_RuntimeWarning, | |
| 3535 | 3535 | "The doctype() method of XMLParser is ignored. " | |
| 3536 | 3536 | "Define doctype() method on the TreeBuilder target.", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1463,7 +1463,7 @@ buffered_repr(buffered *self) | |||
| 1463 | 1463 | { | |
| 1464 | 1464 | PyObject *nameobj, *res; | |
| 1465 | 1465 | ||
| 1466 | - if (_PyObject_LookupAttr((PyObject *) self, &_Py_ID(name), &nameobj) < 0) { | ||
| 1466 | + if (PyObject_GetOptionalAttr((PyObject *) self, &_Py_ID(name), &nameobj) < 0) { | ||
| 1467 | 1467 | if (!PyErr_ExceptionMatches(PyExc_ValueError)) { | |
| 1468 | 1468 | return NULL; | |
| 1469 | 1469 | } | |
@@ -1630,7 +1630,7 @@ _bufferedreader_read_all(buffered *self) | |||
| 1630 | 1630 | } | |
| 1631 | 1631 | _bufferedreader_reset_buf(self); | |
| 1632 | 1632 | ||
| 1633 | - if (_PyObject_LookupAttr(self->raw, &_Py_ID(readall), &readall) < 0) { | ||
| 1633 | + if (PyObject_GetOptionalAttr(self->raw, &_Py_ID(readall), &readall) < 0) { | ||
| 1634 | 1634 | goto cleanup; | |
| 1635 | 1635 | } | |
| 1636 | 1636 | if (readall) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments