@@ -17,7 +17,8 @@ from cpython cimport Py_INCREF, PyObject, PyTypeObject
17
17
from libc.stdlib cimport free
18
18
from libc.string cimport memcpy
19
19
from libc.string cimport memset
20
- from libc.stdint cimport SIZE_MAX
20
+ from libc.stdint cimport INTPTR_MAX
21
+ from libcpp.vector cimport vector
21
22
from libcpp.algorithm cimport pop_heap
22
23
from libcpp.algorithm cimport push_heap
23
24
from libcpp cimport bool
@@ -252,7 +253,7 @@ cdef class DepthFirstTreeBuilder(TreeBuilder):
252
253
impurity, n_node_samples,
253
254
weighted_n_node_samples)
254
255
255
- if node_id == SIZE_MAX :
256
+ if node_id == INTPTR_MAX :
256
257
rc = - 1
257
258
break
258
259
@@ -492,7 +493,7 @@ cdef class BestFirstTreeBuilder(TreeBuilder):
492
493
is_left, is_leaf,
493
494
split_ptr, impurity, n_node_samples,
494
495
weighted_n_node_samples)
495
- if node_id == SIZE_MAX :
496
+ if node_id == INTPTR_MAX :
496
497
return - 1
497
498
498
499
# compute values also for split nodes (might become leafs later).
@@ -550,7 +551,7 @@ cdef class BaseTree:
550
551
551
552
cdef int _resize_c(
552
553
self ,
553
- SIZE_t capacity = SIZE_MAX
554
+ SIZE_t capacity = INTPTR_MAX
554
555
) nogil except - 1 :
555
556
""" Guts of _resize
556
557
@@ -560,7 +561,7 @@ cdef class BaseTree:
560
561
if capacity == self .capacity and self .nodes != NULL :
561
562
return 0
562
563
563
- if capacity == SIZE_MAX :
564
+ if capacity == INTPTR_MAX :
564
565
if self .capacity == 0 :
565
566
capacity = 3 # default initial value
566
567
else :
@@ -669,7 +670,7 @@ cdef class BaseTree:
669
670
670
671
if node_id >= self .capacity:
671
672
if self ._resize_c() != 0 :
672
- return SIZE_MAX
673
+ return INTPTR_MAX
673
674
674
675
cdef Node* node = & self .nodes[node_id]
675
676
node.impurity = impurity
@@ -1901,7 +1902,7 @@ cdef _build_pruned_tree(
1901
1902
node.impurity, node.n_node_samples,
1902
1903
node.weighted_n_node_samples)
1903
1904
1904
- if new_node_id == SIZE_MAX :
1905
+ if new_node_id == INTPTR_MAX :
1905
1906
rc = - 1
1906
1907
break
1907
1908
0 commit comments