Skip to content

Commit f0afe98

Browse files
fix default build
1 parent 1050673 commit f0afe98

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Objects/object.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
15841584
int
15851585
_PyObject_GetMethodStackRef(PyObject *obj, PyObject *name, _PyStackRef *method)
15861586
{
1587-
1587+
#ifdef Py_GIL_DISABLED
15881588
int meth_found = 0;
15891589

15901590
assert(PyStackRef_IsNull(*method));
@@ -1676,6 +1676,12 @@ _PyObject_GetMethodStackRef(PyObject *obj, PyObject *name, _PyStackRef *method)
16761676

16771677
_PyObject_SetAttributeErrorContext(obj, name);
16781678
return 0;
1679+
#else
1680+
PyObject *res = NULL;
1681+
int err = _PyObject_GetMethod(obj, name, &res);
1682+
*method = res == NULL ? PyStackRef_NULL : PyStackRef_FromPyObjectSteal(res);
1683+
return err;
1684+
#endif
16791685
}
16801686

16811687
/* Generic GetAttr functions - put these in your tp_[gs]etattro slot. */

Objects/typeobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5618,8 +5618,7 @@ _PyType_LookupStackRef(PyTypeObject *type, PyObject *name, _PyStackRef *result)
56185618
assert(type->tp_version_tag);
56195619
OBJECT_STAT_INC_COND(type_cache_hits, !is_dunder_name(name));
56205620
OBJECT_STAT_INC_COND(type_cache_dunder_hits, is_dunder_name(name));
5621-
Py_XINCREF(entry->value);
5622-
return entry->value;
5621+
*result = PyStackRef_FromPyObjectNew(entry->value);
56235622
}
56245623
#endif
56255624
OBJECT_STAT_INC_COND(type_cache_misses, !is_dunder_name(name));

0 commit comments

Comments
 (0)