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
This commit is contained in:
Sebastian Pipping 2024-03-06 20:08:25 +01:00 committed by GitHub
parent 8a8e9204d1
commit 73807eb634
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -217,6 +217,11 @@ XMLParser Objects
Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse
deferral. deferral.
Note that :meth:`SetReparseDeferralEnabled` has been backported to some
prior releases of CPython as a security fix. Check for availability of
:meth:`SetReparseDeferralEnabled` using :func:`hasattr` if used in code
running across a variety of Python versions.
.. versionadded:: 3.13 .. versionadded:: 3.13
.. method:: xmlparser.GetReparseDeferralEnabled() .. method:: xmlparser.GetReparseDeferralEnabled()

View File

@ -1402,6 +1402,11 @@ XMLParser Objects
Disabling reparse deferral has security consequences; please see Disabling reparse deferral has security consequences; please see
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details. :meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
Note that :meth:`flush` has been backported to some prior releases of
CPython as a security fix. Check for availability of :meth:`flush`
using :func:`hasattr` if used in code running across a variety of Python
versions.
.. versionadded:: 3.13 .. versionadded:: 3.13
@ -1475,6 +1480,11 @@ XMLPullParser Objects
Disabling reparse deferral has security consequences; please see Disabling reparse deferral has security consequences; please see
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details. :meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
Note that :meth:`flush` has been backported to some prior releases of
CPython as a security fix. Check for availability of :meth:`flush`
using :func:`hasattr` if used in code running across a variety of Python
versions.
.. versionadded:: 3.13 .. versionadded:: 3.13
.. method:: close() .. method:: close()