[issue28824] os.environ should preserve the case of the OS keys ?

2022-03-02 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg414332 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue28824] os.environ should preserve the case of the OS keys ?

2022-03-02 Thread Eryk Sun
Eryk Sun added the comment: Putting words into action, here's an example of what a privileged process (e.g. running as SYSTEM) can do if a script or application is written to call the undocumented NT API function NtMakePermanentObject(). A use case would be a script running as a system

[issue28824] os.environ should preserve the case of the OS keys ?

2022-02-26 Thread Eryk Sun
Eryk Sun added the comment: > I think there should be a public class like this. I wrote a basic implementation of _CaseInsensitiveString under the assumption that it's hidden behind the __getitem__(), __setitem__(), and __delitem__() methods of the _Environ class. I don't want to complicate

[issue28824] os.environ should preserve the case of the OS keys ?

2022-02-26 Thread benrg
benrg added the comment: This issue should be marked dependent on issue 43702 or issue 46862, since fixing it could break third-party code unless they're fixed first. > Given 'nt.environ' is available without case remapping, I think that's the > best workaround. Right now, it's not a good

[issue28824] os.environ should preserve the case of the OS keys ?

2022-02-26 Thread Larry Hastings
Change by Larry Hastings : -- nosy: -larry, loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28824] os.environ should preserve the case of the OS keys ?

2022-02-25 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.11 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28824] os.environ should preserve the case of the OS keys ?

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: In Windows, maybe the os.environ mapping could use a case-insensitive subclass of str for its keys, such as the following: @total_ordering class _CaseInsensitiveString(str): def __eq__(self, other): if not isinstance(other, str):

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread Steve Dower
Steve Dower added the comment: Ah, I see what you mean. In this case, we could change how the case-insensitivity is handled here, but it would only be applicable to 3.7. I'm not opposed to changing the default behavior here, but it does kind of bring up the mapping dict discussion again. If

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread tzickel
tzickel added the comment: Steve, I've checked in Python 3.5.2, and os.environ.keys() still uppercases everything when scanning (for my use case). Has it changed since then ? -- ___ Python tracker

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread Eryk Sun
Eryk Sun added the comment: I've come across a few problems when passing a modified os.environ.copy() to a child process via subprocess.Popen. Ideally it shouldn't be an issue, as long as the OS or C runtime functions are used, but some troublesome programs do their own case-sensitive search

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread tzickel
tzickel added the comment: My issue is that somebody wants to pass a few dict like environment variables as some prefix_key=value but he wants to preserve the case of the key for usage in python so the .keys() space needs to be enumerated. A workaround for this issue can be importing nt and

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread Steve Dower
Steve Dower added the comment: This works fine in Python 3, and also Python 2.7 *unless* you call .keys(). PS D:\> py -2.7 Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread R. David Murray
R. David Murray added the comment: That unfortunately would probably break existing code. It does seem reasonable that case should be ignored on get, though, if the OS does so. So making your 'in' statement work might be acceptable, backward compatibility wise. Probably only in 3.7,

[issue28824] os.environ should preserve the case of the OS keys ?

2016-11-28 Thread tzickel
New submission from tzickel: In Windows, python's os.environ currently handles the case sensitivity different that the OS. While it's true that the OS is case insensitive, it does preserve the case that you first set it as. For example: C:\Users\user>set aSD=Blah C:\Users\user>set asd