提交 175683db authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #3110 from nouiz/fix_crash_at_exit

Fix error at exit. Do this also solve gh-3088?
...@@ -133,7 +133,6 @@ import warnings ...@@ -133,7 +133,6 @@ import warnings
import numpy import numpy
import numpy.distutils import numpy.distutils
import numpy.distutils.system_info
try: try:
import numpy.distutils.__config__ import numpy.distutils.__config__
except ImportError: except ImportError:
...@@ -162,6 +161,7 @@ _logger = logging.getLogger('theano.tensor.blas') ...@@ -162,6 +161,7 @@ _logger = logging.getLogger('theano.tensor.blas')
# We need to define blas.ldflag before we try to import scipy. # We need to define blas.ldflag before we try to import scipy.
# Otherwise, we give an optimization warning for no reason in some cases. # Otherwise, we give an optimization warning for no reason in some cases.
def default_blas_ldflags(): def default_blas_ldflags():
global numpy
try: try:
if (hasattr(numpy.distutils, '__config__') and if (hasattr(numpy.distutils, '__config__') and
numpy.distutils.__config__): numpy.distutils.__config__):
...@@ -169,6 +169,16 @@ def default_blas_ldflags(): ...@@ -169,6 +169,16 @@ def default_blas_ldflags():
# don't print information to the user. # don't print information to the user.
blas_info = numpy.distutils.__config__.blas_opt_info blas_info = numpy.distutils.__config__.blas_opt_info
else: else:
# We do this import only here, as in some setup, if we
# just import theano and exit, with the import at global
# scope, we get this error at exit: "Exception TypeError:
# "'NoneType' object is not callable" in <bound method
# Popen.__del__ of <subprocess.Popen object at 0x21359d0>>
# ignored"
# This happen with Python 2.7.3 |EPD 7.3-1 and numpy 1.8.1
import numpy.distutils.system_info # noqa
# We need to catch warnings as in some cases NumPy print # We need to catch warnings as in some cases NumPy print
# stuff that we don't want the user to see like this: # stuff that we don't want the user to see like this:
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论