Skip to content

Commit

Permalink
Merge pull request #262 from mattip/pypy3.10
Browse files Browse the repository at this point in the history
add guards for PyPy
  • Loading branch information
mattip authored Sep 26, 2024
2 parents 5d0f397 + 105fec6 commit c97035b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 27 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-latest]
os: [ubuntu-22.04, windows-2022, macos-latest]

steps:
# Note: the action happens inside a docker image
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.11.4
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
Expand All @@ -48,10 +48,10 @@ jobs:

steps:
# Note: not inside a docker
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 'pypy-3.9'
python-version: 'pypy-3.10'

- name: Install system libraries
run: sudo apt install -y libunwind-dev libelf-dev libdwarf-dev rename
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
# Test all supported versions on Ubuntu:
os: [ubuntu-latest]
python: ["3.9", "3.10", "pypy-3.9"]
python: ["3.9", "3.10", "3.11", "pypy-3.10"]
experimental: [false]
# include:
# - os: macos-latest
Expand All @@ -28,13 +28,13 @@ jobs:
# python: "3.10"
# experimental: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install libunwind
run: |
sudo apt install -y libunwind-dev
pkg-config libunwind --cflags --libs-only-l
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install
Expand Down
5 changes: 0 additions & 5 deletions src/vmp_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#include "vmprof.h"
#include "compat.h"

#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "internal/pycore_frame.h"
#include "populate_frames.h"
#endif

#ifdef VMP_SUPPORTS_NATIVE_PROFILING

#if defined(VMPROF_LINUX) || defined(VMPROF_BSD)
Expand Down
10 changes: 6 additions & 4 deletions src/vmp_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

#include "vmprof.h"

#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "internal/pycore_frame.h"
#include "populate_frames.h"
#ifndef RPYTHON_VMPROF
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "internal/pycore_frame.h"
#include "populate_frames.h"
#endif
#endif

#if PY_VERSION_HEX >= 0x030B0000 /* >= 3.11 */
#if PY_VERSION_HEX >= 0x030B0000 && !defined(RPYTHON_VMPROF) /* >= 3.11 */
int vmp_walk_and_record_stack(_PyInterpreterFrame * frame, void **data,
int max_depth, int signal, intptr_t pc);
#else
Expand Down
12 changes: 7 additions & 5 deletions src/vmprof_unix.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "vmprof_unix.h"

#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "populate_frames.h"
#ifndef RPYTHON_VMPROF
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "populate_frames.h"
#endif
#endif

#ifdef VMPROF_UNIX
Expand Down Expand Up @@ -479,7 +481,7 @@ int vmprof_register_virtual_function(char *code_name, intptr_t code_uid,
return 0;
}

#if PY_VERSION_HEX < 0x030900B1 /* < 3.9 */
#if PY_VERSION_HEX < 0x030900B1 && ! defined(RPYTHON_VMPROF) /* < 3.9 */
static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
{
Py_XINCREF(tstate->frame);
Expand Down Expand Up @@ -511,8 +513,8 @@ int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, i
frame = PyThreadState_GetFrame(current);
#endif

#endif /* RPYTHON_VMPROF */

#endif
if (frame == NULL) {
#if DEBUG
fprintf(stderr, "WARNING: get_stack_trace, frame is NULL\n");
Expand All @@ -522,7 +524,7 @@ int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, i

int res = vmp_walk_and_record_stack(frame, result, max_depth, 1, pc);

#if PY_VERSION_HEX < 0x030B0000 /* < 3.11 */
#if PY_VERSION_HEX < 0x030B0000 && ! defined(RPYTHON_VMPROF) /* < 3.11 */
Py_XDECREF(frame);
#endif

Expand Down
10 changes: 6 additions & 4 deletions src/vmprof_win.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "vmprof_win.h"

#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "internal/pycore_frame.h"
#include "populate_frames.h"
#ifndef RPYTHON_VMPROF
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
#include "internal/pycore_frame.h"
#include "populate_frames.h"
#endif
#endif

volatile int thread_started = 0;
Expand Down Expand Up @@ -58,7 +60,7 @@ int vmp_write_all(const char *buf, size_t bufsize)
return 0;
}

#if PY_VERSION_HEX < 0x030900B1 /* < 3.9 */
#if PY_VERSION_HEX < 0x030900B1 && ! defined(RPYTHON_VMPROF) /* < 3.9 */
static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
{
Py_XINCREF(tstate->frame);
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
six
requests
urllib3==1.26.6 ; python_version < '3.9'
backports.shutil_which
cffi
pytest
Expand Down

0 comments on commit c97035b

Please sign in to comment.