Skip to content

Commit 218f3ef

Browse files
committed
Set stacklevel on warning for proper issue pinpointing.
without the stacklevel the warning point to the frame where the warnign is issued. In this case we likely want to be at least two callers up as we want to see the caller of `create` or `open_array`.
1 parent 5bf61ef commit 218f3ef

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

zarr/creation.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,18 @@ def _kwargs_compat(compressor, fill_value, kwargs):
149149

150150
if compressor != 'default':
151151
# 'compressor' overrides 'compression'
152-
if 'compression' in kwargs:
153-
warn("'compression' keyword argument overridden by 'compressor'")
154-
del kwargs['compression']
155-
if 'compression_opts' in kwargs:
156-
warn("'compression_opts' keyword argument overridden by 'compressor'")
157-
del kwargs['compression_opts']
152+
if "compression" in kwargs:
153+
warn(
154+
"'compression' keyword argument overridden by 'compressor'",
155+
stacklevel=3,
156+
)
157+
del kwargs["compression"]
158+
if "compression_opts" in kwargs:
159+
warn(
160+
"'compression_opts' keyword argument overridden by 'compressor'",
161+
stacklevel=3,
162+
)
163+
del kwargs["compression_opts"]
158164

159165
elif 'compression' in kwargs:
160166
compression = kwargs.pop('compression')

0 commit comments

Comments
 (0)