summaryrefslogtreecommitdiff
path: root/lang/python27
diff options
context:
space:
mode:
authorchopps <chopps@pkgsrc.org>2014-12-16 07:07:32 +0000
committerchopps <chopps@pkgsrc.org>2014-12-16 07:07:32 +0000
commit1572a239f55f3fde94483894b4ef134d514dae7e (patch)
tree5c98e9870a658b26d53c9567a79aea08910907b3 /lang/python27
parent1ef0e4eb758311e9f5373756af3976148cbe15d2 (diff)
downloadpkgsrc-1572a239f55f3fde94483894b4ef134d514dae7e.tar.gz
Update to 2.7.9 removing patches that were incorporated. Significant
changes include: - The entirety of Python 3.4's ssl module has been backported for Python 2.7.9. See PEP 466 for justification. - HTTPS certificate validation using the system's certificate store is now enabled by default. See PEP 476 for details. - SSLv3 has been disabled by default in httplib and its reverse dependencies due to the POODLE attack. - The ensurepip module module has been backported, which provides the pip package manager in every Python 2.7 installation. See PEP 477.
Diffstat (limited to 'lang/python27')
-rw-r--r--lang/python27/dist.mk4
-rw-r--r--lang/python27/distinfo17
-rw-r--r--lang/python27/patches/patch-Include_node.h15
-rw-r--r--lang/python27/patches/patch-Lib_poplib.py43
-rw-r--r--lang/python27/patches/patch-Lib_smtplib.py51
-rw-r--r--lang/python27/patches/patch-Lib_test_test__poplib.py27
-rw-r--r--lang/python27/patches/patch-Lib_test_test_smtplib.py50
-rw-r--r--lang/python27/patches/patch-Misc_NEWS42
-rw-r--r--lang/python27/patches/patch-Modules___ssl.c17
-rw-r--r--lang/python27/patches/patch-Objects_unicodeobject.c152
-rw-r--r--lang/python27/patches/patch-Python_codecs.c50
11 files changed, 6 insertions, 462 deletions
diff --git a/lang/python27/dist.mk b/lang/python27/dist.mk
index b7b29450df5..de135319592 100644
--- a/lang/python27/dist.mk
+++ b/lang/python27/dist.mk
@@ -1,6 +1,6 @@
-# $NetBSD: dist.mk,v 1.8 2014/07/02 09:53:16 adam Exp $
+# $NetBSD: dist.mk,v 1.9 2014/12/16 07:07:32 chopps Exp $
-PY_DISTVERSION= 2.7.8
+PY_DISTVERSION= 2.7.9
DISTNAME= Python-${PY_DISTVERSION}
EXTRACT_SUFX= .tar.xz
DISTINFO_FILE= ${.CURDIR}/../../lang/python27/distinfo
diff --git a/lang/python27/distinfo b/lang/python27/distinfo
index c55ee8c5c17..39c86a94028 100644
--- a/lang/python27/distinfo
+++ b/lang/python27/distinfo
@@ -1,26 +1,17 @@
-$NetBSD: distinfo,v 1.47 2014/11/02 13:31:11 spz Exp $
+$NetBSD: distinfo,v 1.48 2014/12/16 07:07:32 chopps Exp $
-SHA1 (Python-2.7.8.tar.xz) = 9c6281eeace0c3646fa556c8087bb1b7e033c9c4
-RMD160 (Python-2.7.8.tar.xz) = 04d7d55ea65074a9b419e5d0920414e54691d907
-Size (Python-2.7.8.tar.xz) = 10525244 bytes
-SHA1 (patch-Include_node.h) = 673d148b625711ac47e4bfeb0f5b0d5b31f94d7e
+SHA1 (Python-2.7.9.tar.xz) = 3172f6e957713c2d9fca462cc16068222fd1b9d3
+RMD160 (Python-2.7.9.tar.xz) = 2b047c3b56987b473c3ca957ad87f5582c37d6f6
+Size (Python-2.7.9.tar.xz) = 12164712 bytes
SHA1 (patch-Include_pyerrors.h) = 3eba043c83b1d1df4918524f7b53047a6ed372ae
SHA1 (patch-Include_pyport.h) = 971c7c548b92595712d0d70a0917a0ccc83b6c7e
SHA1 (patch-Lib_distutils_unixccompiler.py) = 39b967dc2ae648143d5841f22602a21063b4d5ea
SHA1 (patch-Lib_multiprocessing_process.py) = b47ad4cbeddbcfb4342c08c84d0d515a793815d4
-SHA1 (patch-Lib_poplib.py) = 5d7f64b028abd2fd43651f27a7f2ce7efe5b0859
-SHA1 (patch-Lib_smtplib.py) = f1118bbc53b4e292eb9a28ef3ef10eb4aa553bc3
-SHA1 (patch-Lib_test_test__poplib.py) = 1bdef76b687d042272e35c08521d4244d2c7fbe1
-SHA1 (patch-Lib_test_test_smtplib.py) = 9e8a7f826c7d0f493746718b49fc27ac97c2cbb1
-SHA1 (patch-Misc_NEWS) = 262f9cb316d0f7ce1fb85296a07302f4cb2dd1a5
-SHA1 (patch-Modules___ssl.c) = aaddaea5bcd6c84d3d896c7c37f710933b8228bc
SHA1 (patch-Modules_getaddrinfo.c) = 696c58c4c4bbb710fb1508d7d88864d0b08cfc79
SHA1 (patch-Modules_getpath.c) = aa8a54717a85f831e3ceaad19d96c43bc38aef10
SHA1 (patch-Modules_mmapmodule.c) = 87ea76e6d8263045c1ca794ff5c75ed631a74b6d
SHA1 (patch-Modules_posixmodule.c) = b8960592611499202bb5ff8521d619e0637177b6
SHA1 (patch-Modules_socketmodule.c) = 960ce4af2a142c471c707de446f2d390044bbc13
-SHA1 (patch-Objects_unicodeobject.c) = 7edf7d2b553569bc66c883b1fd516dceb13c8cde
-SHA1 (patch-Python_codecs.c) = fce9d5f2745773b76074a8ae7389aa88fbbe4f9e
SHA1 (patch-aa) = 990e4025bb6a37715e1f5df1831499f0ab08acfa
SHA1 (patch-ab) = 6a38874aaaccc878541554546835ccbf6136bbd5
SHA1 (patch-ad) = 061aefac15fe3834271770f0fd225e12f84d961a
diff --git a/lang/python27/patches/patch-Include_node.h b/lang/python27/patches/patch-Include_node.h
deleted file mode 100644
index c92c31ed19a..00000000000
--- a/lang/python27/patches/patch-Include_node.h
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-Include_node.h,v 1.1 2013/04/17 13:21:05 obache Exp $
-
-* _PyNode_SizeOf is used by parsermodule
-
---- Include/node.h.orig 2013-04-06 14:02:25.000000000 +0000
-+++ Include/node.h
-@@ -21,7 +21,7 @@ PyAPI_FUNC(int) PyNode_AddChild(node *n,
- char *str, int lineno, int col_offset);
- PyAPI_FUNC(void) PyNode_Free(node *n);
- #ifndef Py_LIMITED_API
--Py_ssize_t _PyNode_SizeOf(node *n);
-+PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
- #endif
-
- /* Node access functions */
diff --git a/lang/python27/patches/patch-Lib_poplib.py b/lang/python27/patches/patch-Lib_poplib.py
deleted file mode 100644
index 6f43af0a2ec..00000000000
--- a/lang/python27/patches/patch-Lib_poplib.py
+++ /dev/null
@@ -1,43 +0,0 @@
-$NetBSD: patch-Lib_poplib.py,v 1.1 2014/06/09 17:58:31 he Exp $
-
-Apply a fix for CVE-2013-1752.
-From http://bugs.python.org/issue16041.
-
---- Lib/poplib.py.orig 2014-06-09 11:29:36.000000000 +0000
-+++ Lib/poplib.py
-@@ -32,6 +32,12 @@ CR = '\r'
- LF = '\n'
- CRLF = CR+LF
-
-+# maximal line length when calling readline(). This is to prevent
-+# reading arbitrary lenght lines. RFC 1939 limits POP3 line length to
-+# 512 characters, including CRLF. We have selected 2048 just to be on
-+# the safe side.
-+_MAXLINE = 2048
-+
-
- class POP3:
-
-@@ -103,7 +109,10 @@ class POP3:
- # Raise error_proto('-ERR EOF') if the connection is closed.
-
- def _getline(self):
-- line = self.file.readline()
-+ line = self.file.readline(_MAXLINE + 1)
-+ if len(line) > _MAXLINE:
-+ raise error_proto('line too long')
-+
- if self._debugging > 1: print '*get*', repr(line)
- if not line: raise error_proto('-ERR EOF')
- octets = len(line)
-@@ -363,7 +372,10 @@ else:
- line = ""
- renewline = re.compile(r'.*?\n')
- match = renewline.match(self.buffer)
-+
- while not match:
-+ if len(self.buffer) > _MAXLINE:
-+ raise error_proto('line too long')
- self._fillBuffer()
- match = renewline.match(self.buffer)
- line = match.group(0)
diff --git a/lang/python27/patches/patch-Lib_smtplib.py b/lang/python27/patches/patch-Lib_smtplib.py
deleted file mode 100644
index 6843a9e7f26..00000000000
--- a/lang/python27/patches/patch-Lib_smtplib.py
+++ /dev/null
@@ -1,51 +0,0 @@
-$NetBSD: patch-Lib_smtplib.py,v 1.1 2014/06/09 17:58:31 he Exp $
-
-Apply a fix for CVE-2013-1752 for the SMTP part.
-From http://bugs.python.org/issue16042.
-
---- Lib/smtplib.py.orig 2014-05-31 18:58:39.000000000 +0000
-+++ Lib/smtplib.py
-@@ -57,6 +57,7 @@ __all__ = ["SMTPException", "SMTPServerD
- SMTP_PORT = 25
- SMTP_SSL_PORT = 465
- CRLF = "\r\n"
-+_MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3
-
- OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
-
-@@ -179,10 +180,14 @@ else:
- def __init__(self, sslobj):
- self.sslobj = sslobj
-
-- def readline(self):
-+ def readline(self, size=-1):
-+ if size < 0:
-+ size = None
- str = ""
- chr = None
- while chr != "\n":
-+ if size is not None and len(str) >= size:
-+ break
- chr = self.sslobj.read(1)
- if not chr:
- break
-@@ -353,7 +358,7 @@ class SMTP:
- self.file = self.sock.makefile('rb')
- while 1:
- try:
-- line = self.file.readline()
-+ line = self.file.readline(_MAXLINE + 1)
- except socket.error as e:
- self.close()
- raise SMTPServerDisconnected("Connection unexpectedly closed: "
-@@ -362,7 +367,9 @@ class SMTP:
- self.close()
- raise SMTPServerDisconnected("Connection unexpectedly closed")
- if self.debuglevel > 0:
-- print>>stderr, 'reply:', repr(line)
-+ print >>stderr, 'reply:', repr(line)
-+ if len(line) > _MAXLINE:
-+ raise SMTPResponseException(500, "Line too long.")
- resp.append(line[4:].strip())
- code = line[:3]
- # Check that the error code is syntactically correct.
diff --git a/lang/python27/patches/patch-Lib_test_test__poplib.py b/lang/python27/patches/patch-Lib_test_test__poplib.py
deleted file mode 100644
index 8a18b553200..00000000000
--- a/lang/python27/patches/patch-Lib_test_test__poplib.py
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD: patch-Lib_test_test__poplib.py,v 1.1 2014/06/09 17:58:31 he Exp $
-
-Apply a fix for CVE-2013-1752.
-From http://bugs.python.org/issue16041.
-
---- Lib/test/test_poplib.py.orig 2014-06-09 11:29:38.000000000 +0000
-+++ Lib/test/test_poplib.py
-@@ -81,7 +81,7 @@ class DummyPOP3Handler(asynchat.async_ch
-
- def cmd_list(self, arg):
- if arg:
-- self.push('+OK %s %s' %(arg, arg))
-+ self.push('+OK %s %s' % (arg, arg))
- else:
- self.push('+OK')
- asynchat.async_chat.push(self, LIST_RESP)
-@@ -198,6 +198,10 @@ class TestPOP3Class(TestCase):
- 113)
- self.assertEqual(self.client.retr('foo'), expected)
-
-+ def test_too_long_lines(self):
-+ self.assertRaises(poplib.error_proto, self.client._shortcmd,
-+ 'echo %s' % (3000 * 'a'))
-+
- def test_dele(self):
- self.assertOK(self.client.dele('foo'))
-
diff --git a/lang/python27/patches/patch-Lib_test_test_smtplib.py b/lang/python27/patches/patch-Lib_test_test_smtplib.py
deleted file mode 100644
index 14ee7279e20..00000000000
--- a/lang/python27/patches/patch-Lib_test_test_smtplib.py
+++ /dev/null
@@ -1,50 +0,0 @@
-$NetBSD: patch-Lib_test_test_smtplib.py,v 1.1 2014/06/09 17:58:31 he Exp $
-
-Apply a fix for CVE-2013-1752 for the SMTP part.
-From http://bugs.python.org/issue16042.
-
---- Lib/test/test_smtplib.py.orig 2014-05-31 18:58:39.000000000 +0000
-+++ Lib/test/test_smtplib.py
-@@ -292,6 +292,32 @@ class BadHELOServerTests(unittest.TestCa
- HOST, self.port, 'localhost', 3)
-
-
-+class TooLongLineTests(TestCase):
-+ respdata = '250 OK' + ('.' * smtplib._MAXLINE * 2) + '\n'
-+
-+ def setUp(self):
-+ self.old_stdout = sys.stdout
-+ self.output = StringIO.StringIO()
-+ sys.stdout = self.output
-+
-+ self.evt = threading.Event()
-+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-+ self.sock.settimeout(15)
-+ self.port = test_support.bind_port(self.sock)
-+ servargs = (self.evt, self.respdata, self.sock)
-+ threading.Thread(target=server, args=servargs).start()
-+ self.evt.wait()
-+ self.evt.clear()
-+
-+ def tearDown(self):
-+ self.evt.wait()
-+ sys.stdout = self.old_stdout
-+
-+ def testLineTooLong(self):
-+ self.assertRaises(smtplib.SMTPResponseException, smtplib.SMTP,
-+ HOST, self.port, 'localhost', 3)
-+
-+
- sim_users = {'Mr.A@somewhere.com':'John A',
- 'Ms.B@somewhere.com':'Sally B',
- 'Mrs.C@somewhereesle.com':'Ruth C',
-@@ -511,7 +537,8 @@ class SMTPSimTests(unittest.TestCase):
- def test_main(verbose=None):
- test_support.run_unittest(GeneralTests, DebuggingServerTests,
- NonConnectingTests,
-- BadHELOServerTests, SMTPSimTests)
-+ BadHELOServerTests, SMTPSimTests,
-+ TooLongLineTests)
-
- if __name__ == '__main__':
- test_main()
diff --git a/lang/python27/patches/patch-Misc_NEWS b/lang/python27/patches/patch-Misc_NEWS
deleted file mode 100644
index 9b83d62b86c..00000000000
--- a/lang/python27/patches/patch-Misc_NEWS
+++ /dev/null
@@ -1,42 +0,0 @@
-$NetBSD: patch-Misc_NEWS,v 1.5 2014/11/02 13:31:11 spz Exp $
-
-Note added fixes.
-
---- Misc/NEWS.orig 2014-06-30 02:05:39.000000000 +0000
-+++ Misc/NEWS
-@@ -10,6 +10,11 @@ What's New in Python 2.7.8?
- Core and Builtins
- -----------------
-
-+- Issue #22518: Fix integer overflow issues in latin-1 encoding.
-+
-+- Issue #22470: Fixed integer overflow issues in "backslashreplace" and
-+ "xmlcharrefreplace" error handlers.
-+
- - Issue #4346: In PyObject_CallMethod and PyObject_CallMethodObjArgs, don't
- overwrite the error set in PyObject_GetAttr.
-
-@@ -207,6 +212,9 @@ Core and Builtins
- Library
- -------
-
-+- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths
-+ before checking for a CGI script at that path.
-+
- - Issue #10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial
- shape.
-
-@@ -729,6 +737,13 @@ Library
- prevent readline() calls from consuming too much memory. Patch by Jyrki
- Pulliainen.
-
-+- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to
-+ prevent readline() calls from consuming too much memory. Patch by Jyrki
-+ Pulliainen.
-+
-+- Issue #16042: CVE-2013-1752: smtplib: Limit amount of data read by
-+ limiting the call to readline(). Original patch by Christian Heimes.
-+
- - Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except
- when necessary. Patch by Oscar Benjamin.
-
diff --git a/lang/python27/patches/patch-Modules___ssl.c b/lang/python27/patches/patch-Modules___ssl.c
deleted file mode 100644
index 33af28ec304..00000000000
--- a/lang/python27/patches/patch-Modules___ssl.c
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-Modules___ssl.c,v 1.3 2013/11/12 18:57:25 adam Exp $
-
-Cygwin fix from cygport 2.6.2-ssl-threads.patch
-
---- Modules/_ssl.c.orig 2013-11-10 07:36:41.000000000 +0000
-+++ Modules/_ssl.c
-@@ -16,6 +16,10 @@
-
- #include "Python.h"
-
-+#ifdef __CYGWIN__
-+#undef WITH_THREAD
-+#endif
-+
- #ifdef WITH_THREAD
- #include "pythread.h"
-
diff --git a/lang/python27/patches/patch-Objects_unicodeobject.c b/lang/python27/patches/patch-Objects_unicodeobject.c
deleted file mode 100644
index 207324dcd4e..00000000000
--- a/lang/python27/patches/patch-Objects_unicodeobject.c
+++ /dev/null
@@ -1,152 +0,0 @@
-$NetBSD: patch-Objects_unicodeobject.c,v 1.1 2014/11/02 13:31:11 spz Exp $
-
-taken from https://hg.python.org/cpython/rev/b2e68274aa8e:
-
-Issue #22518: integer overflow in encoding unicode
-
---- Objects/unicodeobject.c.orig 2014-06-30 02:05:45.000000000 +0000
-+++ Objects/unicodeobject.c
-@@ -1510,9 +1510,15 @@ int unicode_decode_call_errorhandler(con
- when there are no errors in the rest of the string) */
- repptr = PyUnicode_AS_UNICODE(repunicode);
- repsize = PyUnicode_GET_SIZE(repunicode);
-- requiredsize = *outpos + repsize + insize-newpos;
-+ requiredsize = *outpos;
-+ if (requiredsize > PY_SSIZE_T_MAX - repsize)
-+ goto overflow;
-+ requiredsize += repsize;
-+ if (requiredsize > PY_SSIZE_T_MAX - (insize - newpos))
-+ goto overflow;
-+ requiredsize += insize - newpos;
- if (requiredsize > outsize) {
-- if (requiredsize<2*outsize)
-+ if (outsize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*outsize)
- requiredsize = 2*outsize;
- if (_PyUnicode_Resize(output, requiredsize) < 0)
- goto onError;
-@@ -1529,6 +1535,11 @@ int unicode_decode_call_errorhandler(con
- onError:
- Py_XDECREF(restuple);
- return res;
-+
-+ overflow:
-+ PyErr_SetString(PyExc_OverflowError,
-+ "decoded result is too long for a Python string");
-+ goto onError;
- }
-
- /* --- UTF-7 Codec -------------------------------------------------------- */
-@@ -3646,7 +3657,7 @@ static PyObject *unicode_encode_ucs1(con
- const Py_UNICODE *collstart = p;
- const Py_UNICODE *collend = p;
- /* find all unecodable characters */
-- while ((collend < endp) && ((*collend)>=limit))
-+ while ((collend < endp) && ((*collend) >= limit))
- ++collend;
- /* cache callback name lookup (if not done yet, i.e. it's the first error) */
- if (known_errorHandler==-1) {
-@@ -3666,34 +3677,41 @@ static PyObject *unicode_encode_ucs1(con
- raise_encode_exception(&exc, encoding, startp, size, collstart-startp, collend-startp, reason);
- goto onError;
- case 2: /* replace */
-- while (collstart++<collend)
-+ while (collstart++ < collend)
- *str++ = '?'; /* fall through */
- case 3: /* ignore */
- p = collend;
- break;
- case 4: /* xmlcharrefreplace */
-- respos = str-PyString_AS_STRING(res);
-+ respos = str - PyString_AS_STRING(res);
- /* determine replacement size (temporarily (mis)uses p) */
-- for (p = collstart, repsize = 0; p < collend;) {
-+ requiredsize = respos;
-+ for (p = collstart; p < collend;) {
- Py_UCS4 ch = _Py_UNICODE_NEXT(p, collend);
-+ Py_ssize_t incr;
- if (ch < 10)
-- repsize += 2+1+1;
-+ incr = 2+1+1;
- else if (ch < 100)
-- repsize += 2+2+1;
-+ incr = 2+2+1;
- else if (ch < 1000)
-- repsize += 2+3+1;
-+ incr = 2+3+1;
- else if (ch < 10000)
-- repsize += 2+4+1;
-+ incr = 2+4+1;
- else if (ch < 100000)
-- repsize += 2+5+1;
-+ incr = 2+5+1;
- else if (ch < 1000000)
-- repsize += 2+6+1;
-+ incr = 2+6+1;
- else
-- repsize += 2+7+1;
-- }
-- requiredsize = respos+repsize+(endp-collend);
-+ incr = 2+7+1;
-+ if (requiredsize > PY_SSIZE_T_MAX - incr)
-+ goto overflow;
-+ requiredsize += incr;
-+ }
-+ if (requiredsize > PY_SSIZE_T_MAX - (endp - collend))
-+ goto overflow;
-+ requiredsize += endp - collend;
- if (requiredsize > ressize) {
-- if (requiredsize<2*ressize)
-+ if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize)
- requiredsize = 2*ressize;
- if (_PyString_Resize(&res, requiredsize))
- goto onError;
-@@ -3716,11 +3734,16 @@ static PyObject *unicode_encode_ucs1(con
- /* need more space? (at least enough for what we have+the
- replacement+the rest of the string, so we won't have to
- check space for encodable characters) */
-- respos = str-PyString_AS_STRING(res);
-+ respos = str - PyString_AS_STRING(res);
- repsize = PyUnicode_GET_SIZE(repunicode);
-- requiredsize = respos+repsize+(endp-collend);
-+ if (respos > PY_SSIZE_T_MAX - repsize)
-+ goto overflow;
-+ requiredsize = respos + repsize;
-+ if (requiredsize > PY_SSIZE_T_MAX - (endp - collend))
-+ goto overflow;
-+ requiredsize += endp - collend;
- if (requiredsize > ressize) {
-- if (requiredsize<2*ressize)
-+ if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize)
- requiredsize = 2*ressize;
- if (_PyString_Resize(&res, requiredsize)) {
- Py_DECREF(repunicode);
-@@ -3731,7 +3754,7 @@ static PyObject *unicode_encode_ucs1(con
- }
- /* check if there is anything unencodable in the replacement
- and copy it to the output */
-- for (uni2 = PyUnicode_AS_UNICODE(repunicode);repsize-->0; ++uni2, ++str) {
-+ for (uni2 = PyUnicode_AS_UNICODE(repunicode); repsize-->0; ++uni2, ++str) {
- c = *uni2;
- if (c >= limit) {
- raise_encode_exception(&exc, encoding, startp, size,
-@@ -3747,14 +3770,18 @@ static PyObject *unicode_encode_ucs1(con
- }
- }
- /* Resize if we allocated to much */
-- respos = str-PyString_AS_STRING(res);
-- if (respos<ressize)
-+ respos = str - PyString_AS_STRING(res);
-+ if (respos < ressize)
- /* If this falls res will be NULL */
- _PyString_Resize(&res, respos);
- Py_XDECREF(errorHandler);
- Py_XDECREF(exc);
- return res;
-
-+ overflow:
-+ PyErr_SetString(PyExc_OverflowError,
-+ "encoded result is too long for a Python string");
-+
- onError:
- Py_XDECREF(res);
- Py_XDECREF(errorHandler);
diff --git a/lang/python27/patches/patch-Python_codecs.c b/lang/python27/patches/patch-Python_codecs.c
deleted file mode 100644
index f999d99432c..00000000000
--- a/lang/python27/patches/patch-Python_codecs.c
+++ /dev/null
@@ -1,50 +0,0 @@
-$NetBSD: patch-Python_codecs.c,v 1.1 2014/11/02 13:31:11 spz Exp $
-
-taken from https://hg.python.org/cpython/rev/3f7519f633ed and
-https://hg.python.org/cpython/rev/d1be1f355f59:
-
-Issue #22518: Fixed integer overflow issues in "backslashreplace"
-and "xmlcharrefreplace" error handlers.
-
---- Python/codecs.c.orig 2014-06-30 02:05:46.000000000 +0000
-+++ Python/codecs.c
-@@ -558,7 +558,7 @@ PyObject *PyCodec_XMLCharRefReplaceError
- Py_UNICODE *startp;
- Py_UNICODE *e;
- Py_UNICODE *outp;
-- int ressize;
-+ Py_ssize_t ressize;
- if (PyUnicodeEncodeError_GetStart(exc, &start))
- return NULL;
- if (PyUnicodeEncodeError_GetEnd(exc, &end))
-@@ -566,6 +566,13 @@ PyObject *PyCodec_XMLCharRefReplaceError
- if (!(object = PyUnicodeEncodeError_GetObject(exc)))
- return NULL;
- startp = PyUnicode_AS_UNICODE(object);
-+ if (end - start > PY_SSIZE_T_MAX / (2+7+1)) {
-+ end = start + PY_SSIZE_T_MAX / (2+7+1);
-+#ifndef Py_UNICODE_WIDE
-+ if (0xD800 <= startp[end - 1] && startp[end - 1] <= 0xDBFF)
-+ end--;
-+#endif
-+ }
- e = startp + end;
- for (p = startp+start, ressize = 0; p < e;) {
- Py_UCS4 ch = *p++;
-@@ -675,13 +682,15 @@ PyObject *PyCodec_BackslashReplaceErrors
- Py_UNICODE *p;
- Py_UNICODE *startp;
- Py_UNICODE *outp;
-- int ressize;
-+ Py_ssize_t ressize;
- if (PyUnicodeEncodeError_GetStart(exc, &start))
- return NULL;
- if (PyUnicodeEncodeError_GetEnd(exc, &end))
- return NULL;
- if (!(object = PyUnicodeEncodeError_GetObject(exc)))
- return NULL;
-+ if (end - start > PY_SSIZE_T_MAX / (1+1+8))
-+ end = start + PY_SSIZE_T_MAX / (1+1+8);
- startp = PyUnicode_AS_UNICODE(object);
- for (p = startp+start, ressize = 0; p < startp+end; ++p) {
- #ifdef Py_UNICODE_WIDE