8000 prepare for pypy3.11 release (#123) · python/pythoncapi-compat@0f1d42a · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f1d42a

Browse files
authored
prepare for pypy3.11 release (#123)
1 parent 03e441d commit 0f1d42a

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

pythoncapi_compat.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ PyFrame_GetVarString(PyFrameObject *frame, const char *name)
287287

288288

289289
// bpo-39947 added PyThreadState_GetInterpreter() to Python 3.9.0a5
290-
#if PY_VERSION_HEX < 0x030900A5 || defined(PYPY_VERSION)
290+
#if PY_VERSION_HEX < 0x030900A5 || (defined(PYPY_VERSION) && PY_VERSION_HEX < 0x030B0000)
291291
static inline PyInterpreterState *
292292
PyThreadState_GetInterpreter(PyThreadState *tstate)
293293
{
@@ -918,7 +918,7 @@ static inline int
918918
PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg)
919919
{
920920
PyObject **dict = _PyObject_GetDictPtr(obj);
921-
if (*dict == NULL) {
921+
if (dict == NULL || *dict == NULL) {
922922
return -1;
923923
}
924924
Py_VISIT(*dict);
@@ -929,7 +929,7 @@ static inline void
929929
PyObject_ClearManagedDict(PyObject *obj)
930930
{
931931
PyObject **dict = _PyObject_GetDictPtr(obj);
932-
if (*dict == NULL) {
932+
if (dict == NULL || *dict == NULL) {
933933
return;
934934
}
935935
Py_CLEAR(*dict);

runtests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import argparse
1414
import os.path
1515
import shutil
16-
import subprocess
1716
import sys
1817
try:
1918
from shutil import which

tests/test_pythoncapi_compat_cext.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ test_import(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
758758
static void
759759
gc_collect(void)
760760
{
761-
#if defined(PYPY_VERSION)
761+
#if defined(PYPY_VERSION) && PY_VERSION_HEX < 0x030B0000
762762
PyObject *mod = PyImport_ImportModule("gc");
763763
assert(mod != _Py_NULL);
764764

@@ -1432,8 +1432,8 @@ test_long_api(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
14321432

14331433
// --- HeapCTypeWithManagedDict --------------------------------------------
14341434

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

14391439
typedef struct {

0 commit comments

Comments
 (0)
0