]> granicus.if.org Git - python/commitdiff
bpo-33549: Remove shim and deprecation warning to access DocumentLS.async. (GH-6924...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 17 May 2018 09:01:02 +0000 (02:01 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 17 May 2018 09:01:02 +0000 (12:01 +0300)
`obj.async` is now a syntax error, so the warning/shim is
quasi-unnecessary.
(cherry picked from commit f90f5d5c1d95721e0ca0b1c302e3d13ed34753a8)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Lib/test/test_minidom.py
Lib/xml/dom/xmlbuilder.py

index ee8c04160ab706539da45d8545c78d041fc73988..a2cc8828461d3e95eeff7c2e4ce57a69b763c5d1 100644 (file)
@@ -60,17 +60,7 @@ class MinidomTest(unittest.TestCase):
     def testDocumentAsyncAttr(self):
         doc = Document()
         self.assertFalse(doc.async_)
-        with self.assertWarns(DeprecationWarning):
-            self.assertFalse(getattr(doc, 'async', True))
-        with self.assertWarns(DeprecationWarning):
-            setattr(doc, 'async', True)
-        with self.assertWarns(DeprecationWarning):
-            self.assertTrue(getattr(doc, 'async', False))
-        self.assertTrue(doc.async_)
-
         self.assertFalse(Document.async_)
-        with self.assertWarns(DeprecationWarning):
-            self.assertFalse(getattr(Document, 'async', True))
 
     def testParseFromBinaryFile(self):
         with open(tstfile, 'rb') as file:
index 60a2bc36e3c2b5f645c514fd1e9d68d76bf7c62e..213ab14551c67ec11a08a98793c984eb6b732bfb 100644 (file)
@@ -332,29 +332,10 @@ class DOMBuilderFilter:
 del NodeFilter
 
 
-class _AsyncDeprecatedProperty:
-    def warn(self, cls):
-        clsname = cls.__name__
-        warnings.warn(
-            "{cls}.async is deprecated; use {cls}.async_".format(cls=clsname),
-            DeprecationWarning)
-
-    def __get__(self, instance, cls):
-        self.warn(cls)
-        if instance is not None:
-            return instance.async_
-        return False
-
-    def __set__(self, instance, value):
-        self.warn(type(instance))
-        setattr(instance, 'async_', value)
-
-
 class DocumentLS:
     """Mixin to create documents that conform to the load/save spec."""
 
     async_ = False
-    locals()['async'] = _AsyncDeprecatedProperty()  # Avoid DeprecationWarning
 
     def _get_async(self):
         return False
@@ -384,9 +365,6 @@ class DocumentLS:
         return snode.toxml()
 
 
-del _AsyncDeprecatedProperty
-
-
 class DOMImplementationLS:
     MODE_SYNCHRONOUS = 1
     MODE_ASYNCHRONOUS = 2