summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/dtoa.c8
-rw-r--r--Python/pystrtod.c14
-rw-r--r--Python/sysmodule.c3
3 files changed, 13 insertions, 12 deletions
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 6c44f68..733e70b 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -118,12 +118,12 @@
/* Linking of Python's #defines to Gay's #defines starts here. */
#include "Python.h"
-#include "pycore_dtoa.h"
+#include "pycore_dtoa.h" // _PY_SHORT_FLOAT_REPR
#include <stdlib.h> // exit()
-/* if PY_NO_SHORT_FLOAT_REPR is defined, then don't even try to compile
+/* if _PY_SHORT_FLOAT_REPR == 0, then don't even try to compile
the following code */
-#ifndef PY_NO_SHORT_FLOAT_REPR
+#if _PY_SHORT_FLOAT_REPR == 1
#include "float.h"
@@ -2857,4 +2857,4 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
}
#endif
-#endif /* PY_NO_SHORT_FLOAT_REPR */
+#endif // _PY_SHORT_FLOAT_REPR == 1
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index ab5814d..7469d62 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -1,8 +1,8 @@
/* -*- Mode: C; c-file-style: "python" -*- */
#include <Python.h>
-#include "pycore_dtoa.h"
-#include "pycore_pymath.h" // _Py_SET_53BIT_PRECISION_START
+#include "pycore_dtoa.h" // _Py_dg_strtod()
+#include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR
#include <locale.h>
/* Case-insensitive string match used for nan and inf detection; t should be
@@ -24,7 +24,7 @@ case_insensitive_match(const char *s, const char *t)
the successfully parsed portion of the string. On failure, return -1.0 and
set *endptr to point to the start of the string. */
-#ifndef PY_NO_SHORT_FLOAT_REPR
+#if _PY_SHORT_FLOAT_REPR == 1
double
_Py_parse_inf_or_nan(const char *p, char **endptr)
@@ -127,7 +127,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
* Return value: the #gdouble value.
**/
-#ifndef PY_NO_SHORT_FLOAT_REPR
+#if _PY_SHORT_FLOAT_REPR == 1
static double
_PyOS_ascii_strtod(const char *nptr, char **endptr)
@@ -441,7 +441,7 @@ _Py_string_to_number_with_underscores(
return NULL;
}
-#ifdef PY_NO_SHORT_FLOAT_REPR
+#if _PY_SHORT_FLOAT_REPR == 0
/* Given a string that may have a decimal point in the current
locale, change it back to a dot. Since the string cannot get
@@ -942,7 +942,7 @@ char * PyOS_double_to_string(double val,
return buf;
}
-#else
+#else // _PY_SHORT_FLOAT_REPR == 1
/* _Py_dg_dtoa is available. */
@@ -1305,4 +1305,4 @@ char * PyOS_double_to_string(double val,
flags & Py_DTSF_ALT,
float_strings, type);
}
-#endif /* ifdef PY_NO_SHORT_FLOAT_REPR */
+#endif // _PY_SHORT_FLOAT_REPR == 1
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index e23b879..342e48e 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -25,6 +25,7 @@ Data members:
#include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0()
#include "pycore_pyerrors.h" // _PyErr_Fetch()
#include "pycore_pylifecycle.h" // _PyErr_WriteUnraisableDefaultHook()
+#include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_structseq.h" // _PyStructSequence_InitType()
@@ -2837,7 +2838,7 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
#endif
/* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */
-#ifndef PY_NO_SHORT_FLOAT_REPR
+#if _PY_SHORT_FLOAT_REPR == 1
SET_SYS_FROM_STRING("float_repr_style", "short");
#else
SET_SYS_FROM_STRING("float_repr_style", "legacy");