@@ -58,7 +58,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
5858}
5959
6060/**
61- * PyOS_ascii_strtod :
61+ * _PyOS_ascii_strtod :
6262 * @nptr: the string to convert to a numeric value.
6363 * @endptr: if non-%NULL, it returns the character after
6464 * the last character used in the conversion.
@@ -88,7 +88,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
8888
8989#ifndef PY_NO_SHORT_FLOAT_REPR
9090
91- double
91+ static double
9292_PyOS_ascii_strtod (const char * nptr , char * * endptr )
9393{
9494 double result ;
@@ -121,7 +121,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
121121 correctly rounded results.
122122*/
123123
124- double
124+ static double
125125_PyOS_ascii_strtod (const char * nptr , char * * endptr )
126126{
127127 char * fail_pos ;
@@ -270,48 +270,10 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
270270
271271#endif
272272
273- /* PyOS_ascii_strtod is DEPRECATED in Python 3.1 */
274-
275- double
276- PyOS_ascii_strtod (const char * nptr , char * * endptr )
277- {
278- char * fail_pos ;
279- const char * p ;
280- double x ;
281-
282- if (PyErr_WarnEx (PyExc_DeprecationWarning ,
283- "PyOS_ascii_strtod and PyOS_ascii_atof are "
284- "deprecated. Use PyOS_string_to_double "
285- "instead." , 1 ) < 0 )
286- return -1.0 ;
287-
288- /* _PyOS_ascii_strtod already does everything that we want,
289- except that it doesn't parse leading whitespace */
290- p = nptr ;
291- while (Py_ISSPACE (* p ))
292- p ++ ;
293- x = _PyOS_ascii_strtod (p , & fail_pos );
294- if (fail_pos == p )
295- fail_pos = (char * )nptr ;
296- if (endptr )
297- * endptr = (char * )fail_pos ;
298- return x ;
299- }
300-
301- /* PyOS_ascii_strtod is DEPRECATED in Python 3.1 */
302-
303- double
304- PyOS_ascii_atof (const char * nptr )
305- {
306- return PyOS_ascii_strtod (nptr , NULL );
307- }
308-
309- /* PyOS_string_to_double is the recommended replacement for the deprecated
310- PyOS_ascii_strtod and PyOS_ascii_atof functions. It converts a
311- null-terminated byte string s (interpreted as a string of ASCII characters)
312- to a float. The string should not have leading or trailing whitespace (in
313- contrast, PyOS_ascii_strtod allows leading whitespace but not trailing
314- whitespace). The conversion is independent of the current locale.
273+ /* PyOS_string_to_double converts a null-terminated byte string s (interpreted
274+ as a string of ASCII characters) to a float. The string should not have
275+ leading or trailing whitespace. The conversion is independent of the
276+ current locale.
315277
316278 If endptr is NULL, try to convert the whole string. Raise ValueError and
317279 return -1.0 if the string is not a valid representation of a floating-point
@@ -369,6 +331,8 @@ PyOS_string_to_double(const char *s,
369331 return result ;
370332}
371333
334+ #ifdef PY_NO_SHORT_FLOAT_REPR
335+
372336/* Given a string that may have a decimal point in the current
373337 locale, change it back to a dot. Since the string cannot get
374338 longer, no need for a maximum buffer size parameter. */
@@ -618,12 +582,13 @@ ensure_decimal_point(char* buffer, size_t buf_size, int precision)
618582#define FLOAT_FORMATBUFLEN 120
619583
620584/**
621- * PyOS_ascii_formatd :
585+ * _PyOS_ascii_formatd :
622586 * @buffer: A buffer to place the resulting string in
623587 * @buf_size: The length of the buffer.
624588 * @format: The printf()-style format to use for the
625589 * code to use for converting.
626590 * @d: The #gdouble to convert
591+ * @precision: The precision to use when formatting.
627592 *
628593 * Converts a #gdouble to a string, using the '.' as
629594 * decimal point. To format the number you pass in
@@ -636,7 +601,7 @@ ensure_decimal_point(char* buffer, size_t buf_size, int precision)
636601 * Return value: The pointer to the buffer with the converted string.
637602 * On failure returns NULL but does not set any Python exception.
638603 **/
639- char *
604+ static char *
640605_PyOS_ascii_formatd (char * buffer ,
641606 size_t buf_size ,
642607 const char * format ,
@@ -716,22 +681,6 @@ _PyOS_ascii_formatd(char *buffer,
716681 return buffer ;
717682}
718683
719- char *
720- PyOS_ascii_formatd (char * buffer ,
721- size_t buf_size ,
722- const char * format ,
723- double d )
724- {
725- if (PyErr_WarnEx (PyExc_DeprecationWarning ,
726- "PyOS_ascii_formatd is deprecated, "
727- "use PyOS_double_to_string instead" , 1 ) < 0 )
728- return NULL ;
729-
730- return _PyOS_ascii_formatd (buffer , buf_size , format , d , -1 );
731- }
732-
733- #ifdef PY_NO_SHORT_FLOAT_REPR
734-
735684/* The fallback code to use if _Py_dg_dtoa is not available. */
736685
737686PyAPI_FUNC (char * ) PyOS_double_to_string (double val ,
0 commit comments