[issue24305] The new import system makes it impossible to correctly issue a deprecation warning for a module

Larry Hastings report at bugs.python.org
Tue Aug 25 02:32:07 CEST 2015


Larry Hastings added the comment:

Is it really *impossible* to "correctly issue a deprecation warning for a module", as the title asserts?  Or does the new import system simply make it *tiresome*?

if sys.version_info.major == 3 and sys.version_info.minor == 4:
  stacklevel = 8
elif  sys.version_info.major == 3 and sys.version_info.minor == 4:
  stacklevel = 10
else:
  stacklevel = 2 # I bet they fixed it in 3.6!

warnings.warn("{} is deprecated".format(__name__), DeprecationWarning,
              stacklevel=stacklevel)


That's Python for you, doing six "impossible" things before breakfast.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24305>
_______________________________________


More information about the Python-bugs-list mailing list