Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environ and environb #255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

abadger
Copy link

@abadger abadger commented Sep 14, 2018

Add six.environ and six.environb.

@abadger abadger force-pushed the text-environ branch 3 times, most recently from 74ba4a0 to e71482e Compare September 14, 2018 14:29
six.py Outdated Show resolved Hide resolved
@abadger
Copy link
Author

abadger commented Nov 14, 2018

Okay, I've fixed compatibility with Python-2.5 (where we have to use DictMixin because MutableMapping is unavailable) and Python-3.0 and Python-3.1 where we do not have os.environb.

I didn't choose to fix the latter by implementing os.environb. Rather, I chose to fix them by implementing os.supports_bytes_environ. os.supports_bytes_environ is a boolean that defines whether python has an environb on this platform. Currently in the stdlib version, it is False on Windows (os.name != 'nt') and True otherwise. portable software relying on os.environb should be using that to be sure that environb exists on their platform.

The fix extends that concept slightly so that on Python-3.0 and Python-3.1 six.supports_bytes_environ is False, marking it as unavailable no matter the operating system when running on either of those two Python versions.

Note that os.environb could be implemented, similar to how _TextEnviron was implemented, but I wasn't sure if that was desired or even useful so I held off on taking that leap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants