Skip to content

Commit

Permalink
The PyGC_* APIS are 3.10+ only; hide them behind #if
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Sep 9, 2023
1 parent f6fd00f commit 8901f4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/greenlet/greenlet_cpython_compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


#if PY_VERSION_HEX >= 0x30A00B1
# define GREENLET_PY310 1
/*
Python 3.10 beta 1 changed tstate->use_tracing to a nested cframe member.
See https://github.com/python/cpython/pull/25276
Expand All @@ -19,6 +20,7 @@ We have to save and restore this as well.
# define GREENLET_USE_CFRAME 1
#else
# define GREENLET_USE_CFRAME 0
# define GREENLET_PY310 0
#endif


Expand Down
5 changes: 4 additions & 1 deletion src/greenlet/greenlet_greenlet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,9 @@ namespace greenlet

// Instantiate one on the stack to save the GC state,
// and then disable GC. When it goes out of scope, GC will be
// restored to its original state.
// restored to its original state. Sadly, these APIs are only
// available on 3.10+; luckily, we only need them on 3.11+.
#if GREENLET_PY310
class GCDisabledGuard
{
private:
Expand All @@ -689,6 +691,7 @@ namespace greenlet
}
}
};
#endif

} // namespace greenlet ;

Expand Down

0 comments on commit 8901f4f

Please sign in to comment.