[issue39079] help() modifies the string module

2019-12-17 Thread Zachary Ware
Zachary Ware added the comment: Since this has been this way for 22 years without a previous report that I can find, +1 to closing as "won't fix"/"not a bug" and so doing. However, I'm also adding the 2.7 release manager to make sure he knows about it and can reopen if he wants. --

[issue39079] help() modifies the string module

2019-12-17 Thread Zectbumo
Zectbumo added the comment: @eric.smith It actually caused a problem and then turned into a curiosity. At the beginning I wanted to remind myself about the string module so I did a help(string). Then right after that I wrote a program that generated filenames from string.letters. I closed th

[issue39079] help() modifies the string module

2019-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: There's no reasonable way I can see to fix this. The reassignment of those string attributes is clearly intentional (it's even documented) and there's probably code somewhere that relies on it. I think the best we can do is close as "won't fix" though "not a

[issue39079] help() modifies the string module

2019-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: For completeness, here's the path leading to the reassignment (after hacking in a raise to the appropriate place in _localemodule.c). It's a side-effect of calling `locale.getpreferredencoding`. >>> help(int) Traceback (most recent call last): File "", lin

[issue39079] help() modifies the string module

2019-12-17 Thread Eric V. Smith
Eric V. Smith added the comment: @Zectbumo: is this causing you any practical problem? Or is it just a curiosity? -- ___ Python tracker ___ ___

[issue39079] help() modifies the string module

2019-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: > But given that there's only 2 weeks of support left for 2.7, I don't see this > getting changed. Agreed: I can't reproduce on Python 3, and it looks as though the offending code is gone from the codebase in Python 3, so this is pretty much just a historic

[issue39079] help() modifies the string module

2019-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: Here's where `string.letters` is reassigned: https://github.com/python/cpython/blob/5f2c1345a79f205c680ed6e0a6ed44199546d79e/Modules/_localemodule.c#L136-L147 That code looks like it's exercised whenever setlocale is (or possibly just when LC_CTYPE is change

[issue39079] help() modifies the string module

2019-12-17 Thread Eric V. Smith
Eric V. Smith added the comment: With 2.7.16 on cygwin, I get: >>> import string >>> string.letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> help(int) >>> string.letters 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' But given that there's only 2 weeks of support lef

[issue39079] help() modifies the string module

2019-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: I *can* reproduce, on macOS 10.14.6, Python 2.7.17 (from macports). Python 2.7.17 (default, Oct 20 2019, 14:46:50) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>

[issue39079] help() modifies the string module

2019-12-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: I am unable to reproduce this. Can you double check that this occurs in the plain Python interpreter or IDLE, and provide a minimum reproducible example? (No third-party IDEs or interpreters, such as Jupyter.) These guidelines may help: https://en.wikiped

[issue39079] help() modifies the string module

2019-12-17 Thread Alfred Morgan
New submission from Alfred Morgan : import string a = string.letters help(int) b = string.letters a == b # False -- components: Library (Lib) messages: 358564 nosy: Zectbumo priority: normal severity: normal status: open title: help() modifies the string module versions: Python 2.7 ___