mirror of
https://github.com/python/cpython.git
synced 2025-07-17 00:05:20 +00:00
Merged revisions 61034-61036,61038-61048 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61034 | georg.brandl | 2008-02-24 01:03:22 +0100 (Sun, 24 Feb 2008) | 4 lines #900744: If an invalid chunked-encoding header is sent by a server, httplib will now raise IncompleteRead and close the connection instead of raising ValueError. ........ r61035 | georg.brandl | 2008-02-24 01:14:24 +0100 (Sun, 24 Feb 2008) | 2 lines #1627: httplib now ignores negative Content-Length headers. ........ r61039 | andrew.kuchling | 2008-02-24 03:39:15 +0100 (Sun, 24 Feb 2008) | 1 line Remove stray word ........ r61040 | neal.norwitz | 2008-02-24 03:40:58 +0100 (Sun, 24 Feb 2008) | 3 lines Add a little info to the 3k deprecation warnings about what to use instead. Suggested by Raymond Hettinger. ........ r61041 | facundo.batista | 2008-02-24 04:17:21 +0100 (Sun, 24 Feb 2008) | 4 lines Issue 1742669. Now %d accepts very big float numbers. Thanks Gabriel Genellina. ........ r61046 | neal.norwitz | 2008-02-24 08:21:56 +0100 (Sun, 24 Feb 2008) | 5 lines Get ctypes working on the Alpha (Tru64). The problem was that there were two module_methods and the one used depended on the order the modules were loaded. By making the test module_methods static, it is not exported and the correct version is picked up. ........ r61048 | neal.norwitz | 2008-02-24 09:27:49 +0100 (Sun, 24 Feb 2008) | 1 line Fix typo of hexidecimal ........
This commit is contained in:
parent
8e21a3cf05
commit
a612dc02ce
8 changed files with 110 additions and 21 deletions
|
@ -8600,6 +8600,7 @@ PyObject *PyUnicode_Format(PyObject *format,
|
|||
int prec = -1;
|
||||
Py_UNICODE c = '\0';
|
||||
Py_UNICODE fill;
|
||||
int isnumok;
|
||||
PyObject *v = NULL;
|
||||
PyObject *temp = NULL;
|
||||
Py_UNICODE *pbuf;
|
||||
|
@ -8804,21 +8805,38 @@ PyObject *PyUnicode_Format(PyObject *format,
|
|||
case 'X':
|
||||
if (c == 'i')
|
||||
c = 'd';
|
||||
if (PyLong_Check(v)) {
|
||||
temp = formatlong(v, flags, prec, c);
|
||||
if (!temp)
|
||||
goto onError;
|
||||
pbuf = PyUnicode_AS_UNICODE(temp);
|
||||
len = PyUnicode_GET_SIZE(temp);
|
||||
sign = 1;
|
||||
isnumok = 0;
|
||||
if (PyNumber_Check(v)) {
|
||||
PyObject *iobj=NULL;
|
||||
|
||||
if (PyLong_Check(v)) {
|
||||
iobj = v;
|
||||
Py_INCREF(iobj);
|
||||
}
|
||||
else {
|
||||
iobj = PyNumber_Long(v);
|
||||
}
|
||||
if (iobj!=NULL) {
|
||||
if (PyLong_Check(iobj)) {
|
||||
isnumok = 1;
|
||||
temp = formatlong(iobj, flags, prec, c);
|
||||
Py_DECREF(iobj);
|
||||
if (!temp)
|
||||
goto onError;
|
||||
pbuf = PyUnicode_AS_UNICODE(temp);
|
||||
len = PyUnicode_GET_SIZE(temp);
|
||||
sign = 1;
|
||||
}
|
||||
else {
|
||||
Py_DECREF(iobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pbuf = formatbuf;
|
||||
len = formatint(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE),
|
||||
flags, prec, c, v);
|
||||
if (len < 0)
|
||||
if (!isnumok) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%%%c format: a number is required, "
|
||||
"not %.200s", c, Py_TYPE(v)->tp_name);
|
||||
goto onError;
|
||||
sign = 1;
|
||||
}
|
||||
if (flags & F_ZERO)
|
||||
fill = '0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue