Skip to content

Commit e703995

Browse files
Fixing the issues
1 parent 7b10320 commit e703995

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Include/cpython/funcobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static inline PyObject* PyFunction_GET_CODE(PyObject *func) {
9595
return op->func_code;
9696
#endif
9797
}
98+
#define PyFunction_GET_CODE(func) PyFunction_GET_CODE(_PyObject_CAST(func))
9899
static inline PyObject* PyFunction_GET_GLOBALS(PyObject *func) {
99100
return _PyFunction_CAST(func)->func_globals;
100101
}

Objects/funcobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ func_set_code(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
665665
return -1;
666666
}
667667

668-
PyCodeObject *func_code = _Py_atomic_load_ptr(&op->func_code);
668+
PyCodeObject *func_code = (PyCodeObject *)PyFunction_GET_CODE(op);
669669
int old_flags = ((PyCodeObject *)func_code)->co_flags;
670670
int new_flags = ((PyCodeObject *)value)->co_flags;
671671
int mask = CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR;

0 commit comments

Comments
 (0)