Skip to content

Commit

Permalink
Fix issue with representing Enum types
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom1729 authored and ingydotnet committed Sep 23, 2021
1 parent 141afdd commit 961ce9d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/yaml/representer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/construct-python-name-module.code
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[str, yaml.Loader, yaml.dump, abs, yaml.tokens]
[str, yaml.Loader, yaml.dump, abs, yaml.tokens, signal.Handlers]
1 change: 1 addition & 0 deletions tests/data/construct-python-name-module.data
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- !!python/name:yaml.dump
- !!python/name:abs
- !!python/module:yaml.tokens
- !!python/name:signal.Handlers
3 changes: 3 additions & 0 deletions tests/lib/test_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 961ce9d

Please sign in to comment.