]> granicus.if.org Git - python/commitdiff
Merged revisions 67898,67904-67907,67912,67918,67920-67921,67923-67924,67927,67930...
authorBenjamin Peterson <benjamin@python.org>
Sat, 27 Dec 2008 17:05:29 +0000 (17:05 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 27 Dec 2008 17:05:29 +0000 (17:05 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67898 | benjamin.peterson | 2008-12-21 15:00:53 -0600 (Sun, 21 Dec 2008) | 1 line

  compute DISTVERSION with patchlevel.py
........
  r67904 | benjamin.peterson | 2008-12-22 14:44:58 -0600 (Mon, 22 Dec 2008) | 1 line

  less attitude
........
  r67905 | benjamin.peterson | 2008-12-22 14:51:15 -0600 (Mon, 22 Dec 2008) | 1 line

  fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|'
........
  r67906 | benjamin.peterson | 2008-12-22 14:52:53 -0600 (Mon, 22 Dec 2008) | 1 line

  add NEWS note
........
  r67907 | benjamin.peterson | 2008-12-22 16:12:19 -0600 (Mon, 22 Dec 2008) | 1 line

  silence compiler warning
........
  r67912 | georg.brandl | 2008-12-23 06:37:21 -0600 (Tue, 23 Dec 2008) | 2 lines

  Fix missing "svn" command.
........
  r67918 | georg.brandl | 2008-12-23 09:44:25 -0600 (Tue, 23 Dec 2008) | 2 lines

  Markup fix.
........
  r67920 | benjamin.peterson | 2008-12-23 14:09:28 -0600 (Tue, 23 Dec 2008) | 1 line

  use a global variable, so the compiler doesn't optimize the assignment out
........
  r67921 | benjamin.peterson | 2008-12-23 14:12:33 -0600 (Tue, 23 Dec 2008) | 1 line

  make global static
........
  r67923 | benjamin.peterson | 2008-12-24 09:10:27 -0600 (Wed, 24 Dec 2008) | 1 line

  #4736 BufferRWPair.closed shouldn't try to call another property as a function
........
  r67924 | benjamin.peterson | 2008-12-24 10:10:05 -0600 (Wed, 24 Dec 2008) | 1 line

  pretend exceptions don't exist a while longer
........
  r67927 | benjamin.peterson | 2008-12-26 17:26:30 -0600 (Fri, 26 Dec 2008) | 1 line

  python version is included in file name now
........
  r67930 | hirokazu.yamamoto | 2008-12-26 22:19:48 -0600 (Fri, 26 Dec 2008) | 2 lines

  Issue #4740: Use HIGHEST_PROTOCOL in pickle test.
  (There is no behavior difference in 2.x because HIGHEST_PROTOCOL == 2)
........
  r67932 | alexandre.vassalotti | 2008-12-27 00:36:10 -0600 (Sat, 27 Dec 2008) | 5 lines

  Remove unnecessary casts related to unicode_decode_call_errorhandler.
  Make the _PyUnicode_Resize macro a static function.

  These changes are needed to avoid breaking strict aliasing rules.
........
  r67943 | alexandre.vassalotti | 2008-12-27 04:02:59 -0600 (Sat, 27 Dec 2008) | 2 lines

  Fix bogus unicode tests in pickletester.
........

16 files changed:
Doc/Makefile
Doc/README.txt
Doc/c-api/arg.rst
Doc/tools/sphinxext/download.html
Doc/tutorial/controlflow.rst
Doc/using/unix.rst
Lib/io.py
Lib/test/pickletester.py
Lib/test/test_array.py
Lib/test/test_deque.py
Lib/test/test_io.py
Lib/test/test_set.py
Misc/NEWS
Modules/_testcapimodule.c
Objects/unicodeobject.c
Python/getargs.c

index 2b2fd14315f24019cd99e1d03ac70e284144f2c5..be05d4b1d9bfd293b6300976a1a7575d407e4bfa 100644 (file)
@@ -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
 
index 00f21b83cb7be3e4bbe31429aa70b25eabc9a72a..4527930082e580175a35499e287b98e2a3ffe7fc 100644 (file)
@@ -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 ::
 
index 120c2810848fb8e4954313422c3564185516ce9b..5dc28af062f1bbf56940b06dfcae47009f6d8c5f 100644 (file)
@@ -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!
index 82ee2517912342f660ac0d9e39149b55021d1820..1d17599db8a37de3e1eea609ce4bad876423f1ab 100644 (file)
@@ -19,20 +19,20 @@ in the table are the size of the download files in megabytes.</p>
 <table class="docutils">
   <tr><th>Format</th><th>Packed as .zip</th><th>Packed as .tar.bz2</th></tr>
   <tr><td>PDF (US-Letter paper size)</td>
-    <td><a href="{{ dlbase }}/python-docs-pdf-letter.zip">Download</a> (ca. 8 MB)</td>
-    <td><a href="{{ dlbase }}/python-docs-pdf-letter.tar.bz2">Download</a> (ca. 8 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.zip">Download</a> (ca. 8 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.tar.bz2">Download</a> (ca. 8 MB)</td>
   </tr>
   <tr><td>PDF (A4 paper size)</td>
-    <td><a href="{{ dlbase }}/python-docs-pdf-a4.zip">Download</a> (ca. 8 MB)</td>
-    <td><a href="{{ dlbase }}/python-docs-pdf-a4.tar.bz2">Download</a> (ca. 8 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.zip">Download</a> (ca. 8 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.tar.bz2">Download</a> (ca. 8 MB)</td>
   </tr>
   <tr><td>HTML</td>
-    <td><a href="{{ dlbase }}/python-docs-html.zip">Download</a> (ca. 6 MB)</td>
-    <td><a href="{{ dlbase }}/python-docs-html.tar.bz2">Download</a> (ca. 4 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.zip">Download</a> (ca. 6 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.tar.bz2">Download</a> (ca. 4 MB)</td>
   </tr>
   <tr><td>Plain Text</td>
     <td><a href="{{ dlbase }}/python-docs-text.zip">Download</a> (ca. 2 MB)</td>
-    <td><a href="{{ dlbase }}/python-docs-text.tar.bz2">Download</a> (ca. 1.5 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.tar.bz2">Download</a> (ca. 1.5 MB)</td>
   </tr>
 </table>
 
index f57e9e9780ad09d27a549cee9a248f92b2aa6e9a..afc19e973eef4703f8ae40e7b899fe1caa43ae29 100644 (file)
@@ -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
index 69b76c6c811f42a6b8d07a8f4de0076ab18eb17f..2ab5ee1494afead7c1a97c7b5c6942eb7d851d02 100644 (file)
@@ -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/
index 7f938987b71243e3dae55a0539249c8bd2e5df89..320a4b9b5f23fc79da2b93e7d04d5898ddf85faa 100644 (file)
--- 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):
index bf25245bd1a0b41c85c4a258b2262148faabcc32..bd0a3a4813a5f7b525f6d16c3a8cfa87e3e6e148 100644 (file)
@@ -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)
index 2efbc7d6772f8aeb590b5b23e893834cd2e6672b..2c4c2fdc9f10fe849d2a3d34a023c8be1a97ef89 100755 (executable)
@@ -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))
index 0b751d865cf59068c6ea7ff56504cbc89c593274..0f0d09847e60233d48be1a75a86c4a00cff61ab3 100644 (file)
@@ -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]))
index 8a7da60947b037a37cc56a6a409a63433873315f..967018ea453a0372641ee5f50f69292ff828c9d2 100644 (file)
@@ -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):
index 499406f3c266db6eeb4974ff49532960bd717517..d38a6759075fdc1c7f066c7fa2fd84b4e833885c 100644 (file)
@@ -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))
index 5360bdd4234eceb8664062c98ffb237a1985d2a2..b75ddf9034c21270117c48652c239a2f3dcd3161 100644 (file)
--- 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.
 
index adb04c0bb8757366fdcacc9e4306c48a83e72b4f..d640c39131a8d5be89c59fa0131007ceaecdff6d 100644 (file)
@@ -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,
index ba148430f1bbd9321bb8b8978a210dc7500e32a9..9615d432274f5f4d0f0a3b939b9e9629c6aa9c9a 100644 (file)
@@ -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 <undefined>",
                     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 <undefined>",
                     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<PyUnicode_GET_SIZE(res)) {
-       if (_PyUnicode_Resize(&res, respos) < 0)
+       if (PyUnicode_Resize(&res, respos) < 0)
            goto onError;
     }
     Py_XDECREF(exc);
index 9d1f0b218ba5ce2211bf3dc5a1024b287476e42e..544948b928510c605e1fe37298990fb442d010f2 100644 (file)
@@ -1601,7 +1601,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
                }
        }
 
-       if (!IS_END_OF_FORMAT(*format)) {
+       if (!IS_END_OF_FORMAT(*format) && *format != '|') {
                PyErr_Format(PyExc_RuntimeError,
                        "more argument specifiers than keyword list entries "
                        "(remaining format:'%s')", format);