@@ -1174,7 +1174,7 @@ pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
11741174}
11751175#endif
11761176
1177- #if XML_COMBINED_VERSION >= 20402
1177+ #if XML_COMBINED_VERSION >= 20400
11781178static PyObject *
11791179set_activation_threshold (xmlparseobject * self ,
11801180 PyTypeObject * cls ,
@@ -1284,50 +1284,6 @@ pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification_impl(xmlp
12841284}
12851285#endif
12861286
1287- #if XML_COMBINED_VERSION >= 20702
1288- static PyObject *
1289- set_activation_threshold (xmlparseobject * self ,
1290- PyTypeObject * cls ,
1291- unsigned long long threshold ,
1292- XML_Bool (* setter )(XML_Parser , unsigned long long ))
1293- {
1294- assert (self -> itself != NULL );
1295- if (setter (self -> itself , threshold ) == XML_TRUE ) {
1296- Py_RETURN_NONE ;
1297- }
1298- // The setter fails if self->itself is NULL (which is not possible here)
1299- // or is a non-root parser, which currently only happens for parsers
1300- // created by ExternalEntityParserCreate().
1301- pyexpat_state * state = PyType_GetModuleState (cls );
1302- return set_invalid_arg (state , self , "parser must be a root parser" );
1303- }
1304-
1305- static PyObject *
1306- set_maximum_amplification (xmlparseobject * self ,
1307- PyTypeObject * cls ,
1308- float max_factor ,
1309- XML_Bool (* setter )(XML_Parser , float ))
1310- {
1311- assert (self -> itself != NULL );
1312- if (setter (self -> itself , max_factor ) == XML_TRUE ) {
1313- Py_RETURN_NONE ;
1314- }
1315- // The setter fails if self->itself is NULL (which is not possible here),
1316- // is a non-root parser, which currently only happens for parsers created
1317- // by ExternalEntityParserCreate(), or if 'max_factor' is NaN or < 1.0.
1318- pyexpat_state * state = PyType_GetModuleState (cls );
1319- // Note: Expat has no API to determine whether a parser is a root parser,
1320- // and since the Expat functions for defining the various maximum allowed
1321- // amplifcation factors fail when a bad parser or an out-of-range factor
1322- // is given without specifying which check failed, we check whether the
1323- // factor is out-of-range to improve the error message. See also gh-90949.
1324- const char * message = (isnan (max_factor ) || max_factor < 1.0f )
1325- ? "'max_factor' must be at least 1.0"
1326- : "parser must be a root parser" ;
1327- return set_invalid_arg (state , self , message );
1328- }
1329- #endif
1330-
13311287#if XML_COMBINED_VERSION >= 20702
13321288/*[clinic input]
13331289@permit_long_summary
0 commit comments