Skip to content

Commit ad77f04

Browse files
committed
pythongh-115398: Suggest use of hasattr with checking for 3.13 Expat API availability (pythonGH-116278)
Suggest use of "hasattr" with checking for 3.13 Expat API availability (cherry picked from commit 73807eb)
1 parent 1110d3e commit ad77f04

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Doc/library/pyexpat.rst

Lines changed: 5 additions & 0 deletions
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.8.19
221226

222227
.. method:: xmlparser.GetReparseDeferralEnabled()

Doc/library/xml.etree.elementtree.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,11 @@ XMLParser Objects
13671367
Disabling reparse deferral has security consequences; please see
13681368
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
13691369

1370+
Note that :meth:`flush` has been backported to some prior releases of
1371+
CPython as a security fix. Check for availability of :meth:`flush`
1372+
using :func:`hasattr` if used in code running across a variety of Python
1373+
versions.
1374+
13701375
.. versionadded:: 3.8.19
13711376

13721377

@@ -1440,6 +1445,11 @@ XMLPullParser Objects
14401445
Disabling reparse deferral has security consequences; please see
14411446
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
14421447

1448+
Note that :meth:`flush` has been backported to some prior releases of
1449+
CPython as a security fix. Check for availability of :meth:`flush`
1450+
using :func:`hasattr` if used in code running across a variety of Python
1451+
versions.
1452+
14431453
.. versionadded:: 3.8.19
14441454

14451455
.. method:: close()

0 commit comments

Comments
 (0)