https://github.com/python/cpython/commit/56be4fb3d21f684a6c61384c24061c5766462fa3
commit: 56be4fb3d21f684a6c61384c24061c5766462fa3
branch: 3.13
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-05-26T10:01:15Z
summary:
[3.13] gh-150285: Fix too long docstrings in the pyexpat module (GH-150294)
(GH-150463) (GH-150468)
(cherry picked from commit ad1bb6c14cb6d70bcf6411b84f9aaac07b28b416)
(cherry picked from commit 9da7923835a4c72e738551bbd78b8179a81286ad)
files:
M Modules/clinic/pyexpat.c.h
M Modules/pyexpat.c
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index 9f318133d87a0d..2d80e604ead345 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -216,8 +216,9 @@ PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
"\n"
"Return the untranslated text of the input that caused the current event.\n"
"\n"
-"If the event was generated by a large amount of text (such as a start tag\n"
-"for an element with many attributes), not all of the text may be available.");
+"If the event was generated by a large amount of text (such as\n"
+"a start tag for an element with many attributes), not all of the\n"
+"text may be available.");
#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
{"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext,
METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
@@ -354,9 +355,10 @@ PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
"\n"
"Allows the application to provide an artificial external subset if one is not
specified as part of the document instance.\n"
"\n"
-"This readily allows the use of a \'default\' document type controlled by
the\n"
-"application, while still getting the advantage of providing document type\n"
-"information to the parser. \'flag\' defaults to True if not provided.");
+"This readily allows the use of a \'default\' document type controlled\n"
+"by the application, while still getting the advantage of providing\n"
+"document type information to the parser. \'flag\' defaults to True if\n"
+"not provided.");
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
{"UseForeignDTD", _PyCFunction_CAST(pyexpat_xmlparser_UseForeignDTD),
METH_METHOD|METH_FASTCALL|METH_KEYWORDS,
pyexpat_xmlparser_UseForeignDTD__doc__},
@@ -413,7 +415,8 @@
PyDoc_STRVAR(pyexpat_xmlparser_SetAllocTrackerActivationThreshold__doc__,
"\n"
"Sets the number of allocated bytes of dynamic memory needed to activate
protection against disproportionate use of RAM.\n"
"\n"
-"By default, parser objects have an allocation activation threshold of 64
MiB.");
+"By default, parser objects have an allocation activation threshold of\n"
+"64 MiB.");
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF \
{"SetAllocTrackerActivationThreshold",
_PyCFunction_CAST(pyexpat_xmlparser_SetAllocTrackerActivationThreshold),
METH_METHOD|METH_FASTCALL|METH_KEYWORDS,
pyexpat_xmlparser_SetAllocTrackerActivationThreshold__doc__},
@@ -466,17 +469,18 @@
PyDoc_STRVAR(pyexpat_xmlparser_SetAllocTrackerMaximumAmplification__doc__,
"\n"
"Sets the maximum amplification factor between direct input and bytes of
dynamic memory allocated.\n"
"\n"
-"The amplification factor is calculated as \"allocated / direct\" while
parsing,\n"
-"where \"direct\" is the number of bytes read from the primary document in
parsing\n"
-"and \"allocated\" is the number of bytes of dynamic memory allocated in the
parser\n"
-"hierarchy.\n"
+"The amplification factor is calculated as \"allocated / direct\" while\n"
+"parsing, where \"direct\" is the number of bytes read from the primary\n"
+"document in parsing and \"allocated\" is the number of bytes of\n"
+"dynamic memory allocated in the parser hierarchy.\n"
"\n"
-"The \'max_factor\' value must be a non-NaN floating point value greater
than\n"
-"or equal to 1.0. Amplification factors greater than 100.0 can be observed\n"
-"near the start of parsing even with benign files in practice. In
particular,\n"
-"the activation threshold should be carefully chosen to avoid false
positives.\n"
+"The \'max_factor\' value must be a non-NaN floating point value\n"
+"greater than or equal to 1.0. Amplification factors greater than\n"
+"100.0 can be observed near the start of parsing even with benign\n"
+"files in practice. In particular, the activation threshold should\n"
+"be carefully chosen to avoid false positives.\n"
"\n"
-"By default, parser objects have a maximum amplification factor of 100.0.");
+"By default, parser objects have a maximum amplification factor of 100.");
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF \
{"SetAllocTrackerMaximumAmplification",
_PyCFunction_CAST(pyexpat_xmlparser_SetAllocTrackerMaximumAmplification),
METH_METHOD|METH_FASTCALL|METH_KEYWORDS,
pyexpat_xmlparser_SetAllocTrackerMaximumAmplification__doc__},
@@ -677,4 +681,4 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg)
#ifndef PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
#endif /*
!defined(PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF) */
-/*[clinic end generated code: output=2e787fd99710eb5b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=207ad2ee024f9842 input=a9049054013a1b77]*/
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 65802fca221bf6..edba9937ec98b3 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -994,13 +994,14 @@ pyexpat.xmlparser.GetInputContext
Return the untranslated text of the input that caused the current event.
-If the event was generated by a large amount of text (such as a start tag
-for an element with many attributes), not all of the text may be available.
+If the event was generated by a large amount of text (such as
+a start tag for an element with many attributes), not all of the
+text may be available.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self)
-/*[clinic end generated code: output=a88026d683fc22cc input=034df8712db68379]*/
+/*[clinic end generated code: output=a88026d683fc22cc input=3ff7cb00783c8f98]*/
{
if (self->in_callback) {
int offset, size;
@@ -1133,15 +1134,16 @@ pyexpat.xmlparser.UseForeignDTD
Allows the application to provide an artificial external subset if one is not
specified as part of the document instance.
-This readily allows the use of a 'default' document type controlled by the
-application, while still getting the advantage of providing document type
-information to the parser. 'flag' defaults to True if not provided.
+This readily allows the use of a 'default' document type controlled
+by the application, while still getting the advantage of providing
+document type information to the parser. 'flag' defaults to True if
+not provided.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
int flag)
-/*[clinic end generated code: output=d7d98252bd25a20f input=23440ecb0573fb29]*/
+/*[clinic end generated code: output=d7d98252bd25a20f input=0387bce44fd53d99]*/
{
pyexpat_state *state = PyType_GetModuleState(cls);
enum XML_Error rc;
@@ -1208,14 +1210,15 @@ pyexpat.xmlparser.SetAllocTrackerActivationThreshold
Sets the number of allocated bytes of dynamic memory needed to activate
protection against disproportionate use of RAM.
-By default, parser objects have an allocation activation threshold of 64 MiB.
+By default, parser objects have an allocation activation threshold of
+64 MiB.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_SetAllocTrackerActivationThreshold_impl(xmlparseobject *self,
PyTypeObject *cls,
unsigned long long
threshold)
-/*[clinic end generated code: output=bed7e93207ba08c5 input=9c706b75c18e4ea1]*/
+/*[clinic end generated code: output=bed7e93207ba08c5 input=a96541ba5ea46747]*/
{
return set_activation_threshold(
self, cls, threshold,
@@ -1234,24 +1237,25 @@ pyexpat.xmlparser.SetAllocTrackerMaximumAmplification
Sets the maximum amplification factor between direct input and bytes of
dynamic memory allocated.
-The amplification factor is calculated as "allocated / direct" while parsing,
-where "direct" is the number of bytes read from the primary document in parsing
-and "allocated" is the number of bytes of dynamic memory allocated in the
parser
-hierarchy.
+The amplification factor is calculated as "allocated / direct" while
+parsing, where "direct" is the number of bytes read from the primary
+document in parsing and "allocated" is the number of bytes of
+dynamic memory allocated in the parser hierarchy.
-The 'max_factor' value must be a non-NaN floating point value greater than
-or equal to 1.0. Amplification factors greater than 100.0 can be observed
-near the start of parsing even with benign files in practice. In particular,
-the activation threshold should be carefully chosen to avoid false positives.
+The 'max_factor' value must be a non-NaN floating point value
+greater than or equal to 1.0. Amplification factors greater than
+100.0 can be observed near the start of parsing even with benign
+files in practice. In particular, the activation threshold should
+be carefully chosen to avoid false positives.
-By default, parser objects have a maximum amplification factor of 100.0.
+By default, parser objects have a maximum amplification factor of 100.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_SetAllocTrackerMaximumAmplification_impl(xmlparseobject
*self,
PyTypeObject *cls,
float max_factor)
-/*[clinic end generated code: output=6e44bd48c9b112a0 input=918b9266b490a722]*/
+/*[clinic end generated code: output=6e44bd48c9b112a0 input=9cd13e3ea845dbb4]*/
{
return set_maximum_amplification(
self, cls, max_factor,
_______________________________________________
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]