Skip to content

Commit bb11806

Browse files
authored
Merge pull request #482 from tacaswell/cp315_compat
FIX: add macros to guard against removed enum
2 parents 0708965 + 18ec3ac commit bb11806

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/greenlet/TGreenlet.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,13 @@ void GREENLET_NOINLINE(Greenlet::expose_frames)()
633633
// directly. This is important since GetFrameObject might
634634
// lazily _create_ the frame object and we don't want the
635635
// interpreter to lose track of it.
636+
//
637+
#if !GREENLET_PY315
638+
// This enum value was removed in
639+
// https://github.com/python/cpython/pull/141108
640+
636641
assert(iframe_copy.owner != FRAME_OWNED_BY_CSTACK);
642+
#endif
637643

638644
// We really want to just write:
639645
// PyFrameObject* frame = _PyFrame_GetFrameObject(iframe);

src/greenlet/greenlet_cpython_compat.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ Greenlet won't compile on anything older than Python 3.11 alpha 4 (see
6767
# define GREENLET_PY314 0
6868
#endif
6969

70+
#if PY_VERSION_HEX >= 0x30F0000
71+
# define GREENLET_PY315 1
72+
#else
73+
# define GREENLET_PY315 0
74+
#endif
75+
7076
#ifndef Py_SET_REFCNT
7177
/* Py_REFCNT and Py_SIZE macros are converted to functions
7278
https://bugs.python.org/issue39573 */

0 commit comments

Comments
 (0)