diff --git a/Doc/Makefile b/Doc/Makefile index 2b2fd14315f..be05d4b1d9b 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -9,7 +9,7 @@ SVNROOT = http://svn.python.org/projects SPHINXOPTS = PAPER = SOURCES = -DISTVERSION = +DISTVERSION = $(shell $(PYTHON) tools/sphinxext/patchlevel.py) ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) @@ -111,33 +111,33 @@ dist: # archive the HTML make html - cp -pPR build/html dist/python$(DISTVERSION)-docs-html - tar -C dist -cf dist/python$(DISTVERSION)-docs-html.tar python$(DISTVERSION)-docs-html - bzip2 -9 -k dist/python$(DISTVERSION)-docs-html.tar - (cd dist; zip -q -r -9 python$(DISTVERSION)-docs-html.zip python$(DISTVERSION)-docs-html) - rm -r dist/python$(DISTVERSION)-docs-html - rm dist/python$(DISTVERSION)-docs-html.tar + cp -pPR build/html dist/python-$(DISTVERSION)-docs-html + tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html + bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar + (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) + rm -r dist/python-$(DISTVERSION)-docs-html + rm dist/python-$(DISTVERSION)-docs-html.tar # archive the text build make text - cp -pPR build/text dist/python$(DISTVERSION)-docs-text - tar -C dist -cf dist/python$(DISTVERSION)-docs-text.tar python$(DISTVERSION)-docs-text - bzip2 -9 -k dist/python$(DISTVERSION)-docs-text.tar - (cd dist; zip -q -r -9 python$(DISTVERSION)-docs-text.zip python$(DISTVERSION)-docs-text) - rm -r dist/python$(DISTVERSION)-docs-text - rm dist/python$(DISTVERSION)-docs-text.tar + cp -pPR build/text dist/python-$(DISTVERSION)-docs-text + tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text + bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar + (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text) + rm -r dist/python-$(DISTVERSION)-docs-text + rm dist/python-$(DISTVERSION)-docs-text.tar # archive the A4 latex -rm -r build/latex make latex PAPER=a4 (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) - cp build/latex/docs-pdf.zip dist/python$(DISTVERSION)-docs-pdf-a4.zip - cp build/latex/docs-pdf.tar.bz2 dist/python$(DISTVERSION)-docs-pdf-a4.tar.bz2 + cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip + cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2 # archive the letter latex rm -r build/latex make latex PAPER=letter (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) - cp build/latex/docs-pdf.zip dist/python$(DISTVERSION)-docs-pdf-letter.zip - cp build/latex/docs-pdf.tar.bz2 dist/python$(DISTVERSION)-docs-pdf-letter.tar.bz2 + cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip + cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2 diff --git a/Doc/README.txt b/Doc/README.txt index 00f21b83cb7..4527930082e 100644 --- a/Doc/README.txt +++ b/Doc/README.txt @@ -74,7 +74,7 @@ Without make You'll need to checkout the Sphinx package to the `tools/` directory:: - http://svn.python.org/projects/doctools/trunk/sphinx tools/sphinx + svn co http://svn.python.org/projects/doctools/trunk/sphinx tools/sphinx Then, you need to install Docutils, either by checking it out via :: diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 120c2810848..5dc28af062f 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -297,8 +297,8 @@ inside nested parentheses. They are: ``;`` The list of format units ends here; the string after the semicolon is used as - the error message *instead* of the default error message. Clearly, ``:`` and - ``;`` mutually exclude each other. + the error message *instead* of the default error message. ``:`` and ``;`` + mutually exclude each other. Note that any Python object references which are provided to the caller are *borrowed* references; do not decrement their reference count! diff --git a/Doc/tools/sphinxext/download.html b/Doc/tools/sphinxext/download.html index 82ee2517912..1d17599db8a 100644 --- a/Doc/tools/sphinxext/download.html +++ b/Doc/tools/sphinxext/download.html @@ -19,20 +19,20 @@ in the table are the size of the download files in megabytes.

