mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Change float.__str__() and complex.__str__() to return
unicode objects.
This commit is contained in:
parent
346737fc19
commit
7696ed7b92
3 changed files with 3 additions and 2 deletions
|
|
@ -107,6 +107,7 @@ typedef Py_intptr_t Py_ssize_t;
|
||||||
* PyString_FromFormat
|
* PyString_FromFormat
|
||||||
* PyErr_Format
|
* PyErr_Format
|
||||||
* PyString_FromFormatV
|
* PyString_FromFormatV
|
||||||
|
* PyUnicode_FromFormatV
|
||||||
*
|
*
|
||||||
* Lower-level uses require that you interpolate the correct format modifier
|
* Lower-level uses require that you interpolate the correct format modifier
|
||||||
* yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for
|
* yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@ complex_str(PyComplexObject *v)
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
complex_to_buf(buf, sizeof(buf), v, PREC_STR);
|
complex_to_buf(buf, sizeof(buf), v, PREC_STR);
|
||||||
return PyString_FromString(buf);
|
return PyUnicode_FromString(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ float_str(PyFloatObject *v)
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
format_float(buf, sizeof(buf), v, PREC_STR);
|
format_float(buf, sizeof(buf), v, PREC_STR);
|
||||||
return PyString_FromString(buf);
|
return PyUnicode_FromString(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Comparison is pretty much a nightmare. When comparing float to float,
|
/* Comparison is pretty much a nightmare. When comparing float to float,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue