https://github.com/python/cpython/commit/73807eb634315f70a464a18feaae33d9e065de09
commit: 73807eb634315f70a464a18feaae33d9e065de09
branch: main
author: Sebastian Pipping <[email protected]>
committer: gpshead <[email protected]>
date: 2024-03-06T11:08:25-08:00
summary:

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

files:
M Doc/library/pyexpat.rst
M Doc/library/xml.etree.elementtree.rst

diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst
index c897ec9e47b7ca..c4b4e6319277af 100644
--- a/Doc/library/pyexpat.rst
+++ b/Doc/library/pyexpat.rst
@@ -217,6 +217,11 @@ XMLParser Objects
    Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse
    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
 
 .. method:: xmlparser.GetReparseDeferralEnabled()
diff --git a/Doc/library/xml.etree.elementtree.rst 
b/Doc/library/xml.etree.elementtree.rst
index 19c7af452e2b71..5955647588fa3e 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -1402,6 +1402,11 @@ XMLParser Objects
       Disabling reparse deferral has security consequences; please see
       :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
 
 
@@ -1475,6 +1480,11 @@ XMLPullParser Objects
       Disabling reparse deferral has security consequences; please see
       :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
 
    .. method:: close()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to