Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions Modules/clinic/pyexpat.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 23 additions & 19 deletions Modules/pyexpat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Loading