File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
from collections import defaultdict
2
2
3
3
cimport cython
4
+ from cpython.object cimport PyObject
4
5
from cpython.pyport cimport PY_SSIZE_T_MAX
5
6
from cpython.slice cimport PySlice_GetIndicesEx
6
- from cpython.weakref cimport PyWeakref_NewRef
7
+ from cpython.weakref cimport (
8
+ PyWeakref_GetObject,
9
+ PyWeakref_NewRef,
10
+ )
7
11
from cython cimport Py_ssize_t
8
12
9
13
import numpy as np
@@ -25,6 +29,9 @@ from pandas._libs.util cimport (
25
29
is_integer_object,
26
30
)
27
31
32
+ cdef extern from " Python.h" :
33
+ PyObject* Py_None
34
+
28
35
29
36
@cython.final
30
37
@ cython.freelist (32 )
@@ -902,7 +909,8 @@ cdef class BlockValuesRefs:
902
909
# see GH#55245 and GH#55008
903
910
if force or len (self .referenced_blocks) > self .clear_counter:
904
911
self .referenced_blocks = [
905
- ref for ref in self .referenced_blocks if ref() is not None
912
+ ref for ref in self .referenced_blocks
913
+ if PyWeakref_GetObject(ref) != Py_None
906
914
]
907
915
nr_of_refs = len (self .referenced_blocks)
908
916
if nr_of_refs < self .clear_counter // 2 :
You can’t perform that action at this time.
0 commit comments