diff --git a/lib/yaml/representer.py b/lib/yaml/representer.py index 3b0b192e..808ca06d 100644 --- a/lib/yaml/representer.py +++ b/lib/yaml/representer.py @@ -369,7 +369,7 @@ def represent_ordered_dict(self, data): Representer.add_representer(tuple, Representer.represent_tuple) -Representer.add_representer(type, +Representer.add_multi_representer(type, Representer.represent_name) Representer.add_representer(collections.OrderedDict, diff --git a/tests/data/construct-python-name-module.code b/tests/data/construct-python-name-module.code index 6f391488..b8a4b6f8 100644 --- a/tests/data/construct-python-name-module.code +++ b/tests/data/construct-python-name-module.code @@ -1 +1 @@ -[str, yaml.Loader, yaml.dump, abs, yaml.tokens] +[str, yaml.Loader, yaml.dump, abs, yaml.tokens, signal.Handlers] diff --git a/tests/data/construct-python-name-module.data b/tests/data/construct-python-name-module.data index f0c9712b..f1a2c24a 100644 --- a/tests/data/construct-python-name-module.data +++ b/tests/data/construct-python-name-module.data @@ -3,3 +3,4 @@ - !!python/name:yaml.dump - !!python/name:abs - !!python/module:yaml.tokens +- !!python/name:signal.Handlers diff --git a/tests/lib/test_constructor.py b/tests/lib/test_constructor.py index f9a50770..28987d29 100644 --- a/tests/lib/test_constructor.py +++ b/tests/lib/test_constructor.py @@ -5,6 +5,9 @@ import datetime import yaml.tokens +# Import any packages here that need to be referenced in .code files. +import signal + def execute(code): global value exec(code)