[Python-3000-checkins] r55776 - python/branches/py3k-struni/Objects/intobject.c
walter.doerwald
python-3000-checkins at python.org
Tue Jun 5 21:50:57 CEST 2007
Author: walter.doerwald
Date: Tue Jun 5 21:50:53 2007
New Revision: 55776
Modified:
python/branches/py3k-struni/Objects/intobject.c
Log:
Change int_oct() and int_hex() to return unicode objects.
Modified: python/branches/py3k-struni/Objects/intobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/intobject.c (original)
+++ python/branches/py3k-struni/Objects/intobject.c Tue Jun 5 21:50:53 2007
@@ -920,27 +920,23 @@
static PyObject *
int_oct(PyIntObject *v)
{
- char buf[100];
long x = v -> ob_ival;
if (x < 0)
- PyOS_snprintf(buf, sizeof(buf), "-0%lo", -x);
+ return PyUnicode_FromFormat("-0%lo", -x);
else if (x == 0)
- strcpy(buf, "0");
+ return PyUnicode_FromString("0");
else
- PyOS_snprintf(buf, sizeof(buf), "0%lo", x);
- return PyString_FromString(buf);
+ return PyUnicode_FromFormat("0%lo", x);
}
static PyObject *
int_hex(PyIntObject *v)
{
- char buf[100];
long x = v -> ob_ival;
if (x < 0)
- PyOS_snprintf(buf, sizeof(buf), "-0x%lx", -x);
+ return PyUnicode_FromFormat("-0x%lx", -x);
else
- PyOS_snprintf(buf, sizeof(buf), "0x%lx", x);
- return PyString_FromString(buf);
+ return PyUnicode_FromFormat("0x%lx", x);
}
static PyObject *
More information about the Python-3000-checkins
mailing list