Skip to content

Commit 34e764f

Browse files
Thom1729ingydotnet
authored andcommitted
Fix issue with representing Enum types
1 parent 56644b3 commit 34e764f

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

lib/yaml/representer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def represent_ordered_dict(self, data):
369369
Representer.add_representer(tuple,
370370
Representer.represent_tuple)
371371

372-
Representer.add_representer(type,
372+
Representer.add_multi_representer(type,
373373
Representer.represent_name)
374374

375375
Representer.add_representer(collections.OrderedDict,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[str, yaml.Loader, yaml.dump, abs, yaml.tokens]
1+
[str, yaml.Loader, yaml.dump, abs, yaml.tokens, signal.Handlers]

tests/data/construct-python-name-module.data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
- !!python/name:yaml.dump
44
- !!python/name:abs
55
- !!python/module:yaml.tokens
6+
- !!python/name:signal.Handlers

tests/lib/test_constructor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import datetime
66
import yaml.tokens
77

8+
# Import any packages here that need to be referenced in .code files.
9+
import signal
10+
811
def execute(code):
912
global value
1013
exec(code)

0 commit comments

Comments
 (0)