Skip to content

Commit c97035b

Browse files
authored
Merge pull request #262 from mattip/pypy3.10
add guards for PyPy
2 parents 5d0f397 + 105fec6 commit c97035b

7 files changed

Lines changed: 29 additions & 27 deletions

File tree

.github/workflows/cibuildwheel.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
os: [ubuntu-20.04, windows-2019, macos-latest]
21+
os: [ubuntu-22.04, windows-2022, macos-latest]
2222

2323
steps:
2424
# Note: the action happens inside a docker image
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626

2727
- name: Build wheels
28-
uses: pypa/cibuildwheel@v2.11.4
28+
uses: pypa/cibuildwheel@v2.21.1
2929
env:
3030
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
3131
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
@@ -48,10 +48,10 @@ jobs:
4848

4949
steps:
5050
# Note: not inside a docker
51-
- uses: actions/checkout@v3
52-
- uses: actions/setup-python@v3
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-python@v5
5353
with:
54-
python-version: 'pypy-3.9'
54+
python-version: 'pypy-3.10'
5555

5656
- name: Install system libraries
5757
run: sudo apt install -y libunwind-dev libelf-dev libdwarf-dev rename

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
# Test all supported versions on Ubuntu:
2020
os: [ubuntu-latest]
21-
python: ["3.9", "3.10", "pypy-3.9"]
21+
python: ["3.9", "3.10", "3.11", "pypy-3.10"]
2222
experimental: [false]
2323
# include:
2424
# - os: macos-latest
@@ -28,13 +28,13 @@ jobs:
2828
# python: "3.10"
2929
# experimental: false
3030
steps:
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3232
- name: Install libunwind
3333
run: |
3434
sudo apt install -y libunwind-dev
3535
pkg-config libunwind --cflags --libs-only-l
3636
- name: Set up Python ${{ matrix.python }}
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: ${{ matrix.python }}
4040
- name: Install

src/vmp_stack.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
#include "vmprof.h"
1515
#include "compat.h"
1616

17-
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
18-
#include "internal/pycore_frame.h"
19-
#include "populate_frames.h"
20-
#endif
21-
2217
#ifdef VMP_SUPPORTS_NATIVE_PROFILING
2318

2419
#if defined(VMPROF_LINUX) || defined(VMPROF_BSD)

src/vmp_stack.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
#include "vmprof.h"
44

5-
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
6-
#include "internal/pycore_frame.h"
7-
#include "populate_frames.h"
5+
#ifndef RPYTHON_VMPROF
6+
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
7+
#include "internal/pycore_frame.h"
8+
#include "populate_frames.h"
9+
#endif
810
#endif
911

10-
#if PY_VERSION_HEX >= 0x030B0000 /* >= 3.11 */
12+
#if PY_VERSION_HEX >= 0x030B0000 && !defined(RPYTHON_VMPROF) /* >= 3.11 */
1113
int vmp_walk_and_record_stack(_PyInterpreterFrame * frame, void **data,
1214
int max_depth, int signal, intptr_t pc);
1315
#else

src/vmprof_unix.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "vmprof_unix.h"
22

3-
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
4-
#include "populate_frames.h"
3+
#ifndef RPYTHON_VMPROF
4+
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
5+
#include "populate_frames.h"
6+
#endif
57
#endif
68

79
#ifdef VMPROF_UNIX
@@ -479,7 +481,7 @@ int vmprof_register_virtual_function(char *code_name, intptr_t code_uid,
479481
return 0;
480482
}
481483

482-
#if PY_VERSION_HEX < 0x030900B1 /* < 3.9 */
484+
#if PY_VERSION_HEX < 0x030900B1 && ! defined(RPYTHON_VMPROF) /* < 3.9 */
483485
static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
484486
{
485487
Py_XINCREF(tstate->frame);
@@ -511,8 +513,8 @@ int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, i
511513
frame = PyThreadState_GetFrame(current);
512514
#endif
513515

516+
#endif /* RPYTHON_VMPROF */
514517

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

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

525-
#if PY_VERSION_HEX < 0x030B0000 /* < 3.11 */
527+
#if PY_VERSION_HEX < 0x030B0000 && ! defined(RPYTHON_VMPROF) /* < 3.11 */
526528
Py_XDECREF(frame);
527529
#endif
528530

src/vmprof_win.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#include "vmprof_win.h"
22

3-
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
4-
#include "internal/pycore_frame.h"
5-
#include "populate_frames.h"
3+
#ifndef RPYTHON_VMPROF
4+
#if PY_VERSION_HEX >= 0x030b00f0 /* >= 3.11 */
5+
#include "internal/pycore_frame.h"
6+
#include "populate_frames.h"
7+
#endif
68
#endif
79

810
volatile int thread_started = 0;
@@ -58,7 +60,7 @@ int vmp_write_all(const char *buf, size_t bufsize)
5860
return 0;
5961
}
6062

61-
#if PY_VERSION_HEX < 0x030900B1 /* < 3.9 */
63+
#if PY_VERSION_HEX < 0x030900B1 && ! defined(RPYTHON_VMPROF) /* < 3.9 */
6264
static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
6365
{
6466
Py_XINCREF(tstate->frame);

test_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
six
22
requests
3+
urllib3==1.26.6 ; python_version < '3.9'
34
backports.shutil_which
45
cffi
56
pytest

0 commit comments

Comments
 (0)