Skip to content

Commit 8c5e47f

Browse files
committed
Move constructor for object/apply to Unsafe
1 parent 4a31b16 commit 8c5e47f

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

lib/yaml/constructor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,6 @@ def construct_python_object_new(self, suffix, node):
683683
u'tag:yaml.org,2002:python/object:',
684684
FullConstructor.construct_python_object)
685685

686-
FullConstructor.add_multi_constructor(
687-
u'tag:yaml.org,2002:python/object/apply:',
688-
FullConstructor.construct_python_object_apply)
689-
690686
FullConstructor.add_multi_constructor(
691687
u'tag:yaml.org,2002:python/object/new:',
692688
FullConstructor.construct_python_object_new)
@@ -703,6 +699,10 @@ def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False)
703699
return super(UnsafeConstructor, self).make_python_instance(
704700
suffix, node, args, kwds, newobj, unsafe=True)
705701

702+
UnsafeConstructor.add_multi_constructor(
703+
u'tag:yaml.org,2002:python/object/apply:',
704+
UnsafeConstructor.construct_python_object_apply)
705+
706706
# Constructor is same as UnsafeConstructor. Need to leave this in place in case
707707
# people have extended it directly.
708708
class Constructor(UnsafeConstructor):

lib3/yaml/constructor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,10 +694,6 @@ def construct_python_object_new(self, suffix, node):
694694
'tag:yaml.org,2002:python/object:',
695695
FullConstructor.construct_python_object)
696696

697-
FullConstructor.add_multi_constructor(
698-
'tag:yaml.org,2002:python/object/apply:',
699-
FullConstructor.construct_python_object_apply)
700-
701697
FullConstructor.add_multi_constructor(
702698
'tag:yaml.org,2002:python/object/new:',
703699
FullConstructor.construct_python_object_new)
@@ -714,6 +710,10 @@ def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False)
714710
return super(UnsafeConstructor, self).make_python_instance(
715711
suffix, node, args, kwds, newobj, unsafe=True)
716712

713+
UnsafeConstructor.add_multi_constructor(
714+
'tag:yaml.org,2002:python/object/apply:',
715+
UnsafeConstructor.construct_python_object_apply)
716+
717717
# Constructor is same as UnsafeConstructor. Need to leave this in place in case
718718
# people have extended it directly.
719719
class Constructor(UnsafeConstructor):

0 commit comments

Comments
 (0)