mirror of https://github.com/python/cpython
Removed usage of unsafe PyFloat_AsString.
This commit is contained in:
parent
03d5c346c0
commit
b327258d4f
|
@ -2012,15 +2012,21 @@ PyFloat_Fini(void)
|
||||||
i++, p++) {
|
i++, p++) {
|
||||||
if (PyFloat_CheckExact(p) &&
|
if (PyFloat_CheckExact(p) &&
|
||||||
Py_REFCNT(p) != 0) {
|
Py_REFCNT(p) != 0) {
|
||||||
char buf[100];
|
char *buf = PyOS_double_to_string(
|
||||||
PyFloat_AsString(buf, p);
|
PyFloat_AS_DOUBLE(p), 'r',
|
||||||
/* XXX(twouters) cast refcount to
|
0, 0, NULL);
|
||||||
long until %zd is universally
|
if (buf) {
|
||||||
available
|
/* XXX(twouters) cast
|
||||||
*/
|
refcount to long
|
||||||
fprintf(stderr,
|
until %zd is
|
||||||
|
universally
|
||||||
|
available
|
||||||
|
*/
|
||||||
|
fprintf(stderr,
|
||||||
"# <float at %p, refcnt=%ld, val=%s>\n",
|
"# <float at %p, refcnt=%ld, val=%s>\n",
|
||||||
p, (long)Py_REFCNT(p), buf);
|
p, (long)Py_REFCNT(p), buf);
|
||||||
|
PyMem_Free(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list = list->next;
|
list = list->next;
|
||||||
|
|
Loading…
Reference in New Issue