Hello community,

here is the log from the commit of package python-PyYAML for openSUSE:Factory 
checked in at 2020-03-27 00:27:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-PyYAML (Old)
 and      /work/SRC/openSUSE:Factory/.python-PyYAML.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-PyYAML"

Fri Mar 27 00:27:04 2020 rev:23 rq:786325 version:5.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-PyYAML/python-PyYAML.changes      
2020-01-16 18:13:49.372723050 +0100
+++ /work/SRC/openSUSE:Factory/.python-PyYAML.new.3160/python-PyYAML.changes    
2020-03-27 00:27:05.720311448 +0100
@@ -1,0 +2,7 @@
+Thu Mar 19 07:23:23 UTC 2020 - Ondřej Súkup <mimi...@gmail.com>
+
+- update to 5.3.1
+ * fixes boo#1165439 (cve-2020-1747) Prevents arbitrary code execution
+   during python/object/new constructor
+
+-------------------------------------------------------------------

Old:
----
  PyYAML-5.3.tar.gz

New:
----
  PyYAML-5.3.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-PyYAML.spec ++++++
--- /var/tmp/diff_new_pack.2JsUtM/_old  2020-03-27 00:27:06.544311865 +0100
+++ /var/tmp/diff_new_pack.2JsUtM/_new  2020-03-27 00:27:06.548311867 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define oldpython python
 Name:           python-PyYAML
-Version:        5.3
+Version:        5.3.1
 Release:        0
 Summary:        YAML parser and emitter for Python
 License:        MIT

++++++ PyYAML-5.3.tar.gz -> PyYAML-5.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/CHANGES new/PyYAML-5.3.1/CHANGES
--- old/PyYAML-5.3/CHANGES      2020-01-06 20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/CHANGES    2020-03-18 22:34:29.000000000 +0100
@@ -4,6 +4,10 @@
 * https://github.com/yaml/pyyaml/commits/
 * https://bitbucket.org/xi/pyyaml/commits/
 
+5.3.1 (2020-03-18)
+
+* https://github.com/yaml/pyyaml/pull/386 -- Prevents arbitrary code execution 
during python/object/new constructor
+
 5.3 (2020-01-06)
 
 * https://github.com/yaml/pyyaml/pull/290 -- Use `is` instead of equality for 
comparing with `None`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/LICENSE new/PyYAML-5.3.1/LICENSE
--- old/PyYAML-5.3/LICENSE      2020-01-06 20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/LICENSE    2020-03-18 22:34:29.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2017-2019 Ingy döt Net
+Copyright (c) 2017-2020 Ingy döt Net
 Copyright (c) 2006-2016 Kirill Simonov
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/PKG-INFO new/PyYAML-5.3.1/PKG-INFO
--- old/PyYAML-5.3/PKG-INFO     2020-01-06 21:00:32.000000000 +0100
+++ new/PyYAML-5.3.1/PKG-INFO   2020-03-18 22:35:49.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: PyYAML
-Version: 5.3
+Version: 5.3.1
 Summary: YAML parser and emitter for Python
 Home-page: https://github.com/yaml/pyyaml
 Author: Kirill Simonov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/ext/_yaml.c new/PyYAML-5.3.1/ext/_yaml.c
