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

Fix stub compat with older pyyaml versions that may unwittingly load it #480

Merged
merged 1 commit into from Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/_yaml/__init__.py
Expand Up @@ -5,7 +5,9 @@
# close enough for anyone who's relying on it even when they shouldn't.
import yaml

if not yaml.__with_libyaml__:
# in some circumstances, the yaml module we imoprted may be from a different version, so we need
# to tread carefully when poking at it here (it may not have the attributes we expect)
if not getattr(yaml, '__with_libyaml__', False):
from sys import version_info

exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
Expand Down
4 changes: 3 additions & 1 deletion lib3/_yaml/__init__.py
Expand Up @@ -5,7 +5,9 @@
# close enough for anyone who's relying on it even when they shouldn't.
import yaml

if not yaml.__with_libyaml__:
# in some circumstances, the yaml module we imoprted may be from a different version, so we need
# to tread carefully when poking at it here (it may not have the attributes we expect)
if not getattr(yaml, '__with_libyaml__', False):
from sys import version_info

exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
Expand Down