提交 2a45fc55 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed gh-516: crash with on_unused_input='warn'

Also fixed the stack level to display the line where the function is created.
上级 1039cc2d
......@@ -8,6 +8,7 @@ import copy_reg
import cPickle
import itertools
import time
import warnings
import numpy
......@@ -1114,7 +1115,7 @@ class FunctionMaker(object):
for i in inputs:
if ((i.variable not in used_inputs) and (i.update is None)):
if on_unused_input == 'warn':
warnings.warn(msg % (i.variable, warn_msg), stacklevel=5)
warnings.warn(msg % (i.variable, warn_msg), stacklevel=6)
elif on_unused_input == 'raise':
raise UnusedInputError(msg % (i.variable, err_msg))
else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论