8000 prepare for pypy3.11 release by mattip · Pull Request #123 · python/pythoncapi-compat · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray import?

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