@@ -1182,7 +1182,6 @@ pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
1182
1182
}
1183
1183
#endif
1184
1184
1185
- #if XML_COMBINED_VERSION >= 20702
1186
1185
/*[clinic input]
1187
1186
@permit_long_summary
1188
1187
@permit_long_docstring_body
@@ -1213,6 +1212,7 @@ pyexpat_xmlparser_SetAllocTrackerMaximumAmplification_impl(xmlparseobject *self,
1213
1212
float max_factor )
1214
1213
/*[clinic end generated code: output=6e44bd48c9b112a0 input=23ca8b8f7de04462]*/
1215
1214
{
1215
+ #if XML_COMBINED_VERSION >= 20702
1216
1216
assert (self -> itself != NULL );
1217
1217
if (XML_SetAllocTrackerMaximumAmplification (self -> itself , max_factor ) == XML_TRUE ) {
1218
1218
Py_RETURN_NONE ;
@@ -1231,6 +1231,12 @@ pyexpat_xmlparser_SetAllocTrackerMaximumAmplification_impl(xmlparseobject *self,
1231
1231
? "'max_factor' must be at least 1.0"
1232
1232
: "parser must be a root parser" ;
1233
1233
return set_invalid_arg (state , self , message );
1234
+ #else
1235
+ PyErr_SetString (PyExc_NotImplementedError ,
1236
+ "SetAllocTrackerMaximumAmplification() requires "
1237
+ "Expat 2.7.2 or later" );
1238
+ return NULL ;
1239
+ #endif
1234
1240
}
1235
1241
1236
1242
/*[clinic input]
@@ -1253,6 +1259,7 @@ pyexpat_xmlparser_SetAllocTrackerActivationThreshold_impl(xmlparseobject *self,
1253
1259
unsigned long long threshold )
1254
1260
/*[clinic end generated code: output=bed7e93207ba08c5 input=8453509a137a47c0]*/
1255
1261
{
1262
+ #if XML_COMBINED_VERSION >= 20702
1256
1263
assert (self -> itself != NULL );
1257
1264
if (XML_SetAllocTrackerActivationThreshold (self -> itself , threshold ) == XML_TRUE ) {
1258
1265
Py_RETURN_NONE ;
@@ -1262,8 +1269,13 @@ pyexpat_xmlparser_SetAllocTrackerActivationThreshold_impl(xmlparseobject *self,
1262
1269
// by ExternalEntityParserCreate()).
1263
1270
pyexpat_state * state = PyType_GetModuleState (cls );
1264
1271
return set_invalid_arg (state , self , "parser must be a root parser" );
1265
- }
1272
+ #else
1273
+ PyErr_SetString (PyExc_NotImplementedError ,
1274
+ "SetAllocTrackerActivationThreshold() requires "
1275
+ "Expat 2.7.2 or later" );
1276
+ return NULL ;
1266
1277
#endif
1278
+ }
1267
1279
1268
1280
static struct PyMethodDef xmlparse_methods [] = {
1269
1281
PYEXPAT_XMLPARSER_PARSE_METHODDEF
0 commit comments