summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-11-30 05:22:44 +0000
committerTim Peters <tim.peters@gmail.com>2000-11-30 05:22:44 +0000
commit2d51e8f8f9bd3db28e586b3d44c8f7cc79f3a12e (patch)
tree8a385efed6286660f9085a28fd068f12336b4f32 /Objects
parent5118fd31e92e99a00c4f352f0d846eafe2a749dd (diff)
downloadcpython-2d51e8f8f9bd3db28e586b3d44c8f7cc79f3a12e.tar.gz
Fox for SF bug #123859: %[duxXo] long formats inconsistent.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c5
-rw-r--r--Objects/unicodeobject.c4
2 files changed, 2 insertions, 7 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 31d1b05c60..47da4ed655 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -2897,10 +2897,7 @@ PyString_Format(PyObject *format, PyObject *args)
case 'X':
if (c == 'i')
c = 'd';
- if (PyLong_Check(v) && PyLong_AsLong(v) == -1
- && PyErr_Occurred()) {
- /* Too big for a C long. */
- PyErr_Clear();
+ if (PyLong_Check(v)) {
temp = _PyString_FormatLong(v, flags,
prec, c, &pbuf, &len);
if (!temp)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index b31675b496..a297cac4dd 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5020,9 +5020,7 @@ PyObject *PyUnicode_Format(PyObject *format,
case 'X':
if (c == 'i')
c = 'd';
- if (PyLong_Check(v) && PyLong_AsLong(v) == -1
- && PyErr_Occurred()) {
- PyErr_Clear();
+ if (PyLong_Check(v)) {
temp = formatlong(v, flags, prec, c);
if (!temp)
goto onError;