Skip to content

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
@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.

2 participants