Skip to content

Commit 675bd8b

Browse files
authored
use PyLong_AsLong instead of PyInt_AsLong (#182)
1 parent 2eb3cfc commit 675bd8b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.github/workflows/conda-package-cf.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ jobs:
295295
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
296296
SET PACKAGE_VERSION=%%F
297297
)
298-
SET "TEST_DEPENDENCIES=pytest pytest-cov"
299-
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} ${{ matrix.numpy }} scipy -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
298+
SET "TEST_DEPENDENCIES=pytest scipy"
299+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
300300
301301
- name: Report content of test environment
302302
shell: cmd /C CALL {0}

.github/workflows/conda-package.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ jobs:
131131
- name: Install mkl_fft
132132
run: |
133133
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
134-
conda create -n ${{ env.TEST_ENV_NAME }} python=${{ matrix.python }} $PACKAGE_NAME pytest scipy $CHANNELS
134+
conda create -n ${{ env.TEST_ENV_NAME }} python=${{ matrix.python }} "scipy>=1.10" $CHANNELS
135+
conda install -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME pytest $CHANNELS
135136
# Test installed packages
136137
conda list -n ${{ env.TEST_ENV_NAME }}
137138
@@ -295,15 +296,16 @@ jobs:
295296
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
296297
SET PACKAGE_VERSION=%%F
297298
)
298-
SET "TEST_DEPENDENCIES=pytest pytest-cov"
299-
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} scipy -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
299+
SET "TEST_DEPENDENCIES=pytest scipy"
300+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
300301
301302
- name: Report content of test environment
302303
shell: cmd /C CALL {0}
303304
run: |
304305
echo "Value of CONDA environment variable was: " %CONDA%
305306
echo "Value of CONDA_PREFIX environment variable was: " %CONDA_PREFIX%
306307
conda info && conda list -n ${{ env.TEST_ENV_NAME }}
308+
307309
- name: Run tests
308310
shell: cmd /C CALL {0}
309311
run: >-

mkl_fft/_pydfti.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _tls_dfti_cache_capsule():
8989
cdef extern from "Python.h":
9090
ctypedef int size_t
9191

92-
long PyInt_AsLong(object ob)
92+
long PyLong_AsLong(object ob)
9393
int PyObject_HasAttrString(object, char*)
9494

9595

@@ -262,7 +262,7 @@ cdef cnp.ndarray _process_arguments(
262262
xnd[0] = cnp.PyArray_NDIM(x_arr) # tensor-rank of the array
263263

264264
err = 0
265-
axis_[0] = PyInt_AsLong(axis)
265+
axis_[0] = PyLong_AsLong(axis)
266266
if (axis_[0] == -1 and PyErr_Occurred()):
267267
PyErr_Clear()
268268
err = 1
@@ -278,7 +278,7 @@ cdef cnp.ndarray _process_arguments(
278278
n_[0] = x_arr.shape[axis_[0]]
279279
else:
280280
try:
281-
n_[0] = PyInt_AsLong(n)
281+
n_[0] = PyLong_AsLong(n)
282282
except:
283283
err = 1
284284

@@ -334,7 +334,7 @@ cdef int _is_integral(object num):
334334
if num is None:
335335
return 0
336336
try:
337-
n = PyInt_AsLong(num)
337+
n = PyLong_AsLong(num)
338338
_integral = 1 if n > 0 else 0
339339
except:
340340
_integral = 0

0 commit comments

Comments
 (0)