Skip to content

Commit 4397c68

Browse files
closes bpo-37437: Update vendorized expat to 2.2.7. (GH-14436)
(cherry picked from commit 3b03b09) Co-authored-by: Benjamin Peterson <benjamin@python.org>
1 parent dfa9499 commit 4397c68

File tree

7 files changed

+22
-28
lines changed

7 files changed

+22
-28
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update vendorized expat version to 2.2.7.

Modules/expat/expat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ XML_GetFeatureList(void);
10761076
*/
10771077
#define XML_MAJOR_VERSION 2
10781078
#define XML_MINOR_VERSION 2
1079-
#define XML_MICRO_VERSION 6
1079+
#define XML_MICRO_VERSION 7
10801080

10811081
#ifdef __cplusplus
10821082
}

Modules/expat/expat_external.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393
# endif
9494
#endif /* not defined XML_STATIC */
9595

96-
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
96+
#ifndef XML_ENABLE_VISIBILITY
97+
# define XML_ENABLE_VISIBILITY 0
98+
#endif
99+
100+
#if !defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
97101
# define XMLIMPORT __attribute__ ((visibility ("default")))
98102
#endif
99103

Modules/expat/internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ extern "C" {
115115
#endif
116116

117117

118+
#ifdef XML_ENABLE_VISIBILITY
119+
#if XML_ENABLE_VISIBILITY
120+
__attribute__ ((visibility ("default")))
121+
#endif
122+
#endif
118123
void
119124
_INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef);
120125

Modules/expat/winconfig.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
/* we will assume all Windows platforms are little endian */
5454
#define BYTEORDER 1234
5555

56-
/* Windows has memmove() available. */
57-
#define HAVE_MEMMOVE
58-
59-
6056
#endif /* !defined(HAVE_EXPAT_CONFIG_H) */
6157

6258

Modules/expat/xmlparse.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* 19ac4776051591216f1874e34ee99b6a43a3784c8bd7d70efeb9258dd22b906a (2.2.6+)
1+
/* 69df5be70289a11fb834869ce4a91c23c1d9dd04baffcbd10e86742d149a080c (2.2.7+)
22
__ __ _
33
___\ \/ /_ __ __ _| |_
44
/ _ \\ /| '_ \ / _` | __|
@@ -167,15 +167,6 @@ typedef char ICHAR;
167167
/* Do safe (NULL-aware) pointer arithmetic */
168168
#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
169169

170-
/* Handle the case where memmove() doesn't exist. */
171-
#ifndef HAVE_MEMMOVE
172-
#ifdef HAVE_BCOPY
173-
#define memmove(d,s,l) bcopy((s),(d),(l))
174-
#else
175-
#error memmove does not exist on this platform, nor is a substitute available
176-
#endif /* HAVE_BCOPY */
177-
#endif /* HAVE_MEMMOVE */
178-
179170
#include "internal.h"
180171
#include "xmltok.h"
181172
#include "xmlrole.h"
@@ -750,7 +741,7 @@ writeRandomBytes_dev_urandom(void * target, size_t count) {
750741
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
751742

752743

753-
#if defined(HAVE_ARC4RANDOM)
744+
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
754745

755746
static void
756747
writeRandomBytes_arc4random(void * target, size_t count) {
@@ -768,7 +759,7 @@ writeRandomBytes_arc4random(void * target, size_t count) {
768759
}
769760
}
770761

771-
#endif /* defined(HAVE_ARC4RANDOM) */
762+
#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */
772763

773764

774765
#ifdef _WIN32
@@ -3022,7 +3013,7 @@ doContent(XML_Parser parser,
30223013
enum XML_Error result;
30233014
if (parser->m_startCdataSectionHandler)
30243015
parser->m_startCdataSectionHandler(parser->m_handlerArg);
3025-
#if 0
3016+
/* BEGIN disabled code */
30263017
/* Suppose you doing a transformation on a document that involves
30273018
changing only the character data. You set up a defaultHandler
30283019
and a characterDataHandler. The defaultHandler simply copies
@@ -3035,9 +3026,9 @@ doContent(XML_Parser parser,
30353026
However, now we have a start/endCdataSectionHandler, so it seems
30363027
easier to let the user deal with this.
30373028
*/
3038-
else if (parser->m_characterDataHandler)
3029+
else if (0 && parser->m_characterDataHandler)
30393030
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
3040-
#endif
3031+
/* END disabled code */
30413032
else if (parser->m_defaultHandler)
30423033
reportDefault(parser, enc, s, next);
30433034
result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
@@ -3734,11 +3725,11 @@ doCdataSection(XML_Parser parser,
37343725
case XML_TOK_CDATA_SECT_CLOSE:
37353726
if (parser->m_endCdataSectionHandler)
37363727
parser->m_endCdataSectionHandler(parser->m_handlerArg);
3737-
#if 0
3728+
/* BEGIN disabled code */
37383729
/* see comment under XML_TOK_CDATA_SECT_OPEN */
3739-
else if (parser->m_characterDataHandler)
3730+
else if (0 && parser->m_characterDataHandler)
37403731
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
3741-
#endif
3732+
/* END disabled code */
37423733
else if (parser->m_defaultHandler)
37433734
reportDefault(parser, enc, s, next);
37443735
*startPtr = next;
@@ -6083,7 +6074,7 @@ setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
60836074
else
60846075
poolDiscard(&dtd->pool);
60856076
elementType->prefix = prefix;
6086-
6077+
break;
60876078
}
60886079
}
60896080
return 1;

Modules/expat/xmltok.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
*/
3232

33-
#if !defined(_WIN32) && defined(HAVE_EXPAT_CONFIG_H)
34-
# include <pyconfig.h>
35-
#endif
3633
#include <stddef.h>
3734
#include <string.h> /* memcpy */
3835

0 commit comments

Comments
 (0)