From 3b03b09fc94425915c5b1225e9200a3a95bc827b Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 27 Jun 2019 20:54:44 -0700 Subject: [PATCH] closes bpo-37437: Update vendorized expat to 2.2.7. (GH-14436) --- .../2019-06-27-20-33-50.bpo-37437.du39_A.rst | 1 + Modules/expat/expat.h | 2 +- Modules/expat/expat_external.h | 10 +++---- Modules/expat/internal.h | 5 ++++ Modules/expat/winconfig.h | 4 --- Modules/expat/xmlparse.c | 29 +++++++------------ Modules/expat/xmltok.c | 3 -- 7 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst diff --git a/Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst b/Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst new file mode 100644 index 00000000000..80719ee152d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst @@ -0,0 +1 @@ +Update vendorized expat version to 2.2.7. diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index 174c3fafda3..c050f1d918c 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1076,7 +1076,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 6 +#define XML_MICRO_VERSION 7 #ifdef __cplusplus } diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index 2d96b4f41ad..875225d77e5 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -35,10 +35,6 @@ /* External API definitions */ -/* Namespace external symbols to allow multiple libexpat version to - co-exist. */ -#include "pyexpatns.h" - #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) # define XML_USE_MSC_EXTENSIONS 1 #endif @@ -97,7 +93,11 @@ # endif #endif /* not defined XML_STATIC */ -#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) +#ifndef XML_ENABLE_VISIBILITY +# define XML_ENABLE_VISIBILITY 0 +#endif + +#if !defined(XMLIMPORT) && XML_ENABLE_VISIBILITY # define XMLIMPORT __attribute__ ((visibility ("default"))) #endif diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index e33fdcb0238..dc4ef0c7e25 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -115,6 +115,11 @@ extern "C" { #endif +#ifdef XML_ENABLE_VISIBILITY +#if XML_ENABLE_VISIBILITY +__attribute__ ((visibility ("default"))) +#endif +#endif void _INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef); diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index 17fea468900..28a043c6044 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -53,10 +53,6 @@ /* we will assume all Windows platforms are little endian */ #define BYTEORDER 1234 -/* Windows has memmove() available. */ -#define HAVE_MEMMOVE - - #endif /* !defined(HAVE_EXPAT_CONFIG_H) */ diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index c4f3ffc215c..9c0987f4f6d 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,4 +1,4 @@ -/* 19ac4776051591216f1874e34ee99b6a43a3784c8bd7d70efeb9258dd22b906a (2.2.6+) +/* 69df5be70289a11fb834869ce4a91c23c1d9dd04baffcbd10e86742d149a080c (2.2.7+) __ __ _ ___\ \/ /_ __ __ _| |_ / _ \\ /| '_ \ / _` | __| @@ -164,15 +164,6 @@ typedef char ICHAR; /* Do safe (NULL-aware) pointer arithmetic */ #define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0) -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ - #include "internal.h" #include "xmltok.h" #include "xmlrole.h" @@ -747,7 +738,7 @@ writeRandomBytes_dev_urandom(void * target, size_t count) { #endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */ -#if defined(HAVE_ARC4RANDOM) +#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) static void writeRandomBytes_arc4random(void * target, size_t count) { @@ -765,7 +756,7 @@ writeRandomBytes_arc4random(void * target, size_t count) { } } -#endif /* defined(HAVE_ARC4RANDOM) */ +#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */ #ifdef _WIN32 @@ -3019,7 +3010,7 @@ doContent(XML_Parser parser, enum XML_Error result; if (parser->m_startCdataSectionHandler) parser->m_startCdataSectionHandler(parser->m_handlerArg); -#if 0 +/* BEGIN disabled code */ /* Suppose you doing a transformation on a document that involves changing only the character data. You set up a defaultHandler and a characterDataHandler. The defaultHandler simply copies @@ -3032,9 +3023,9 @@ doContent(XML_Parser parser, However, now we have a start/endCdataSectionHandler, so it seems easier to let the user deal with this. */ - else if (parser->m_characterDataHandler) + else if (0 && parser->m_characterDataHandler) parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0); -#endif +/* END disabled code */ else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); @@ -3731,11 +3722,11 @@ doCdataSection(XML_Parser parser, case XML_TOK_CDATA_SECT_CLOSE: if (parser->m_endCdataSectionHandler) parser->m_endCdataSectionHandler(parser->m_handlerArg); -#if 0 +/* BEGIN disabled code */ /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (parser->m_characterDataHandler) + else if (0 && parser->m_characterDataHandler) parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0); -#endif +/* END disabled code */ else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; @@ -6080,7 +6071,7 @@ setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) else poolDiscard(&dtd->pool); elementType->prefix = prefix; - + break; } } return 1; diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index 6371a350dad..6b415d83972 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -30,9 +30,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if !defined(_WIN32) && defined(HAVE_EXPAT_CONFIG_H) -# include -#endif #include #include /* memcpy */