Skip to content

Commit 6632906

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 31fb351 commit 6632906

File tree

7 files changed

+22
-32
lines changed

7 files changed

+22
-32
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
/* External API definitions */
3737

38-
/* Namespace external symbols to allow multiple libexpat version to
39-
co-exist. */
40-
#include "pyexpatns.h"
41-
4238
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
4339
# define XML_USE_MSC_EXTENSIONS 1
4440
#endif
@@ -97,7 +93,11 @@
9793
# endif
9894
#endif /* not defined XML_STATIC */
9995

100-
#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
101101
# define XMLIMPORT __attribute__ ((visibility ("default")))
102102
#endif
103103

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
/ _ \\ /| '_ \ / _` | __|
@@ -164,15 +164,6 @@ typedef char ICHAR;
164164
/* Do safe (NULL-aware) pointer arithmetic */
165165
#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
166166

167-
/* Handle the case where memmove() doesn't exist. */
168-
#ifndef HAVE_MEMMOVE
169-
#ifdef HAVE_BCOPY
170-
#define memmove(d,s,l) bcopy((s),(d),(l))
171-
#else
172-
#error memmove does not exist on this platform, nor is a substitute available
173-
#endif /* HAVE_BCOPY */
174-
#endif /* HAVE_MEMMOVE */
175-
176167
#include "internal.h"
177168
#include "xmltok.h"
178169
#include "xmlrole.h"
@@ -747,7 +738,7 @@ writeRandomBytes_dev_urandom(void * target, size_t count) {
747738
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
748739

749740

750-
#if defined(HAVE_ARC4RANDOM)
741+
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
751742

752743
static void
753744
writeRandomBytes_arc4random(void * target, size_t count) {
@@ -765,7 +756,7 @@ writeRandomBytes_arc4random(void * target, size_t count) {
765756
}
766757
}
767758

768-
#endif /* defined(HAVE_ARC4RANDOM) */
759+
#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */
769760

770761

771762
#ifdef _WIN32
@@ -3019,7 +3010,7 @@ doContent(XML_Parser parser,
30193010
enum XML_Error result;
30203011
if (parser->m_startCdataSectionHandler)
30213012
parser->m_startCdataSectionHandler(parser->m_handlerArg);
3022-
#if 0
3013+
/* BEGIN disabled code */
30233014
/* Suppose you doing a transformation on a document that involves
30243015
changing only the character data. You set up a defaultHandler
30253016
and a characterDataHandler. The defaultHandler simply copies
@@ -3032,9 +3023,9 @@ doContent(XML_Parser parser,
30323023
However, now we have a start/endCdataSectionHandler, so it seems
30333024
easier to let the user deal with this.
30343025
*/
3035-
else if (parser->m_characterDataHandler)
3026+
else if (0 && parser->m_characterDataHandler)
30363027
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
3037-
#endif
3028+
/* END disabled code */
30383029
else if (parser->m_defaultHandler)
30393030
reportDefault(parser, enc, s, next);
30403031
result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
@@ -3731,11 +3722,11 @@ doCdataSection(XML_Parser parser,
37313722
case XML_TOK_CDATA_SECT_CLOSE:
37323723
if (parser->m_endCdataSectionHandler)
37333724
parser->m_endCdataSectionHandler(parser->m_handlerArg);
3734-
#if 0
3725+
/* BEGIN disabled code */
37353726
/* see comment under XML_TOK_CDATA_SECT_OPEN */
3736-
else if (parser->m_characterDataHandler)
3727+
else if (0 && parser->m_characterDataHandler)
37373728
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
3738-
#endif
3729+
/* END disabled code */
37393730
else if (parser->m_defaultHandler)
37403731
reportDefault(parser, enc, s, next);
37413732
*startPtr = next;
@@ -6080,7 +6071,7 @@ setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
60806071
else
60816072
poolDiscard(&dtd->pool);
60826073
elementType->prefix = prefix;
6083-
6074+
break;
60846075
}
60856076
}
60866077
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)