Skip to content

Commit b9e9e22

Browse files
committed
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 (cherry picked from commit 73807eb)
1 parent 05e809a commit b9e9e22

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.11.9
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
@@ -1393,6 +1393,11 @@ XMLParser Objects
13931393
Disabling reparse deferral has security consequences; please see
13941394
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
13951395

1396+
Note that :meth:`flush` has been backported to some prior releases of
1397+
CPython as a security fix. Check for availability of :meth:`flush`
1398+
using :func:`hasattr` if used in code running across a variety of Python
1399+
versions.
1400+
13961401
.. versionadded:: 3.11.9
13971402

13981403

@@ -1466,6 +1471,11 @@ XMLPullParser Objects
14661471
Disabling reparse deferral has security consequences; please see
14671472
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
14681473

1474+
Note that :meth:`flush` has been backported to some prior releases of
1475+
CPython as a security fix. Check for availability of :meth:`flush`
1476+
using :func:`hasattr` if used in code running across a variety of Python
1477+
versions.
1478+
14691479
.. versionadded:: 3.11.9
14701480

14711481
.. method:: close()

0 commit comments

Comments
 (0)