Discussion:
[Python-3000-checkins] r66378 - in python/branches/py3k: Modules/_collectionsmodule.c Modules/_multiprocessing/connection.h Modules/_multiprocessing/multiprocessing.h Python/Python-ast.c
amaury.forgeotdarc
2008-09-10 22:24:25 UTC
Permalink
Author: amaury.forgeotdarc
Date: Thu Sep 11 00:24:24 2008
New Revision: 66378

Log:
Merged revisions 66377 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk

........
r66377 | amaury.forgeotdarc | 2008-09-11 00:04:45 +0200 (jeu., 11 sept. 2008) | 8 lines

#3743: PY_FORMAT_SIZE_T is designed for the OS "printf" functions, not for
PyString_FromFormat which has an independent implementation, and uses "%zd".

This makes a difference on win64, where printf needs "%Id" to display
64bit values. For example, queue.__repr__ was incorrect.

Reviewed by Martin von Loewis.
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Modules/_collectionsmodule.c
python/branches/py3k/Modules/_multiprocessing/connection.h
python/branches/py3k/Modules/_multiprocessing/multiprocessing.h
python/branches/py3k/Python/Python-ast.c

Modified: python/branches/py3k/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/py3k/Modules/_collectionsmodule.c (original)
+++ python/branches/py3k/Modules/_collectionsmodule.c Thu Sep 11 00:24:24 2008
@@ -671,7 +671,7 @@
}
if (((dequeobject *)deque)->maxlen != -1)

- result = PyUnicode_FromFormat("deque(%R, maxlen=%" PY_FORMAT_SIZE_T "d)",
+ result = PyUnicode_FromFormat("deque(%R, maxlen=%zd)",
aslist, ((dequeobject *)deque)->maxlen);
else
result = PyUnicode_FromFormat("deque(%R)", aslist);

Modified: python/branches/py3k/Modules/_multiprocessing/connection.h
==============================================================================
--- python/branches/py3k/Modules/_multiprocessing/connection.h (original)
+++ python/branches/py3k/Modules/_multiprocessing/connection.h Thu Sep 11 00:24:24 2008
@@ -47,8 +47,8 @@
return NULL;

if (handle == INVALID_HANDLE_VALUE || (Py_ssize_t)handle < 0) {
- PyErr_Format(PyExc_IOError, "invalid handle %"
- PY_FORMAT_SIZE_T "d", (Py_ssize_t)handle);
+ PyErr_Format(PyExc_IOError, "invalid handle %zd",
+ (Py_ssize_t)handle);
return NULL;
}

@@ -404,7 +404,7 @@
static char *conn_type[] = {"read-only", "write-only", "read-write"};

assert(self->flags >= 1 && self->flags <= 3);
- return FROM_FORMAT("<%s %s, handle %" PY_FORMAT_SIZE_T "d>",
+ return FROM_FORMAT("<%s %s, handle %zd>",
conn_type[self->flags - 1],
CONNECTION_NAME, (Py_ssize_t)self->handle);
}

Modified: python/branches/py3k/Modules/_multiprocessing/multiprocessing.h
==============================================================================
--- python/branches/py3k/Modules/_multiprocessing/multiprocessing.h (original)
+++ python/branches/py3k/Modules/_multiprocessing/multiprocessing.h Thu Sep 11 00:24:24 2008
@@ -56,7 +56,6 @@
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
# define F_PY_SSIZE_T "i"
-# define PY_FORMAT_SIZE_T ""
# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n)
#else
# define F_PY_SSIZE_T "n"

Modified: python/branches/py3k/Python/Python-ast.c
==============================================================================
--- python/branches/py3k/Python/Python-ast.c (original)
+++ python/branches/py3k/Python/Python-ast.c Thu Sep 11 00:24:24 2008
@@ -412,7 +412,7 @@
if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
- "%" PY_FORMAT_SIZE_T "d positional argument%s",
+ "%zd positional argument%s",
Py_TYPE(self)->tp_name,
numfields == 0 ? "" : "either 0 or ",
numfields, numfields == 1 ? "" : "s");

Loading...