# HG changeset patch # User Ludovic Chabant # Date 1435626751 25200 # Node ID 1359b2b0cc73f52d8c663902a42907ddee150131 # Parent 6b9f59b19db7d8a51b6185f876806aaedf39532f performance: Use the fast YAML loader if available. diff -r 6b9f59b19db7 -r 1359b2b0cc73 piecrust/configuration.py --- a/piecrust/configuration.py Sun Jun 28 15:00:23 2015 -0700 +++ b/piecrust/configuration.py Mon Jun 29 18:12:31 2015 -0700 @@ -3,6 +3,10 @@ import collections.abc import yaml from yaml.constructor import ConstructorError +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader logger = logging.getLogger(__name__) @@ -166,7 +170,7 @@ return config, offset -class ConfigurationLoader(yaml.SafeLoader): +class ConfigurationLoader(SafeLoader): """ A YAML loader that loads mappings into ordered dictionaries. """ def __init__(self, *args, **kwargs):