Skip to content

Commit 8d6ff03

Browse files
committed
Add explicit error check
1 parent cb8d563 commit 8d6ff03

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mypyc/lib-rt/dict_ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int CPyDict_Update(PyObject *dict, PyObject *stuff) {
159159
int CPyDict_UpdateFromAny(PyObject *dict, PyObject *stuff) {
160160
if (PyDict_CheckExact(dict)) {
161161
// Argh this sucks
162-
if (PyDict_Check(stuff)|| PyObject_HasAttrWithError(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 (PyObject_HasAttrWithError(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);

0 commit comments

Comments
 (0)