Skip to content

Commit 51bda81

Browse files
fixed build break
1 parent d46811a commit 51bda81

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

mkl_random/mklrand.pyx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ cdef class RandomState:
11911191
self.set_state(state)
11921192

11931193
def __reduce__(self):
1194-
return (mkl_random.__RandomState_ctor, (), self.get_state())
1194+
return (__RandomState_ctor, (), self.get_state())
11951195

11961196
def leapfrog(self, int k, int nstreams):
11971197
"""
@@ -5822,6 +5822,17 @@ cdef class RandomState:
58225822
return arr
58235823

58245824

5825+
def __RandomState_ctor():
5826+
"""Return a RandomState instance.
5827+
This function exists solely to assist (un)pickling.
5828+
Note that the state of the RandomState returned here is irrelevant, as this function's
5829+
entire purpose is to return a newly allocated RandomState whose state pickle can set.
5830+
Consequently the RandomState returned by this function is a freshly allocated copy
5831+
with a seed=0.
5832+
See https://github.com/numpy/numpy/issues/4763 for a detailed discussion
5833+
"""
5834+
return RandomState(seed=0)
5835+
58255836
_rand = RandomState()
58265837
seed = _rand.seed
58275838
get_state = _rand.get_state

0 commit comments

Comments
 (0)