[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-04-14 Thread Steve Dower
Changes by Steve Dower steve.do...@microsoft.com: -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23809 ___ ___

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-04-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: This is a fairly common newbie bug. random.py seems to be favorite name. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23809 ___

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Robert Collins
Robert Collins added the comment: Implementation wise: this is not part of the generic rendering-of-tracebacks; I'd like to make the traceback new stuff be tastefully extensible - I'd be inclined to do this with a per-frame-callback on render (so we don't pay overhead on unrendered tb's) and

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Nick Coghlan
New submission from Nick Coghlan: A colleague just ran into the issue where they created a json.py module in their local directory and broke a previously working program. I picked up on the mistake when I saw the following traceback snippet: Traceback (most recent call last): File

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Nick Coghlan
Nick Coghlan added the comment: I had an idea for a possible importlib.util API to support this capability: an ignore_entries=0 default arg to https://docs.python.org/dev/library/importlib.html#importlib.util.find_spec The new arg would say how many found entries to skip when looking for the

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Robert Collins
Robert Collins added the comment: Why limit this to just stdlib shadowing? A local module can shadow a top level module-or-package across the board. If we don't limit it to stdlib names, it becomes a lot easier to implement. -- ___ Python tracker

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Nick Coghlan
Nick Coghlan added the comment: On the implementation front, +1 for looking at a per-frame callback API rather than hardcoding this directly into the existing traceback rendering code. -- ___ Python tracker rep...@bugs.python.org

[issue23809] RFE: emit a warning when a module in a traceback shadows a stdlib module

2015-03-29 Thread Nick Coghlan
Nick Coghlan added the comment: I proposed limiting it to stdlib names as that's the case where we see the most beginner confusion (experimenting with sockets in a file named socket.py, etc), and the one where we can generate a comprehensive list of known module names ahead of time (so in