Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes from pypy #482

Merged
merged 17 commits into from
Feb 20, 2025
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
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
# Duplicate changes to this matrix to 'poc_tests'
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ['3.9', '3.10']
compiler: [""]
include:
Expand All @@ -36,7 +36,7 @@ jobs:
# pythonVersion: $(python.version)

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v5.4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down Expand Up @@ -64,13 +64,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.12', '3.11', '3.10', '3.9', '3.8']
# Cannot install 3.12 on ubuntu-latest
python-version: ['3.11', '3.10', '3.9', '3.8']

steps:
- uses: actions/checkout@v4

- name: Set up Python from deadsnakes
uses: deadsnakes/action@v2.1.1 # Upgrading will cause test failures.
uses: deadsnakes/action@v3.2.0
with:
python-version: ${{ matrix.python-version }}
debug: true
Expand All @@ -96,7 +97,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ['3.10']
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -159,7 +160,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ['3.9']

steps:
Expand Down Expand Up @@ -219,7 +220,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ['3.10']

steps:
Expand Down Expand Up @@ -253,7 +254,7 @@ jobs:
# - template: azure-templates/python.yml

- name: Install / Upgrade system requirements
run: sudo apt update && sudo apt install -y libclang-11-dev
run: sudo apt update && sudo apt install -y libclang-17-dev

- name: Install / Upgrade Python requirements
run: |
Expand Down Expand Up @@ -404,7 +405,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'

- name: Install / Upgrade system dependencies
run: sudo apt update && sudo apt install -y valgrind
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/valgrind-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ jobs:
# name: Valgrind tests
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install / Upgrade system dependencies
run: sudo apt update && sudo apt install -y valgrind

- name: Set up Python
uses: actions/setup-python@v5.4
with:
python-version: 3.9

- name: Install / Upgrade Python dependencies
run: python -m pip install --upgrade pip wheel

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ sphinx==5.0.2
sphinx-rtd-theme==2.0.0
sphinx-autobuild==2021.3.14
sphinx-c-autodoc==1.3.0
clang==11.0
clang==17.0.6
docutils==0.16 # docutils >= 0.17 fails to render bullet lists :/
2 changes: 1 addition & 1 deletion hpy/devel/include/hpy/hpydef.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {
#include "hpy/autogen_hpyslot.h"
#include "hpy/cpy_types.h"

typedef void* (*HPyCFunction)();
typedef void* (*HPyCFunction)(void);
typedef void (*HPyFunc_Capsule_Destructor)(const char *name, void *pointer, void *context);

/**
Expand Down
10 changes: 8 additions & 2 deletions hpy/devel/include/hpy/hpymodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,23 @@ typedef struct {
*/
#define HPy_MODINIT(ext_name, mod_def) \
HPy_EXPORTED_FUNC uint32_t \
get_required_hpy_major_version_##ext_name() \
get_required_hpy_major_version_##ext_name(void); \
uint32_t \
get_required_hpy_major_version_##ext_name(void) \
{ \
return HPY_ABI_VERSION; \
} \
HPy_EXPORTED_FUNC uint32_t \
get_required_hpy_minor_version_##ext_name() \
get_required_hpy_minor_version_##ext_name(void); \
uint32_t \
get_required_hpy_minor_version_##ext_name(void) \
{ \
return HPY_ABI_VERSION_MINOR; \
} \
_HPy_CTX_MODIFIER HPyContext *_ctx_for_trampolines; \
HPy_EXPORTED_FUNC void \
HPyInitGlobalContext_##ext_name(HPyContext *ctx); \
void \
HPyInitGlobalContext_##ext_name(HPyContext *ctx) \
{ \
_ctx_for_trampolines = ctx; \
Expand Down
2 changes: 1 addition & 1 deletion hpy/universal/src/ctx_meth.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void _buffer_py2h(HPyContext *ctx, const Py_buffer *src, HPy_buffer *dest

HPyAPI_IMPL void
ctx_CallRealFunctionFromTrampoline(HPyContext *ctx, HPyFunc_Signature sig,
void* (*func)(), void *args)
HPyCFunction func, void *args)
{
switch (sig) {
case HPyFunc_VARARGS: {
Expand Down
2 changes: 1 addition & 1 deletion hpy/universal/src/ctx_meth.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

HPyAPI_IMPL void
ctx_CallRealFunctionFromTrampoline(HPyContext *ctx, HPyFunc_Signature sig,
void* (*func)(), void *args);
HPyCFunction func, void *args);
7 changes: 7 additions & 0 deletions test/debug/test_handles_invalid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import sys
from hpy.debug.leakdetector import LeakDetector
from ..support import SUPPORTS_SYS_EXECUTABLE, IS_PYTHON_DEBUG_BUILD
from ..conftest import IS_VALGRIND_RUN
Expand All @@ -9,6 +10,8 @@ def hpy_abi():
yield "debug"


@pytest.mark.skipif(sys.implementation.name == 'pypy',
reason="Cannot recover from use-after-close on pypy")
def test_no_invalid_handle(compiler, hpy_debug_capture):
# Basic sanity check that valid code does not trigger any error reports
mod = compiler.make_module("""
Expand All @@ -33,6 +36,8 @@ def test_no_invalid_handle(compiler, hpy_debug_capture):
assert hpy_debug_capture.invalid_handles_count == 0


@pytest.mark.skipif(sys.implementation.name == 'pypy',
reason="Cannot recover from use-after-close on pypy")
def test_cant_use_closed_handle(compiler, hpy_debug_capture):
mod = compiler.make_module("""
HPyDef_METH(f, "f", HPyFunc_O, .doc="double close")
Expand Down Expand Up @@ -106,6 +111,8 @@ def test_cant_use_closed_handle(compiler, hpy_debug_capture):
assert hpy_debug_capture.invalid_handles_count == 6


@pytest.mark.skipif(sys.implementation.name == 'pypy',
reason="Cannot recover from use-after-close on pypy")
def test_keeping_and_reusing_argument_handle(compiler, hpy_debug_capture):
mod = compiler.make_module("""
HPy keep;
Expand Down
Loading