Skip to content

Commit e076d83

Browse files
committed
Obtain gi_code by attribute lookup
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 <rtobar@icrar.org>
1 parent f0c408d commit e076d83

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ijson/backends/yajl2_c/async_reading_generator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static PyObject *maybe_pop_event(async_reading_generator *self)
7777
static int is_gen_coroutine(PyObject *o)
7878
{
7979
if (PyGen_CheckExact(o)) {
80-
PyCodeObject *code = (PyCodeObject *)((PyGenObject*) o)->gi_code;
80+
PyCodeObject *code = (PyCodeObject *)PyObject_GetAttrString(o, "gi_code");
8181
return code->co_flags & CO_ITERABLE_COROUTINE;
8282
}
8383
return 0;

0 commit comments

Comments
 (0)