New submission from Serhiy Storchaka:

$ ./python -Wa Lib/imp.py
sys:1: PendingDeprecationWarning: the imp module is deprecated in favour of 
importlib; see the module's documentation for alternative uses

"sys:1:" is output when the stacklevel argument is larger then the deep of the 
stack.

Following patch stops raising just below the surface.

$ ./python -Wa Lib/imp.py
Lib/imp.py:33: PendingDeprecationWarning: the imp module is deprecated in 
favour of importlib; see the module's documentation for alternative uses
  PendingDeprecationWarning, stacklevel=2)

However I'm not sure that the current behavior is incorrect.

----------
components: Extension Modules, Library (Lib)
files: warnings_surface.patch
keywords: patch
messages: 251247
nosy: brett.cannon, eric.snow, haypo, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Confusing (?) warning when run deprecated module as script
Added file: http://bugs.python.org/file40536/warnings_surface.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25204>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to