- - + + - - + + - - + + - +
FormatPacked as .zipPacked as .tar.bz2
PDF (US-Letter paper size)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 8 MB)
PDF (A4 paper size)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 8 MB)
HTMLDownload (ca. 6 MB)Download (ca. 4 MB)Download (ca. 6 MB)Download (ca. 4 MB)
Plain Text Download (ca. 2 MB)Download (ca. 1.5 MB)Download (ca. 1.5 MB)
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index f57e9e9780a..afc19e973ee 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -169,42 +169,20 @@ required syntactically but the program requires no action. For example:: ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ... -This is commonly used for creating minimal classes such as exceptions, or -for ignoring unwanted exceptions:: +This is commonly used for creating minimal classes:: - >>> class ParserError(Exception): + >>> class MyEmptyClass: ... pass - ... - >>> try: - ... import audioop - ... except ImportError: - ... pass - ... + ... Another place :keyword:`pass` can be used is as a place-holder for a function or -conditional body when you are working on new code, allowing you to keep -thinking at a more abstract level. However, as :keyword:`pass` is silently -ignored, a better choice may be to raise a :exc:`NotImplementedError` -exception:: +conditional body when you are working on new code, allowing you to keep thinking +at a more abstract level. The :keyword:`pass` is silently ignored:: >>> def initlog(*args): - ... raise NotImplementedError # Open logfile if not already open - ... if not logfp: - ... raise NotImplementedError # Set up dummy log back-end - ... raise NotImplementedError('Call log initialization handler') + ... pass # Remember to implement this! ... -If :keyword:`pass` were used here and you later ran tests, they may fail -without indicating why. Using :exc:`NotImplementedError` causes this code -to raise an exception, telling you exactly where the incomplete code -is. Note the two calling styles of the exceptions above. -The first style, with no message but with an accompanying comment, -lets you easily leave the comment when you remove the exception, -which ideally would be a good description for -the block of code the exception is a placeholder for. However, the -third example, providing a message for the exception, will produce -a more useful traceback. - .. _tut-functions: Defining Functions diff --git a/Doc/using/unix.rst b/Doc/using/unix.rst index 69b76c6c811..2ab5ee1494a 100644 --- a/Doc/using/unix.rst +++ b/Doc/using/unix.rst @@ -140,8 +140,8 @@ Editors Vim and Emacs are excellent editors which support Python very well. For more information on how to code in python in these editors, look at: -http://www.vim.org/scripts/script.php?script_id=790 -http://sourceforge.net/projects/python-mode +* http://www.vim.org/scripts/script.php?script_id=790 +* http://sourceforge.net/projects/python-mode Geany is an excellent IDE with support for a lot of languages. For more information, read: http://geany.uvena.de/ diff --git a/Lib/io.py b/Lib/io.py index 7f938987b71..320a4b9b5f2 100644 --- a/Lib/io.py +++ b/Lib/io.py @@ -1167,7 +1167,7 @@ class BufferedRWPair(BufferedIOBase): @property def closed(self): - return self.writer.closed() + return self.writer.closed class BufferedRandom(BufferedWriter, BufferedReader): diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index bf25245bd1a..bd0a3a4813a 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -480,8 +480,8 @@ class AbstractPickleTests(unittest.TestCase): if have_unicode: def test_unicode(self): - endcases = [u'', u'<\\u>', u'<\\\\u1234>', u'<\n>', - u'<\\>', u'<\\\\U00012345>'] + endcases = [u'', u'<\\u>', u'<\\\u1234>', u'<\n>', + u'<\\>', u'<\\\U00012345>'] for proto in protocols: for u in endcases: p = self.dumps(u, proto) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 2efbc7d6772..2c4c2fdc9f1 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -7,7 +7,7 @@ import unittest from test import test_support from weakref import proxy import array, cStringIO -from cPickle import loads, dumps +from cPickle import loads, dumps, HIGHEST_PROTOCOL class ArraySubclass(array.array): pass @@ -97,7 +97,7 @@ class BaseTest(unittest.TestCase): self.assertEqual(a, b) def test_pickle(self): - for protocol in (0, 1, 2): + for protocol in range(HIGHEST_PROTOCOL + 1): a = array.array(self.typecode, self.example) b = loads(dumps(a, protocol)) self.assertNotEqual(id(a), id(b)) @@ -112,7 +112,7 @@ class BaseTest(unittest.TestCase): self.assertEqual(type(a), type(b)) def test_pickle_for_empty_array(self): - for protocol in (0, 1, 2): + for protocol in range(HIGHEST_PROTOCOL + 1): a = array.array(self.typecode) b = loads(dumps(a, protocol)) self.assertNotEqual(id(a), id(b)) diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index 0b751d865cf..0f0d09847e6 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -373,7 +373,7 @@ class TestBasic(unittest.TestCase): def test_pickle(self): d = deque(xrange(200)) - for i in (0, 1, 2): + for i in range(pickle.HIGHEST_PROTOCOL + 1): s = pickle.dumps(d, i) e = pickle.loads(s) self.assertNotEqual(id(d), id(e)) @@ -382,7 +382,7 @@ class TestBasic(unittest.TestCase): ## def test_pickle_recursive(self): ## d = deque('abc') ## d.append(d) -## for i in (0, 1, 2): +## for i in range(pickle.HIGHEST_PROTOCOL + 1): ## e = pickle.loads(pickle.dumps(d, i)) ## self.assertNotEqual(id(d), id(e)) ## self.assertEqual(id(e), id(e[-1])) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 8a7da60947b..967018ea453 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -554,8 +554,9 @@ class BufferedRWPairTest(unittest.TestCase): r = MockRawIO(()) w = MockRawIO() pair = io.BufferedRWPair(r, w) + self.assertFalse(pair.closed) - # XXX need implementation + # XXX More Tests class BufferedRandomTest(unittest.TestCase): diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 499406f3c26..d38a6759075 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -221,7 +221,7 @@ class TestJointOps(unittest.TestCase): self.failIf(set('cbs').issuperset('a')) def test_pickling(self): - for i in (0, 1, 2): + for i in range(pickle.HIGHEST_PROTOCOL + 1): p = pickle.dumps(self.s, i) dup = pickle.loads(p) self.assertEqual(self.s, dup, "%s != %s" % (self.s, dup)) diff --git a/Misc/NEWS b/Misc/NEWS index 5360bdd4234..b75ddf9034c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -123,6 +123,11 @@ Library - Issue #4400: .pypirc default generated file was broken in distutils. +- Issue #4736: io.BufferedRWPair's closed property now functions properly. + +- Issue #3954: Fix a potential SystemError in _hotshot.logreader error + handling. + - Issue #4163: Use unicode-friendly word splitting in the textwrap functions when given an unicode string. @@ -200,6 +205,8 @@ Build C-API ----- +- Issue #4720: The format for PyArg_ParseTupleAndKeywords can begin with '|'. + - Issue #3632: from the gdb debugger, the 'pyo' macro can now be called when the GIL is released, or owned by another thread. diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index adb04c0bb87..d640c39131a 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -474,6 +474,8 @@ test_k_code(PyObject *self) #ifdef Py_USING_UNICODE +static volatile int x; + /* Test the u and u# codes for PyArg_ParseTuple. May leak memory in case of an error. */ @@ -486,7 +488,7 @@ test_u_code(PyObject *self) /* issue4122: Undefined reference to _Py_ascii_whitespace on Windows */ /* Just use the macro and check that it compiles */ - int x = Py_UNICODE_ISSPACE(25); + x = Py_UNICODE_ISSPACE(25); tuple = PyTuple_New(1); if (tuple == NULL) @@ -518,6 +520,32 @@ test_u_code(PyObject *self) return Py_None; } +static PyObject * +test_empty_argparse(PyObject *self) +{ + /* Test that formats can begin with '|'. See issue #4720. */ + PyObject *tuple, *dict = NULL; + static char *kwlist[] = {NULL}; + int result; + tuple = PyTuple_New(0); + if (!tuple) + return NULL; + if ((result = PyArg_ParseTuple(tuple, "|:test_empty_argparse")) < 0) + goto done; + dict = PyDict_New(); + if (!dict) + goto done; + result = PyArg_ParseTupleAndKeywords(tuple, dict, "|:test_empty_argparse", kwlist); + done: + Py_DECREF(tuple); + Py_XDECREF(dict); + if (result < 0) + return NULL; + else { + Py_RETURN_NONE; + } +} + static PyObject * codec_incrementalencoder(PyObject *self, PyObject *args) { @@ -780,6 +808,7 @@ static PyMethodDef TestMethods[] = { {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_long_numbits", (PyCFunction)test_long_numbits, METH_NOARGS}, {"test_k_code", (PyCFunction)test_k_code, METH_NOARGS}, + {"test_empty_argparse", (PyCFunction)test_empty_argparse,METH_NOARGS}, {"test_null_strings", (PyCFunction)test_null_strings, METH_NOARGS}, {"test_string_from_format", (PyCFunction)test_string_from_format, METH_NOARGS}, {"test_with_docstring", (PyCFunction)test_with_docstring, METH_NOARGS, diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ba148430f1b..9615d432274 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -386,7 +386,8 @@ void unicode_dealloc(register PyUnicodeObject *unicode) } } -int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) +static +int _PyUnicode_Resize(PyUnicodeObject **unicode, Py_ssize_t length) { register PyUnicodeObject *v; @@ -395,7 +396,7 @@ int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) PyErr_BadInternalCall(); return -1; } - v = (PyUnicodeObject *)*unicode; + v = *unicode; if (v == NULL || !PyUnicode_Check(v) || Py_REFCNT(v) != 1 || length < 0) { PyErr_BadInternalCall(); return -1; @@ -412,7 +413,7 @@ int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) Py_UNICODE_COPY(w->str, v->str, length < v->length ? length : v->length); Py_DECREF(*unicode); - *unicode = (PyObject *)w; + *unicode = w; return 0; } @@ -421,9 +422,10 @@ int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) return unicode_resize(v, length); } -/* Internal API for use in unicodeobject.c only ! */ -#define _PyUnicode_Resize(unicodevar, length) \ - PyUnicode_Resize(((PyObject **)(unicodevar)), length) +int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) +{ + return _PyUnicode_Resize((PyUnicodeObject **)unicode, length); +} PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size) @@ -937,7 +939,7 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) PyObject_Free(callresults); if (abuffer) PyObject_Free(abuffer); - _PyUnicode_Resize(&string, s - PyUnicode_AS_UNICODE(string)); + PyUnicode_Resize(&string, s - PyUnicode_AS_UNICODE(string)); return string; fail: if (callresults) { @@ -1345,7 +1347,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler const char *encoding, const char *reason, const char *input, Py_ssize_t insize, Py_ssize_t *startinpos, Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr, - PyObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) + PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) { static char *argparse = "O!n;decoding error handler must return (unicode, int) tuple"; @@ -1405,7 +1407,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler if (requiredsize > outsize) { if (requiredsize<2*outsize) requiredsize = 2*outsize; - if (PyUnicode_Resize(output, requiredsize) < 0) + if (_PyUnicode_Resize(output, requiredsize) < 0) goto onError; *outptr = PyUnicode_AS_UNICODE(*output) + *outpos; } @@ -1604,7 +1606,7 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, errors, &errorHandler, "utf7", errmsg, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&unicode, &outpos, &p)) + &unicode, &outpos, &p)) goto onError; } @@ -1615,7 +1617,7 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, errors, &errorHandler, "utf7", "unterminated shift sequence", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&unicode, &outpos, &p)) + &unicode, &outpos, &p)) goto onError; if (s < e) goto restart; @@ -1942,7 +1944,7 @@ PyObject *PyUnicode_DecodeUTF8Stateful(const char *s, errors, &errorHandler, "utf8", errmsg, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&unicode, &outpos, &p)) + &unicode, &outpos, &p)) goto onError; } if (consumed) @@ -2222,7 +2224,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s, errors, &errorHandler, "utf32", errmsg, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&unicode, &outpos, &p)) + &unicode, &outpos, &p)) goto onError; } @@ -2496,7 +2498,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s, errors, &errorHandler, "utf16", errmsg, starts, size, &startinpos, &endinpos, &exc, (const char **)&q, - (PyObject **)&unicode, &outpos, &p)) + &unicode, &outpos, &p)) goto onError; } @@ -2717,7 +2719,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, errors, &errorHandler, "unicodeescape", "end of string in escape sequence", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; goto nextByte; } @@ -2729,7 +2731,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, errors, &errorHandler, "unicodeescape", message, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; goto nextByte; } @@ -2768,7 +2770,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, errors, &errorHandler, "unicodeescape", "illegal Unicode character", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; } break; @@ -2810,7 +2812,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, errors, &errorHandler, "unicodeescape", message, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; break; @@ -2824,7 +2826,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, errors, &errorHandler, "unicodeescape", message, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; } else { @@ -3113,7 +3115,7 @@ PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s, errors, &errorHandler, "rawunicodeescape", "truncated \\uXXXX", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; goto nextByte; } @@ -3145,7 +3147,7 @@ PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s, errors, &errorHandler, "rawunicodeescape", "\\Uxxxxxxxx out of range", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; } nextByte: @@ -3315,7 +3317,7 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s, errors, &errorHandler, "unicode_internal", reason, starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) { + &v, &outpos, &p)) { goto onError; } } @@ -3695,7 +3697,7 @@ PyObject *PyUnicode_DecodeASCII(const char *s, errors, &errorHandler, "ascii", "ordinal not in range(128)", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) + &v, &outpos, &p)) goto onError; } } @@ -3996,7 +3998,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, errors, &errorHandler, "charmap", "character maps to ", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) { + &v, &outpos, &p)) { goto onError; } continue; @@ -4046,7 +4048,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, errors, &errorHandler, "charmap", "character maps to ", starts, size, &startinpos, &endinpos, &exc, &s, - (PyObject **)&v, &outpos, &p)) { + &v, &outpos, &p)) { Py_DECREF(x); goto onError; } @@ -4797,7 +4799,7 @@ int charmaptranslate_makespace(PyObject **outobj, Py_UNICODE **outp, /* exponentially overallocate to minimize reallocations */ if (requiredsize < 2 * oldsize) requiredsize = 2 * oldsize; - if (_PyUnicode_Resize(outobj, requiredsize) < 0) + if (PyUnicode_Resize(outobj, requiredsize) < 0) return -1; *outp = PyUnicode_AS_UNICODE(*outobj) + outpos; } @@ -4976,7 +4978,7 @@ PyObject *PyUnicode_TranslateCharmap(const Py_UNICODE *p, /* Resize if we allocated to much */ respos = str-PyUnicode_AS_UNICODE(res); if (respos