Skip to content

Commit e26aef6

Browse files
committed
pyexpat: Make SetReparseDeferralEnabled available via PyExpat_CAPI
1 parent e80e090 commit e26aef6

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Include/pyexpat.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/* note: you must import expat.h before importing this module! */
55

6-
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1"
6+
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.2"
77
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
88

99
struct PyExpat_CAPI
@@ -50,6 +50,8 @@ struct PyExpat_CAPI
5050
void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
5151
/* might be none for expat < 2.1.0 */
5252
int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
53+
/* might be none for expat < 2.6.0 */
54+
XML_Bool (*SetReparseDeferralEnabled)(XML_Parser parser, XML_Bool enabled);
5355
/* always add new stuff to the end! */
5456
};
5557

Modules/expat/pyexpatns.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
#define XML_SetNotStandaloneHandler PyExpat_XML_SetNotStandaloneHandler
109109
#define XML_SetParamEntityParsing PyExpat_XML_SetParamEntityParsing
110110
#define XML_SetProcessingInstructionHandler PyExpat_XML_SetProcessingInstructionHandler
111+
#define XML_SetReparseDeferralEnabled PyExpat_XML_SetReparseDeferralEnabled
111112
#define XML_SetReturnNSTriplet PyExpat_XML_SetReturnNSTriplet
112113
#define XML_SetSkippedEntityHandler PyExpat_XML_SetSkippedEntityHandler
113114
#define XML_SetStartCdataSectionHandler PyExpat_XML_SetStartCdataSectionHandler

Modules/pyexpat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,11 @@ pyexpat_exec(PyObject *mod)
20512051
#else
20522052
capi->SetHashSalt = NULL;
20532053
#endif
2054+
#if XML_COMBINED_VERSION >= 20600
2055+
capi->SetReparseDeferralEnabled = XML_SetReparseDeferralEnabled;
2056+
#else
2057+
capi->SetReparseDeferralEnabled = NULL;
2058+
#endif
20542059

20552060
/* export using capsule */
20562061
PyObject *capi_object = PyCapsule_New(capi, PyExpat_CAPSULE_NAME,

0 commit comments

Comments
 (0)