Skip to content

Commit

Permalink
Obtain gi_code by attribute lookup
Browse files Browse the repository at this point in the history
We were previously getting it by intrusively examining the structure,
which was flaky and indeed broke during the transition to 3.12, where
the gi_code struct member was re-implemented via get/set methods.

This should address #95.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed May 29, 2023
1 parent f0c408d commit e076d83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ijson/backends/yajl2_c/async_reading_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static PyObject *maybe_pop_event(async_reading_generator *self)
static int is_gen_coroutine(PyObject *o)
{
if (PyGen_CheckExact(o)) {
PyCodeObject *code = (PyCodeObject *)((PyGenObject*) o)->gi_code;
PyCodeObject *code = (PyCodeObject *)PyObject_GetAttrString(o, "gi_code");
return code->co_flags & CO_ITERABLE_COROUTINE;
}
return 0;
Expand Down

0 comments on commit e076d83

Please sign in to comment.