Skip to content

Commit

Permalink
Only use yaml CLoader if it is available
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 9, 2020
1 parent b64dc88 commit 30d6426
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/lsst/sphgeom/_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@
from .q3cPixelization import Q3cPixelization
from .mq3cPixelization import Mq3cPixelization

YamlLoaders = (yaml.Loader, yaml.CLoader, yaml.FullLoader, yaml.SafeLoader, yaml.UnsafeLoader)
try:
# CLoader is not always available
from yaml import CLoader
except ModuleNotFoundError:
CLoader = None

YamlLoaders = (yaml.Loader, yaml.FullLoader, yaml.SafeLoader, yaml.UnsafeLoader)
if CLoader is not None:
YamlLoaders += (CLoader,)


# Regions
Expand Down

0 comments on commit 30d6426

Please sign in to comment.