Scale back warnings.warn and add stacklevels= where appropriate.
[python_utils.git] / persistent.py
index 2751572553ac7c20c7663974c13e17b13f0ab037..83e6900cc18471ae44503a14f3184a2827420190 100644 (file)
@@ -146,7 +146,7 @@ class persistent_autoloaded_singleton(object):
             if not self.instance:
                 msg = 'Loading from cache failed.'
                 logger.warning(msg)
-                warnings.warn(msg)
+                warnings.warn(msg, stacklevel=2)
                 logger.debug(f'Attempting to instantiate {cls.__name__} directly.')
                 self.instance = cls(*args, **kwargs)
             else: