File tree Expand file tree Collapse file tree 2 files changed +2
-12
lines changed
Expand file tree Collapse file tree 2 files changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ int CPyDict_Update(PyObject *dict, PyObject *stuff) {
159159int CPyDict_UpdateFromAny (PyObject * dict , PyObject * stuff ) {
160160 if (PyDict_CheckExact (dict )) {
161161 // Argh this sucks
162- if (PyDict_Check (stuff ) || _CPyObject_HasAttr (stuff , mypyc_interned_str .keys )) {
162+ if (PyDict_Check (stuff ) || PyObject_HasAttrWithError (stuff , mypyc_interned_str .keys ) > 0 ) {
163163 return PyDict_Update (dict , stuff );
164164 } else {
165165 return PyDict_MergeFromSeq2 (dict , stuff , 1 );
@@ -178,7 +178,7 @@ PyObject *CPyDict_FromAny(PyObject *obj) {
178178 if (!dict ) {
179179 return NULL ;
180180 }
181- if (_CPyObject_HasAttr (obj , mypyc_interned_str .keys )) {
181+ if (PyObject_HasAttrWithError (obj , mypyc_interned_str .keys ) > 0 ) {
182182 res = PyDict_Update (dict , obj );
183183 } else {
184184 res = PyDict_MergeFromSeq2 (dict , obj , 1 );
Original file line number Diff line number Diff line change @@ -376,16 +376,6 @@ _CPyDictView_New(PyObject *dict, PyTypeObject *type)
376376}
377377#endif
378378
379- static int
380- _CPyObject_HasAttr (PyObject * v , PyObject * name ) {
381- PyObject * tmp = NULL ;
382- int result = PyObject_GetOptionalAttr (v , name , & tmp );
383- if (tmp ) {
384- Py_DECREF (tmp );
385- }
386- return result ;
387- }
388-
389379#if CPY_3_12_FEATURES
390380
391381// These are copied from genobject.c in Python 3.12
You can’t perform that action at this time.
0 commit comments