mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Remove PyFloat_AsReprString() and PyFloat_AsString() which should not
have been public due to passing buffers without lengths.
This commit is contained in:
parent
51d00223c3
commit
545686b279
3 changed files with 27 additions and 61 deletions
|
|
@ -34,19 +34,6 @@ PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
|||
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
||||
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
||||
|
||||
/* Write repr(v) into the char buffer argument, followed by null byte. The
|
||||
buffer must be "big enough"; >= 100 is very safe.
|
||||
PyFloat_AsReprString(buf, x) strives to print enough digits so that
|
||||
PyFloat_FromString(buf) then reproduces x exactly. */
|
||||
PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v);
|
||||
|
||||
/* Write str(v) into the char buffer argument, followed by null byte. The
|
||||
buffer must be "big enough"; >= 100 is very safe. Note that it's
|
||||
unusual to be able to get back the float you started with from
|
||||
PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to
|
||||
preserve precision across conversions. */
|
||||
PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
|
||||
|
||||
/* _PyFloat_{Pack,Unpack}{4,8}
|
||||
*
|
||||
* The struct and pickle (at least) modules need an efficient platform-
|
||||
|
|
@ -82,6 +69,11 @@ PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
|
|||
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
||||
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
||||
|
||||
/* Needed for the old way for marshal to store a floating point number.
|
||||
Returns the string length copied into p, -1 on error.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len);
|
||||
|
||||
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
|
||||
* argument, true if the string is in little-endian format (exponent
|
||||
* last, at p+3 or p+7), false if big-endian (exponent first, at p).
|
||||
|
|
@ -93,7 +85,6 @@ PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
|||
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
||||
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue