mirror of
https://github.com/yaml/pyyaml.git
synced 2025-10-19 19:13:19 +00:00
Fix stub compat with older pyyaml versions that may unwittingly load it
This commit is contained in:
parent
58d0cb7ee0
commit
2b37f155d4
2 changed files with 6 additions and 2 deletions
|
@ -5,7 +5,9 @@
|
||||||
# close enough for anyone who's relying on it even when they shouldn't.
|
# close enough for anyone who's relying on it even when they shouldn't.
|
||||||
import yaml
|
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
|
from sys import version_info
|
||||||
|
|
||||||
exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
|
exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
# close enough for anyone who's relying on it even when they shouldn't.
|
# close enough for anyone who's relying on it even when they shouldn't.
|
||||||
import yaml
|
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
|
from sys import version_info
|
||||||
|
|
||||||
exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
|
exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue