[Python-checkins] r67951 - in python/branches/release26-maint: 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

benjamin.peterson python-checkins at python.org
Sat Dec 27 18:05:30 CET 2008


Author: benjamin.peterson
Date: Sat Dec 27 18:05:29 2008
New Revision: 67951
Log:
Merged revisions 67898,67904-67907,67912,67918,67920-67921,67923-67924,67927,67930,67932,67943 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk
........
 r67898 | benjamin.peterson | 2008年12月21日 15:00:53 -0600 (2008年12月21日) | 1 line
 
 compute DISTVERSION with patchlevel.py
........
 r67904 | benjamin.peterson | 2008年12月22日 14:44:58 -0600 (2008年12月22日) | 1 line
 
 less attitude
........
 r67905 | benjamin.peterson | 2008年12月22日 14:51:15 -0600 (2008年12月22日) | 1 line
 
 fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|'
........
 r67906 | benjamin.peterson | 2008年12月22日 14:52:53 -0600 (2008年12月22日) | 1 line
 
 add NEWS note
........
 r67907 | benjamin.peterson | 2008年12月22日 16:12:19 -0600 (2008年12月22日) | 1 line
 
 silence compiler warning
........
 r67912 | georg.brandl | 2008年12月23日 06:37:21 -0600 (2008年12月23日) | 2 lines
 
 Fix missing "svn" command.
........
 r67918 | georg.brandl | 2008年12月23日 09:44:25 -0600 (2008年12月23日) | 2 lines
 
 Markup fix.
........
 r67920 | benjamin.peterson | 2008年12月23日 14:09:28 -0600 (2008年12月23日) | 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 (2008年12月23日) | 1 line
 
 make global static
........
 r67923 | benjamin.peterson | 2008年12月24日 09:10:27 -0600 (2008年12月24日) | 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 (2008年12月24日) | 1 line
 
 pretend exceptions don't exist a while longer
........
 r67927 | benjamin.peterson | 2008年12月26日 17:26:30 -0600 (2008年12月26日) | 1 line
 
 python version is included in file name now
........
 r67930 | hirokazu.yamamoto | 2008年12月26日 22:19:48 -0600 (2008年12月26日) | 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 (2008年12月27日) | 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 (2008年12月27日) | 2 lines
 
 Fix bogus unicode tests in pickletester.
........
Modified:
 python/branches/release26-maint/ (props changed)
 python/branches/release26-maint/Doc/Makefile
 python/branches/release26-maint/Doc/README.txt
 python/branches/release26-maint/Doc/c-api/arg.rst
 python/branches/release26-maint/Doc/tools/sphinxext/download.html
 python/branches/release26-maint/Doc/tutorial/controlflow.rst
 python/branches/release26-maint/Doc/using/unix.rst
 python/branches/release26-maint/Lib/io.py
 python/branches/release26-maint/Lib/test/pickletester.py
 python/branches/release26-maint/Lib/test/test_array.py
 python/branches/release26-maint/Lib/test/test_deque.py
 python/branches/release26-maint/Lib/test/test_io.py
 python/branches/release26-maint/Lib/test/test_set.py
 python/branches/release26-maint/Misc/NEWS
 python/branches/release26-maint/Modules/_testcapimodule.c
 python/branches/release26-maint/Objects/unicodeobject.c
 python/branches/release26-maint/Python/getargs.c
Modified: python/branches/release26-maint/Doc/Makefile
==============================================================================
--- python/branches/release26-maint/Doc/Makefile	(original)
+++ python/branches/release26-maint/Doc/Makefile	Sat Dec 27 18:05:29 2008
@@ -9,7 +9,7 @@
 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 @@
 
 	# 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
 
Modified: python/branches/release26-maint/Doc/README.txt
==============================================================================
--- python/branches/release26-maint/Doc/README.txt	(original)
+++ python/branches/release26-maint/Doc/README.txt	Sat Dec 27 18:05:29 2008
@@ -74,7 +74,7 @@
 
 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 ::
 
Modified: python/branches/release26-maint/Doc/c-api/arg.rst
==============================================================================
--- python/branches/release26-maint/Doc/c-api/arg.rst	(original)
+++ python/branches/release26-maint/Doc/c-api/arg.rst	Sat Dec 27 18:05:29 2008
@@ -297,8 +297,8 @@
 
 ``;``
 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!
Modified: python/branches/release26-maint/Doc/tools/sphinxext/download.html
==============================================================================
--- python/branches/release26-maint/Doc/tools/sphinxext/download.html	(original)
+++ python/branches/release26-maint/Doc/tools/sphinxext/download.html	Sat Dec 27 18:05:29 2008
@@ -19,20 +19,20 @@
 <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>
 
Modified: python/branches/release26-maint/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/release26-maint/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/release26-maint/Doc/tutorial/controlflow.rst	Sat Dec 27 18:05:29 2008
@@ -169,42 +169,20 @@
 ... 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
Modified: python/branches/release26-maint/Doc/using/unix.rst
==============================================================================
--- python/branches/release26-maint/Doc/using/unix.rst	(original)
+++ python/branches/release26-maint/Doc/using/unix.rst	Sat Dec 27 18:05:29 2008
@@ -140,8 +140,8 @@
 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/
