[Python-checkins] bpo-33549: Remove shim and deprecation warning to access DocumentLS.async. (GH-6924) (GH-6929)

Serhiy Storchaka webhook-mailer at python.org
Thu May 17 05:01:05 EDT 2018


https://github.com/python/cpython/commit/216a27766fab59f4dfecfae0c453f7f3fd478989
commit: 216a27766fab59f4dfecfae0c453f7f3fd478989
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018年05月17日T12:01:02+03:00
summary:
bpo-33549: Remove shim and deprecation warning to access DocumentLS.async. (GH-6924) (GH-6929)
`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 at gmail.com>
files:
M Lib/test/test_minidom.py
M Lib/xml/dom/xmlbuilder.py
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index ee8c04160ab7..a2cc8828461d 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -60,17 +60,7 @@ def checkWholeText(self, node, s):
 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:
diff --git a/Lib/xml/dom/xmlbuilder.py b/Lib/xml/dom/xmlbuilder.py
index 60a2bc36e3c2..213ab14551c6 100644
--- a/Lib/xml/dom/xmlbuilder.py
+++ b/Lib/xml/dom/xmlbuilder.py
@@ -332,29 +332,10 @@ def startContainer(self, element):
 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 @@ def saveXML(self, snode):
 return snode.toxml()
 
 
-del _AsyncDeprecatedProperty
-
-
 class DOMImplementationLS:
 MODE_SYNCHRONOUS = 1
 MODE_ASYNCHRONOUS = 2


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /