8000 Attempting to fix Windows CI · scikit-learn/scikit-learn@121a95d · GitHub
[go: up one dir, main page]

Skip to content

Commit 121a95d

Browse files
committed
Attempting to fix Windows CI
1 parent 760a261 commit 121a95d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sklearn/feature_extraction/_hashing.pyx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Author: Lars Buitinck
22
# License: BSD 3 clause
33

4+
import os
5+
import sys
46
import array
57
from cpython cimport array
68
cimport cython
@@ -34,12 +36,19 @@ def transform(raw_X, Py_ssize_t n_features, dtype, bint alternate_sign=1):
3436
cdef array.array indices
3537
cdef array.array indptr
3638
indices = array.array("i")
37-
indptr = array.array("l", [0])
39+
if sys.version_info >= (3, 3):
40+
indptr = array.array("q", [0])
41+
elif os.name == 'nt':
42+
# Win PY2.7
43+
indptr = array.array("i", [0])
44+
else:
45+
# Linux PY2.7
46+
indptr = array.array("l", [0])
3847

3948
# Since Python array does not understand Numpy dtypes, we grow the indices
4049
# and values arrays ourselves. Use a Py_ssize_t capacity for safety.
4150
cdef Py_ssize_t capacity = 8192 # arbitrary
42-
cdef np.intp_t size = 0
51+
cdef np.int64_t size = 0
4352
cdef np.ndarray values = np.empty(capacity, dtype=dtype)
4453

4554
for x in raw_X:

0 commit comments

Comments
 (0)
0