Modified: python/branches/release26-maint/Lib/io.py
==============================================================================
--- python/branches/release26-maint/Lib/io.py	(original)
+++ python/branches/release26-maint/Lib/io.py	Sat Dec 27 18:05:29 2008
@@ -1167,7 +1167,7 @@
 
 @property
 def closed(self):
- return self.writer.closed()
+ return self.writer.closed
 
 
 class BufferedRandom(BufferedWriter, BufferedReader):
Modified: python/branches/release26-maint/Lib/test/pickletester.py
==============================================================================
--- python/branches/release26-maint/Lib/test/pickletester.py	(original)
+++ python/branches/release26-maint/Lib/test/pickletester.py	Sat Dec 27 18:05:29 2008
@@ -480,8 +480,8 @@
 
 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)
Modified: python/branches/release26-maint/Lib/test/test_array.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_array.py	(original)
+++ python/branches/release26-maint/Lib/test/test_array.py	Sat Dec 27 18:05:29 2008
@@ -7,7 +7,7 @@
 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 @@
 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 @@
 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))
Modified: python/branches/release26-maint/Lib/test/test_deque.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_deque.py	(original)
+++ python/branches/release26-maint/Lib/test/test_deque.py	Sat Dec 27 18:05:29 2008
@@ -373,7 +373,7 @@
 
 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 @@
 ## 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]))
Modified: python/branches/release26-maint/Lib/test/test_io.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_io.py	(original)
+++ python/branches/release26-maint/Lib/test/test_io.py	Sat Dec 27 18:05:29 2008
@@ -554,8 +554,9 @@
 r = MockRawIO(())
 w = MockRawIO()
 pair = io.BufferedRWPair(r, w)
+ self.assertFalse(pair.closed)
 
- # XXX need implementation
+ # XXX More Tests
 
 
 class BufferedRandomTest(unittest.TestCase):
Modified: python/branches/release26-maint/Lib/test/test_set.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_set.py	(original)
+++ python/branches/release26-maint/Lib/test/test_set.py	Sat Dec 27 18:05:29 2008
@@ -221,7 +221,7 @@
 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))
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS	(original)
+++ python/branches/release26-maint/Misc/NEWS	Sat Dec 27 18:05:29 2008
@@ -123,6 +123,11 @@
 
 - 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 @@
 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.
 
Modified: python/branches/release26-maint/Modules/_testcapimodule.c
==============================================================================
--- python/branches/release26-maint/Modules/_testcapimodule.c	(original)
+++ python/branches/release26-maint/Modules/_testcapimodule.c	Sat Dec 27 18:05:29 2008
@@ -474,6 +474,8 @@
 
 #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 @@
 
 	/* 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)
@@ -519,6 +521,32 @@
 }
 
 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)
 {
 	const char *encoding, *errors = NULL;
@@ -780,6 +808,7 @@
 	{"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,
Modified: python/branches/release26-maint/Objects/unicodeobject.c
==============================================================================
--- python/branches/release26-maint/Objects/unicodeobject.c	(original)
+++ python/branches/release26-maint/Objects/unicodeobject.c	Sat Dec 27 18:05:29 2008
@@ -386,7 +386,8 @@
 }
 }
 
-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 @@
 	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 @@
 	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 @@
 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 @@
 		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 @@
 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 @@
 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 @@
 errors, &errorHandler,
 "utf7", errmsg,
 starts, size, &startinpos, &endinpos, &exc, &s,
- (PyObject **)&unicode, &outpos, &p))
+ &unicode, &outpos, &p))
 goto onError;
 }
 
@@ -1615,7 +1617,7 @@
 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 @@
 	 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 @@
 errors, &errorHandler,
 "utf32", errmsg,
 starts, size, &startinpos, &endinpos, &exc, &s,
- (PyObject **)&unicode, &outpos, &p))
+ &unicode, &outpos, &p))
 	 goto onError;
 }
 
@@ -2496,7 +2498,7 @@
 	 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 @@
 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 @@
 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 @@
 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 @@
 errors, &errorHandler,
 "unicodeescape", message,
 starts, size, &startinpos, &endinpos, &exc, &s,
- (PyObject **)&v, &outpos, &p))
+ &v, &outpos, &p))
 goto onError;
 break;
 
@@ -2824,7 +2826,7 @@
 errors, &errorHandler,
 "unicodeescape", message,
 starts, size, &startinpos, &endinpos, &exc, &s,
- (PyObject **)&v, &outpos, &p))
+ &v, &outpos, &p))
 goto onError;
 }
 else {
@@ -3113,7 +3115,7 @@
 		 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 @@
 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 @@
 errors, &errorHandler,
 "unicode_internal", reason,
 starts, size, &startinpos, &endinpos, &exc, &s,
- (PyObject **)&v, &outpos, &p)) {
+ &v, &outpos, &p)) {
 goto onError;
 }
 }
@@ -3695,7 +3697,7 @@
 		 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 @@
 		 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 @@
 		 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 @@
 	/* 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 @@
 /* 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);
Modified: python/branches/release26-maint/Python/getargs.c
==============================================================================
--- python/branches/release26-maint/Python/getargs.c	(original)
+++ python/branches/release26-maint/Python/getargs.c	Sat Dec 27 18:05:29 2008
@@ -1601,7 +1601,7 @@
 		}
 	}
 
-	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);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /