10000 Merge pull request #10 from bashtage/ulonglong · mattip/numpy@10e984d · GitHub
[go: up one dir, main page]

Skip to content

Commit 10e984d

Browse files
authored
Merge pull request #10 from bashtage/ulonglong
CLN: Remove references to long
2 parents 3d0ad7e + dae0ee8 commit 10e984d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

_randomgen/randomgen/common.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#cython: wraparound=False, nonecheck=False, boundscheck=False, cdivision=True
33

44
from collections import namedtuple
5-
from cpython cimport PyInt_AsLong, PyFloat_AsDouble
5+
from cpython cimport PyFloat_AsDouble
66
import sys
77
import numpy as np
88
cimport numpy as np
@@ -642,20 +642,20 @@ cdef object disc(void *func, brng_t *state, object size, object lock,
642642
if b_constraint != CONS_NONE and is_scalar:
643643
check_constraint(_db, b_name, b_constraint)
644644
elif narg_int64 == 1:
645-
_ib = PyInt_AsLong(b)
645+
_ib = <int64_t>b
646646
if b_constraint != CONS_NONE and is_scalar:
647647
check_constraint(<double>_ib, b_name, b_constraint)
648648
else:
649649
if narg_int64 > 0:
650-
_ia = PyInt_AsLong(a)
650+
_ia = <int64_t>a
651651
if a_constraint != CONS_NONE and is_scalar:
652652
check_constraint(<double>_ia, a_name, a_constraint)
653653
if narg_int64 > 1:
654-
_ib = PyInt_AsLong(b)
654+
_ib = <int64_t>b
655655
if b_constraint != CONS_NONE and is_scalar:
656656
check_constraint(<double>_ib, b_name, b_constraint)
657657
if narg_int64 > 2 :
658-
_ic = PyInt_AsLong(c)
658+
_ic = <int64_t>c
659659
if c_constraint != CONS_NONE and is_scalar:
660660
check_constraint(<double>_ic, c_name, c_constraint)
661661

_randomgen/randomgen/generator.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import operator
44
import warnings
55

66
from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
7-
from cpython cimport (Py_INCREF, PyComplex_RealAsDouble, PyInt_AsLong,
7+
from cpython cimport (Py_INCREF, PyComplex_RealAsDouble,
88
PyComplex_ImagAsDouble, PyComplex_FromDoubles, PyFloat_AsDouble)
99
from common cimport *
1010
from distributions cimport *
@@ -3237,7 +3237,7 @@ cdef class RandomGenerator:
32373237
return randoms
32383238

32393239
_dp = PyFloat_AsDouble(p)
3240-
_in = PyInt_AsLong(n)
3240+
_in = <int64_t>n
32413241
check_constraint(_dp, 'p', CONS_BOUNDED_0_1_NOTNAN)
32423242
check_constraint(<double>_in, 'n', CONS_NON_NEGATIVE)
32433243

@@ -3632,9 +3632,9 @@ cdef class RandomGenerator:
36323632

36333633
if np.PyArray_NDIM(ongood) == np.PyArray_NDIM(onbad) == np.PyArray_NDIM(onsample) == 0:
36343634

3635-
lngood = PyInt_AsLong(ngood)
3636-
lnbad = PyInt_AsLong(nbad)
3637-
lnsample = PyInt_AsLong(nsample)
3635+
lngood = <int64_t>ngood
3636+
lnbad = <int64_t>nbad
3637+
lnsample = <int64_t>nsample
36383638

36393639
if lngood < 0:
36403640
raise ValueError("ngood < 0")

0 commit comments

Comments
 (0)
0