--- old/PyYAML-5.3/ext/_yaml.c  2020-01-06 21:00:32.000000000 +0100
+++ new/PyYAML-5.3.1/ext/_yaml.c        2020-03-18 22:35:49.000000000 +0100
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.29.14 */
+/* Generated by Cython 0.29.15 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -7,8 +7,8 @@
 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && 
PY_VERSION_HEX < 0x03030000)
     #error Cython requires Python 2.6+ or Python 3.3+.
 #else
-#define CYTHON_ABI "0_29_14"
-#define CYTHON_HEX_VERSION 0x001D0EF0
+#define CYTHON_ABI "0_29_15"
+#define CYTHON_HEX_VERSION 0x001D0FF0
 #define CYTHON_FUTURE_DIVISION 0
 #include <stddef.h>
 #ifndef offsetof
@@ -27443,43 +27443,43 @@
     PyObject *setstate = NULL;
     PyObject *setstate_cython = NULL;
 #if CYTHON_USE_PYTYPE_LOOKUP
-    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
+    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto 
__PYX_GOOD;
 #else
-    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
+    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
 #endif
 #if CYTHON_USE_PYTYPE_LOOKUP
-    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, 
__pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
+    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, 
__pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
 #else
-    object_reduce_ex = 
__Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); 
if (!object_reduce_ex) goto BAD;
+    object_reduce_ex = 
__Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); 
if (!object_reduce_ex) goto __PYX_BAD;
 #endif
-    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if 
(unlikely(!reduce_ex)) goto BAD;
+    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if 
(unlikely(!reduce_ex)) goto __PYX_BAD;
     if (reduce_ex == object_reduce_ex) {
 #if CYTHON_USE_PYTYPE_LOOKUP
-        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); 
if (!object_reduce) goto BAD;
+        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); 
if (!object_reduce) goto __PYX_BAD;
 #else
-        object_reduce = 
__Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if 
(!object_reduce) goto BAD;
+        object_reduce = 
__Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if 
(!object_reduce) goto __PYX_BAD;
 #endif
-        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if 
(unlikely(!reduce)) goto BAD;
+        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if 
(unlikely(!reduce)) goto __PYX_BAD;
         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, 
__pyx_n_s_reduce_cython)) {
-            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, 
__pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
-            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
-            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
+            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, 
__pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
+            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
             if (!setstate) PyErr_Clear();
             if (!setstate || __Pyx_setup_reduce_is_named(setstate, 
__pyx_n_s_setstate_cython)) {
-                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, 
__pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
-                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
-                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
+                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, 
__pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
+                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, 
__pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
             }
             PyType_Modified((PyTypeObject*)type_obj);
         }
     }
-    goto GOOD;
-BAD:
+    goto __PYX_GOOD;
+__PYX_BAD:
     if (!PyErr_Occurred())
         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for 
%s", ((PyTypeObject*)type_obj)->tp_name);
     ret = -1;
-GOOD:
+__PYX_GOOD:
 #if !CYTHON_USE_PYTYPE_LOOKUP
     Py_XDECREF(object_reduce);
     Py_XDECREF(object_reduce_ex);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/lib/yaml/__init__.py 
new/PyYAML-5.3.1/lib/yaml/__init__.py
--- old/PyYAML-5.3/lib/yaml/__init__.py 2020-01-06 20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/lib/yaml/__init__.py       2020-03-18 22:34:29.000000000 
+0100
@@ -8,7 +8,7 @@
 from loader import *
 from dumper import *
 
-__version__ = '5.3'
+__version__ = '5.3.1'
 
 try:
     from cyaml import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/lib/yaml/constructor.py 
new/PyYAML-5.3.1/lib/yaml/constructor.py
--- old/PyYAML-5.3/lib/yaml/constructor.py      2020-01-06 20:58:55.000000000 
+0100
+++ new/PyYAML-5.3.1/lib/yaml/constructor.py    2020-03-18 22:34:29.000000000 
+0100
@@ -56,6 +56,14 @@
         # If there are more documents available?
         return self.check_node()
 
+    def check_state_key(self, key):
+        """Block special attributes/methods from being set in a newly created
+        object, to prevent user-controlled methods from being called during
+        deserialization"""
+        if self.get_state_keys_blacklist_regexp().match(key):
+            raise ConstructorError(None, None,
+                "blacklisted key '%s' in instance state found" % (key,), None)
+
     def get_data(self):
         # Construct and return the next document.
         if self.check_node():
@@ -495,6 +503,16 @@
         SafeConstructor.construct_undefined)
 
 class FullConstructor(SafeConstructor):
+    # 'extend' is blacklisted because it is used by
+    # construct_python_object_apply to add `listitems` to a newly generate
+    # python instance
+    def get_state_keys_blacklist(self):
+        return ['^extend$', '^__.*__$']
+
+    def get_state_keys_blacklist_regexp(self):
+        if not hasattr(self, 'state_keys_blacklist_regexp'):
+            self.state_keys_blacklist_regexp = re.compile('(' + 
'|'.join(self.get_state_keys_blacklist()) + ')')
+        return self.state_keys_blacklist_regexp
 
     def construct_python_str(self, node):
         return self.construct_scalar(node).encode('utf-8')
@@ -590,7 +608,7 @@
         else:
             return cls(*args, **kwds)
 
-    def set_python_instance_state(self, instance, state):
+    def set_python_instance_state(self, instance, state, unsafe=False):
         if hasattr(instance, '__setstate__'):
             instance.__setstate__(state)
         else:
@@ -598,10 +616,15 @@
             if isinstance(state, tuple) and len(state) == 2:
                 state, slotstate = state
             if hasattr(instance, '__dict__'):
+                if not unsafe and state:
+                    for key in state.keys():
+                        self.check_state_key(key)
                 instance.__dict__.update(state)
             elif state:
                 slotstate.update(state)
             for key, value in slotstate.items():
+                if not unsafe:
+                    self.check_state_key(key)
                 setattr(instance, key, value)
 
     def construct_python_object(self, suffix, node):
@@ -723,6 +746,10 @@
         return super(UnsafeConstructor, self).make_python_instance(
             suffix, node, args, kwds, newobj, unsafe=True)
 
+    def set_python_instance_state(self, instance, state):
+        return super(UnsafeConstructor, self).set_python_instance_state(
+            instance, state, unsafe=True)
+
 UnsafeConstructor.add_multi_constructor(
     u'tag:yaml.org,2002:python/object/apply:',
     UnsafeConstructor.construct_python_object_apply)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/lib3/yaml/__init__.py 
new/PyYAML-5.3.1/lib3/yaml/__init__.py
--- old/PyYAML-5.3/lib3/yaml/__init__.py        2020-01-06 20:58:55.000000000 
+0100
+++ new/PyYAML-5.3.1/lib3/yaml/__init__.py      2020-03-18 22:34:29.000000000 
+0100
@@ -8,7 +8,7 @@
 from .loader import *
 from .dumper import *
 
-__version__ = '5.3'
+__version__ = '5.3.1'
 try:
     from .cyaml import *
     __with_libyaml__ = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/lib3/yaml/constructor.py 
new/PyYAML-5.3.1/lib3/yaml/constructor.py
--- old/PyYAML-5.3/lib3/yaml/constructor.py     2020-01-06 20:58:55.000000000 
+0100
+++ new/PyYAML-5.3.1/lib3/yaml/constructor.py   2020-03-18 22:34:29.000000000 
+0100
@@ -31,6 +31,14 @@
         # If there are more documents available?
         return self.check_node()
 
+    def check_state_key(self, key):
+        """Block special attributes/methods from being set in a newly created
+        object, to prevent user-controlled methods from being called during
+        deserialization"""
+        if self.get_state_keys_blacklist_regexp().match(key):
+            raise ConstructorError(None, None,
+                "blacklisted key '%s' in instance state found" % (key,), None)
+
     def get_data(self):
         # Construct and return the next document.
         if self.check_node():
@@ -472,6 +480,16 @@
         SafeConstructor.construct_undefined)
 
 class FullConstructor(SafeConstructor):
+    # 'extend' is blacklisted because it is used by
+    # construct_python_object_apply to add `listitems` to a newly generate
+    # python instance
+    def get_state_keys_blacklist(self):
+        return ['^extend$', '^__.*__$']
+
+    def get_state_keys_blacklist_regexp(self):
+        if not hasattr(self, 'state_keys_blacklist_regexp'):
+            self.state_keys_blacklist_regexp = re.compile('(' + 
'|'.join(self.get_state_keys_blacklist()) + ')')
+        return self.state_keys_blacklist_regexp
 
     def construct_python_str(self, node):
         return self.construct_scalar(node)
@@ -574,7 +592,7 @@
         else:
             return cls(*args, **kwds)
 
-    def set_python_instance_state(self, instance, state):
+    def set_python_instance_state(self, instance, state, unsafe=False):
         if hasattr(instance, '__setstate__'):
             instance.__setstate__(state)
         else:
@@ -582,10 +600,15 @@
             if isinstance(state, tuple) and len(state) == 2:
                 state, slotstate = state
             if hasattr(instance, '__dict__'):
+                if not unsafe and state:
+                    for key in state.keys():
+                        self.check_state_key(key)
                 instance.__dict__.update(state)
             elif state:
                 slotstate.update(state)
             for key, value in slotstate.items():
+                if not unsafe:
+                    self.check_state_key(key)
                 setattr(instance, key, value)
 
     def construct_python_object(self, suffix, node):
@@ -711,6 +734,10 @@
         return super(UnsafeConstructor, self).make_python_instance(
             suffix, node, args, kwds, newobj, unsafe=True)
 
+    def set_python_instance_state(self, instance, state):
+        return super(UnsafeConstructor, self).set_python_instance_state(
+            instance, state, unsafe=True)
+
 UnsafeConstructor.add_multi_constructor(
     'tag:yaml.org,2002:python/object/apply:',
     UnsafeConstructor.construct_python_object_apply)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/setup.py new/PyYAML-5.3.1/setup.py
--- old/PyYAML-5.3/setup.py     2020-01-06 20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/setup.py   2020-03-18 22:34:29.000000000 +0100
@@ -1,6 +1,6 @@
 
 NAME = 'PyYAML'
-VERSION = '5.3'
+VERSION = '5.3.1'
 DESCRIPTION = "YAML parser and emitter for Python"
 LONG_DESCRIPTION = """\
 YAML is a data serialization format designed for human readability
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/PyYAML-5.3/tests/data/emitting-unacceptable-unicode-character-bug.code 
new/PyYAML-5.3.1/tests/data/emitting-unacceptable-unicode-character-bug.code
--- old/PyYAML-5.3/tests/data/emitting-unacceptable-unicode-character-bug.code  
1970-01-01 01:00:00.000000000 +0100
+++ 
new/PyYAML-5.3.1/tests/data/emitting-unacceptable-unicode-character-bug.code    
    2020-03-18 22:34:29.000000000 +0100
@@ -0,0 +1 @@
+u"\udd00"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/PyYAML-5.3/tests/data/emitting-unacceptable-unicode-character-bug.data 
new/PyYAML-5.3.1/tests/data/emitting-unacceptable-unicode-character-bug.data
--- old/PyYAML-5.3/tests/data/emitting-unacceptable-unicode-character-bug.data  
1970-01-01 01:00:00.000000000 +0100
+++ 
new/PyYAML-5.3.1/tests/data/emitting-unacceptable-unicode-character-bug.data    
    2020-03-18 22:34:29.000000000 +0100
@@ -0,0 +1 @@
+"\udd00"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/PyYAML-5.3/tests/data/myfullloader.subclass_blacklist 
new/PyYAML-5.3.1/tests/data/myfullloader.subclass_blacklist
--- old/PyYAML-5.3/tests/data/myfullloader.subclass_blacklist   1970-01-01 
01:00:00.000000000 +0100
+++ new/PyYAML-5.3.1/tests/data/myfullloader.subclass_blacklist 2020-03-18 
22:34:29.000000000 +0100
@@ -0,0 +1,5 @@
+- !!python/object/new:yaml.MappingNode
+  args:
+  state:
+    mymethod: test
+    wrong_method: test2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/PyYAML-5.3/tests/data/overwrite-state-new-constructor.loader-error 
new/PyYAML-5.3.1/tests/data/overwrite-state-new-constructor.loader-error
--- old/PyYAML-5.3/tests/data/overwrite-state-new-constructor.loader-error      
1970-01-01 01:00:00.000000000 +0100
+++ new/PyYAML-5.3.1/tests/data/overwrite-state-new-constructor.loader-error    
2020-03-18 22:34:29.000000000 +0100
@@ -0,0 +1,5 @@
+- !!python/object/new:yaml.MappingNode
+  args:
+  state:
+    extend: test
+    __test__: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/tests/lib/test_constructor.py 
new/PyYAML-5.3.1/tests/lib/test_constructor.py
--- old/PyYAML-5.3/tests/lib/test_constructor.py        2020-01-06 
20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/tests/lib/test_constructor.py      2020-03-18 
22:34:29.000000000 +0100
@@ -17,7 +17,7 @@
     global MyLoader, MyDumper, MyTestClass1, MyTestClass2, MyTestClass3, 
YAMLObject1, YAMLObject2,  \
             AnObject, AnInstance, AState, ACustomState, InitArgs, 
InitArgsWithState,    \
             NewArgs, NewArgsWithState, Reduce, ReduceWithState, Slots, MyInt, 
MyList, MyDict,  \
-            FixedOffset, today, execute
+            FixedOffset, today, execute, MyFullLoader
 
     class MyLoader(yaml.Loader):
         pass
@@ -235,6 +235,10 @@
         def dst(self, dt):
             return datetime.timedelta(0)
 
+    class MyFullLoader(yaml.FullLoader):
+        def get_state_keys_blacklist(self):
+            return super(MyFullLoader, self).get_state_keys_blacklist() + 
['^mymethod$', '^wrong_.*$']
+
     today = datetime.date.today()
 
 def _load_code(expression):
@@ -289,6 +293,18 @@
 
 test_constructor_types.unittest = ['.data', '.code']
 
+def test_subclass_blacklist_types(data_filename, verbose=False):
+    _make_objects()
+    try:
+        yaml.load(open(data_filename, 'rb').read(), MyFullLoader)
+    except yaml.YAMLError as exc:
+        if verbose:
+            print("%s:" % exc.__class__.__name__, exc)
+    else:
+        raise AssertionError("expected an exception")
+
+test_subclass_blacklist_types.unittest = ['.subclass_blacklist']
+
 if __name__ == '__main__':
     import sys, test_constructor
     sys.modules['test_constructor'] = sys.modules['__main__']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/PyYAML-5.3/tests/lib3/test_constructor.py 
new/PyYAML-5.3.1/tests/lib3/test_constructor.py
--- old/PyYAML-5.3/tests/lib3/test_constructor.py       2020-01-06 
20:58:55.000000000 +0100
+++ new/PyYAML-5.3.1/tests/lib3/test_constructor.py     2020-03-18 
22:34:29.000000000 +0100
@@ -14,7 +14,7 @@
     global MyLoader, MyDumper, MyTestClass1, MyTestClass2, MyTestClass3, 
YAMLObject1, YAMLObject2,  \
             AnObject, AnInstance, AState, ACustomState, InitArgs, 
InitArgsWithState,    \
             NewArgs, NewArgsWithState, Reduce, ReduceWithState, Slots, MyInt, 
MyList, MyDict,  \
-            FixedOffset, today, execute
+            FixedOffset, today, execute, MyFullLoader
 
     class MyLoader(yaml.Loader):
         pass
@@ -222,6 +222,10 @@
         def dst(self, dt):
             return datetime.timedelta(0)
 
+    class MyFullLoader(yaml.FullLoader):
+        def get_state_keys_blacklist(self):
+            return super().get_state_keys_blacklist() + ['^mymethod$', 
'^wrong_.*$']
+
     today = datetime.date.today()
 
 def _load_code(expression):
@@ -274,6 +278,18 @@
 
 test_constructor_types.unittest = ['.data', '.code']
 
+def test_subclass_blacklist_types(data_filename, verbose=False):
+    _make_objects()
+    try:
+        yaml.load(open(data_filename, 'rb').read(), MyFullLoader)
+    except yaml.YAMLError as exc:
+        if verbose:
+            print("%s:" % exc.__class__.__name__, exc)
+    else:
+        raise AssertionError("expected an exception")
+
+test_subclass_blacklist_types.unittest = ['.subclass_blacklist']
+
 if __name__ == '__main__':
     import sys, test_constructor
     sys.modules['test_constructor'] = sys.modules['__main__']


Reply via email to