Skip to content

Commit

Permalink
prepare for pypy3.11 release (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip authored Nov 19, 2024
1 parent 03e441d commit 0f1d42a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pythoncapi_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ PyFrame_GetVarString(PyFrameObject *frame, const char *name)


// bpo-39947 added PyThreadState_GetInterpreter() to Python 3.9.0a5
#if PY_VERSION_HEX < 0x030900A5 || defined(PYPY_VERSION)
#if PY_VERSION_HEX < 0x030900A5 || (defined(PYPY_VERSION) && PY_VERSION_HEX < 0x030B0000)
static inline PyInterpreterState *
PyThreadState_GetInterpreter(PyThreadState *tstate)
{
Expand Down Expand Up @@ -918,7 +918,7 @@ static inline int
PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg)
{
PyObject **dict = _PyObject_GetDictPtr(obj);
if (*dict == NULL) {
if (dict == NULL || *dict == NULL) {
return -1;
}
Py_VISIT(*dict);
Expand All @@ -929,7 +929,7 @@ static inline void
PyObject_ClearManagedDict(PyObject *obj)
{
PyObject **dict = _PyObject_GetDictPtr(obj);
if (*dict == NULL) {
if (dict == NULL || *dict == NULL) {
return;
}
Py_CLEAR(*dict);
Expand Down
1 change: 0 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import argparse
import os.path
import shutil
import subprocess
import sys
try:
from shutil import which
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pythoncapi_compat_cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ test_import(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
static void
gc_collect(void)
{
#if defined(PYPY_VERSION)
#if defined(PYPY_VERSION) && PY_VERSION_HEX < 0x030B0000
PyObject *mod = PyImport_ImportModule("gc");
assert(mod != _Py_NULL);

Expand Down Expand Up @@ -1432,8 +1432,8 @@ test_long_api(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))

// --- HeapCTypeWithManagedDict --------------------------------------------

// Py_TPFLAGS_MANAGED_DICT was added to Python 3.11.0a3
#if PY_VERSION_HEX >= 0x030B00A3
// Py_TPFLAGS_MANAGED_DICT was added to Python 3.11.0a3 but is not implemented on PyPy
#if PY_VERSION_HEX >= 0x030B00A3 && ! defined(PYPY_VERSION)
# define TEST_MANAGED_DICT

typedef struct {
Expand Down

0 comments on commit 0f1d42a

Please sign in to comment.