Skip to content

Commit 73807eb

Browse files
authored
gh-115398: Suggest use of hasattr with checking for 3.13 Expat API availability (GH-116278)
Suggest use of "hasattr" with checking for 3.13 Expat API availability
1 parent 8a8e920 commit 73807eb

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Doc/library/pyexpat.rst

+5
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ XMLParser Objects
217217
Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse
218218
deferral.
219219

220+
Note that :meth:`SetReparseDeferralEnabled` has been backported to some
221+
prior releases of CPython as a security fix. Check for availability of
222+
:meth:`SetReparseDeferralEnabled` using :func:`hasattr` if used in code
223+
running across a variety of Python versions.
224+
220225
.. versionadded:: 3.13
221226

222227
.. method:: xmlparser.GetReparseDeferralEnabled()

Doc/library/xml.etree.elementtree.rst

+10
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,11 @@ XMLParser Objects
14021402
Disabling reparse deferral has security consequences; please see
14031403
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
14041404

1405+
Note that :meth:`flush` has been backported to some prior releases of
1406+
CPython as a security fix. Check for availability of :meth:`flush`
1407+
using :func:`hasattr` if used in code running across a variety of Python
1408+
versions.
1409+
14051410
.. versionadded:: 3.13
14061411

14071412

@@ -1475,6 +1480,11 @@ XMLPullParser Objects
14751480
Disabling reparse deferral has security consequences; please see
14761481
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
14771482

1483+
Note that :meth:`flush` has been backported to some prior releases of
1484+
CPython as a security fix. Check for availability of :meth:`flush`
1485+
using :func:`hasattr` if used in code running across a variety of Python
1486+
versions.
1487+
14781488
.. versionadded:: 3.13
14791489

14801490
.. method:: close()

0 commit comments

Comments
 (0)