From 3f743d25f6dfbce0a07c72ef76930d9d92f33a9b Mon Sep 17 00:00:00 2001 From: Gerrit Holl Date: Wed, 25 Nov 2015 16:11:23 +0000 Subject: [PATCH] BUG: Fix for #6719 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit numpy/random/mtrand/mtrand.pyx contains a line where cython fails to compile, complaining “Pythonic division not allowed without gil”. By running this code segment under cdivision(True), this problem is avoided. --- numpy/random/mtrand/mtrand.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 9861204d9d56..bfbeb3c7bcf0 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -127,6 +127,7 @@ cdef extern from "initarray.h": # Initialize numpy import_array() +cimport cython import numpy as np import operator import warnings @@ -4475,7 +4476,7 @@ cdef class RandomState: mnarr = multin mnix = PyArray_DATA(mnarr) sz = PyArray_SIZE(mnarr) - with self.lock, nogil: + with self.lock, nogil, cython.cdivision(True): i = 0 while i < sz: Sum = 1.0