Skip to content

Commit f90f5d5

Browse files
Carreauserhiy-storchaka
authored andcommitted
bpo-33549: Remove shim and deprecation warning to access DocumentLS.async. (GH-6924)
`obj.async` is now a syntax error, so the warning/shim is quasi-unnecessary.
1 parent d5f1442 commit f90f5d5

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

Lib/test/test_minidom.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,7 @@ def checkWholeText(self, node, s):
6060
def testDocumentAsyncAttr(self):
6161
doc = Document()
6262
self.assertFalse(doc.async_)
63-
with self.assertWarns(DeprecationWarning):
64-
self.assertFalse(getattr(doc, 'async', True))
65-
with self.assertWarns(DeprecationWarning):
66-
setattr(doc, 'async', True)
67-
with self.assertWarns(DeprecationWarning):
68-
self.assertTrue(getattr(doc, 'async', False))
69-
self.assertTrue(doc.async_)
70-
7163
self.assertFalse(Document.async_)
72-
with self.assertWarns(DeprecationWarning):
73-
self.assertFalse(getattr(Document, 'async', True))
7464

7565
def testParseFromBinaryFile(self):
7666
with open(tstfile, 'rb') as file:

Lib/xml/dom/xmlbuilder.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -332,29 +332,10 @@ def startContainer(self, element):
332332
del NodeFilter
333333

334334

335-
class _AsyncDeprecatedProperty:
336-
def warn(self, cls):
337-
clsname = cls.__name__
338-
warnings.warn(
339-
"{cls}.async is deprecated; use {cls}.async_".format(cls=clsname),
340-
DeprecationWarning)
341-
342-
def __get__(self, instance, cls):
343-
self.warn(cls)
344-
if instance is not None:
345-
return instance.async_
346-
return False
347-
348-
def __set__(self, instance, value):
349-
self.warn(type(instance))
350-
setattr(instance, 'async_', value)
351-
352-
353335
class DocumentLS:
354336
"""Mixin to create documents that conform to the load/save spec."""
355337

356338
async_ = False
357-
locals()['async'] = _AsyncDeprecatedProperty() # Avoid DeprecationWarning
358339

359340
def _get_async(self):
360341
return False
@@ -384,9 +365,6 @@ def saveXML(self, snode):
384365
return snode.toxml()
385366

386367

387-
del _AsyncDeprecatedProperty
388-
389-
390368
class DOMImplementationLS:
391369
MODE_SYNCHRONOUS = 1
392370
MODE_ASYNCHRONOUS = 2

0 commit comments

Comments
 (0)