@@ -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 ;
0 commit comments