Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 752d749

Browse filesBrowse files
committed
Suggest use of "hasattr" with checking for 3.13 Expat API availability
1 parent 4d3ee77 commit 752d749
Copy full SHA for 752d749

File tree

3 files changed

+20
-0
lines changed
Filter options

3 files changed

+20
-0
lines changed

‎Doc/library/pyexpat.rst

Copy file name to clipboardExpand all lines: Doc/library/pyexpat.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ XMLParser Objects
217217
Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse
218218
deferral.
219219

220+
Note that :meth:`SetReparseDeferralEnabled` has been backported to prior
221+
releases of CPython, so it is recommended to check for availability of
222+
:meth:`SetReparseDeferralEnabled` using :func:`hasattr`
223+
(rather than inspecting :const:`xml.parsers.expat.version_info`),
224+
at runtime.
225+
220226
.. versionadded:: 3.13
221227

222228
.. method:: xmlparser.GetReparseDeferralEnabled()

‎Doc/library/xml.etree.elementtree.rst

Copy file name to clipboardExpand all lines: Doc/library/xml.etree.elementtree.rst
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,12 @@ 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 prior releases of CPython,
1406+
so it is recommended to check for availability of :meth:`flush`
1407+
using :func:`hasattr`
1408+
(rather than inspecting :const:`xml.parsers.expat.version_info`),
1409+
at runtime.
1410+
14051411
.. versionadded:: 3.13
14061412

14071413

@@ -1475,6 +1481,12 @@ XMLPullParser Objects
14751481
Disabling reparse deferral has security consequences; please see
14761482
:meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` for details.
14771483

1484+
Note that :meth:`flush` has been backported to prior releases of CPython,
1485+
so it is recommended to check for availability of :meth:`flush`
1486+
using :func:`hasattr`
1487+
(rather than inspecting :const:`xml.parsers.expat.version_info`),
1488+
at runtime.
1489+
14781490
.. versionadded:: 3.13
14791491

14801492
.. method:: close()
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Suggest use of "hasattr" when checking for availability of Expat reparse
2+
deferral security API.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.