diff --git a/skimage/graph/_mcp.pyx b/skimage/graph/_mcp.pyx index 6174f831..5669c7d0 100644 --- a/skimage/graph/_mcp.pyx +++ b/skimage/graph/_mcp.pyx @@ -304,7 +304,7 @@ cdef class MCP: self.flat_costs = costs.astype(FLOAT_D, copy=False).ravel('F') except TypeError: self.flat_costs = costs.astype(FLOAT_D).flatten('F') - warnings.warn('Upgrading NumPy should decrease memory usage and increase speed.', Warning) + warnings.warn('Upgrading NumPy should decrease memory usage and increase speed.', Warning, stacklevel=2) size = self.flat_costs.shape[0] self.flat_cumulative_costs = np.empty(size, dtype=FLOAT_D) self.dim = len(costs.shape) diff --git a/skimage/measure/_ccomp.pyx b/skimage/measure/_ccomp.pyx index 90c921cc..0da764fb 100644 --- a/skimage/measure/_ccomp.pyx +++ b/skimage/measure/_ccomp.pyx @@ -49,7 +49,7 @@ cdef void get_bginfo(background_val, bginfo *ret) except *: if background_val is None: warnings.warn(DeprecationWarning( 'The default value for `background` will change to 0 in v0.12' - )) + ), stacklevel=2) ret.background_val = -1 else: ret.background_val = background_val