Skip to content

Commit c5230b5

Browse files
committed
Avoid ifdef, align defines, fix some small nits, reduce cibw verbosity
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
1 parent 2e15f49 commit c5230b5

4 files changed

Lines changed: 7 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ jobs:
330330
env:
331331
CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
332332
CIBW_ENVIRONMENT_LINUX: ACLOCAL_PATH="/usr/share/aclocal" CSP_MANYLINUX="ON" CCACHE_DIR="/host/home/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="/host${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="/host${{ env.VCPKG_DOWNLOADS }}"
333-
CIBW_BUILD_VERBOSITY: 3
334333
if: ${{ runner.os == 'Linux' }}
335334

336335
########
@@ -341,7 +340,6 @@ jobs:
341340
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
342341
CIBW_ENVIRONMENT_MACOS: CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
343342
CIBW_ARCHS_MACOS: arm64
344-
CIBW_BUILD_VERBOSITY: 3
345343
if: ${{ matrix.os == 'macos-14' }}
346344

347345
##########

cpp/csp/python/Common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <Python.h>
55

6-
#define IS_LT_PYTHON_3_11 (PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 11) )
7-
#define IS_GE_PYTHON_3_13 (PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 12) )
6+
#define IS_PRE_PYTHON_3_11 (PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 11) )
7+
#define IS_PRE_PYTHON_3_13 (PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 13) )
88

99
#define INIT_PYDATETIME if( !PyDateTimeAPI ) { PyDateTime_IMPORT; }
1010

cpp/csp/python/PyNode.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <limits>
1616
#include <frameobject.h>
1717

18-
#if !IS_LT_PYTHON_3_11
19-
#if IS_GE_PYTHON_3_13
18+
#if !IS_PRE_PYTHON_3_11
19+
#if !IS_PRE_PYTHON_3_13
2020
# define Py_BUILD_CORE 1
2121
#endif
2222
#include <internal/pycore_code.h>
@@ -64,7 +64,7 @@ void PyNode::init( PyObjectPtr inputs, PyObjectPtr outputs )
6464
m_localVars = ( PyObject *** ) calloc( numInputs(), sizeof( PyObject ** ) );
6565

6666
//printf( "Starting %s slots: %ld rank: %d\n", name(), slots, rank() );
67-
#if IS_LT_PYTHON_3_11
67+
#if IS_PRE_PYTHON_3_11
6868
PyCodeObject * code = ( PyCodeObject * ) pygen -> gi_code;
6969
Py_ssize_t numCells = PyTuple_GET_SIZE( code -> co_cellvars );
7070
size_t cell2argIdx = 0;
@@ -88,13 +88,7 @@ void PyNode::init( PyObjectPtr inputs, PyObjectPtr outputs )
8888
//PY311+ changes
8989
#else
9090
_PyInterpreterFrame * frame = ( _PyInterpreterFrame * ) pygen -> gi_iframe;
91-
PyCodeObject * code;
92-
93-
#if IS_GE_PYTHON_3_13
94-
code = (PyCodeObject *)PyUnstable_InterpreterFrame_GetCode(frame);
95-
#else
96-
code = frame -> f_code;
97-
#endif
91+
PyCodeObject * code = PyGen_GetCode( ( PyGenObject * ) pygen );
9892
int localPlusIndex = 0;
9993
for( int stackloc = code -> co_argcount; stackloc < code -> co_nlocalsplus; ++stackloc, ++localPlusIndex )
10094
{

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ replace = 'project(csp VERSION "{new_version}")'
146146
ignore = []
147147

148148
[tool.cibuildwheel]
149-
build = "cp39-* cp310-* cp311-* cp312-*"
149+
build = "cp39-* cp310-* cp311-* cp312-* cp313-*"
150150
test-command = "echo 'TODO'"
151151
test-requires = [
152152
"pytest",
@@ -177,7 +177,6 @@ archs = "arm64"
177177
[tool.cibuildwheel.windows]
178178
before-all = "make dependencies-win"
179179
before-build = "make requirements"
180-
181180
archs = "AMD64"
182181
skip = "*win32 *arm_64"
183182

0 commit comments

Comments
 (0)