From 7884a8c9f5f5c6657413dbeaa59ad969280d38ea Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Sat, 23 Jan 2016 15:58:58 +0100 Subject: ENH: Add stacklevel to all (or almost all) our function calls --- numpy/lib/npyio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'numpy/lib/npyio.py') diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 534aa695c..0b2fdfaba 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -944,7 +944,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, # End of lines reached first_line = '' first_vals = [] - warnings.warn('loadtxt: Empty input file: "%s"' % fname) + warnings.warn('loadtxt: Empty input file: "%s"' % fname, stacklevel=2) N = len(usecols or first_vals) dtype_types, packing = flatten_dtype(dtype) @@ -1542,7 +1542,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, # return an empty array if the datafile is empty first_line = asbytes('') first_values = [] - warnings.warn('genfromtxt: Empty input file: "%s"' % fname) + warnings.warn('genfromtxt: Empty input file: "%s"' % fname, stacklevel=2) # Should we take the first values as names ? if names is True: @@ -1827,7 +1827,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, raise ValueError(errmsg) # Issue a warning ? else: - warnings.warn(errmsg, ConversionWarning) + warnings.warn(errmsg, ConversionWarning, stacklevel=2) # Strip the last skip_footer data if skip_footer > 0: -- cgit v1.2.1