| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5f8b5e2 commit 1b2611e
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -633,11 +633,13 @@ Build Changes | |||
| 633 | 633 | (Contributed by Victor Stinner in :issue:`45440`.) | |
| 634 | 634 | ||
| 635 | 635 | * Building Python now requires a C99 ``<math.h>`` header file providing | |
| 636 | - a ``NAN`` constant, or the ``__builtin_nan()`` built-in function. If a | ||
| 637 | - platform does not support Not-a-Number (NaN), the ``Py_NO_NAN`` macro can be | ||
| 638 | - defined in the ``pyconfig.h`` file. | ||
| 636 | + a ``NAN`` constant, or the ``__builtin_nan()`` built-in function. | ||
| 639 | 637 | (Contributed by Victor Stinner in :issue:`46640`.) | |
| 640 | 638 | ||
| 639 | + * Building Python now requires support for floating point Not-a-Number (NaN): | ||
| 640 | + remove the ``Py_NO_NAN`` macro. | ||
| 641 | + (Contributed by Victor Stinner in :issue:`46656`.) | ||
| 642 | + | ||
| 641 | 643 | * Freelists for object structs can now be disabled. A new :program:`configure` | |
| 642 | 644 | option :option:`!--without-freelists` can be used to disable all freelists | |
| 643 | 645 | except empty tuple singleton. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,9 +16,7 @@ PyAPI_DATA(PyTypeObject) PyFloat_Type; | |||
| 16 | 16 | #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) | |
| 17 | 17 | #define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type) | |
| 18 | 18 | ||
| 19 | - #ifdef Py_NAN | ||
| 20 | - # define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) | ||
| 21 | - #endif | ||
| 19 | + #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) | ||
| 22 | 20 | ||
| 23 | 21 | #define Py_RETURN_INF(sign) \ | |
| 24 | 22 | do { \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,11 +50,8 @@ | |||
| 50 | 50 | # define Py_HUGE_VAL HUGE_VAL | |
| 51 | 51 | #endif | |
| 52 | 52 | ||
| 53 | - /* Py_NAN | ||
| 54 | - * A value that evaluates to a quiet Not-a-Number (NaN). | ||
| 55 | - * Define Py_NO_NAN in pyconfig.h if your platform doesn't support NaNs. | ||
| 56 | - */ | ||
| 57 | - #if !defined(Py_NAN) && !defined(Py_NO_NAN) | ||
| 53 | + // Py_NAN: Value that evaluates to a quiet Not-a-Number (NaN). | ||
| 54 | + #if !defined(Py_NAN) | ||
| 58 | 55 | # if _Py__has_builtin(__builtin_nan) | |
| 59 | 56 | // Built-in implementation of the ISO C99 function nan(): quiet NaN. | |
| 60 | 57 | # define Py_NAN (__builtin_nan("")) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | 1 | Building Python now requires a C99 ``<math.h>`` header file providing a ``NAN`` | |
| 2 | - constant, or the ``__builtin_nan()`` built-in function. If a platform does not | ||
| 3 | - support Not-a-Number (NaN), the ``Py_NO_NAN`` macro can be defined in the | ||
| 4 | - ``pyconfig.h`` file. Patch by Victor Stinner. | ||
| 2 | + constant, or the ``__builtin_nan()`` built-in function. | ||
| 3 | + Patch by Victor Stinner. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Building Python now requires support for floating point Not-a-Number (NaN): | ||
| 2 | + remove the ``Py_NO_NAN`` macro. Patch by by Victor Stinner. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,7 +113,7 @@ c_infj(void) | |||
| 113 | 113 | return r; | |
| 114 | 114 | } | |
| 115 | 115 | ||
| 116 | - #if _PY_SHORT_FLOAT_REPR == 1 || defined(Py_NAN) | ||
| 116 | + #if _PY_SHORT_FLOAT_REPR == 1 | ||
| 117 | 117 | ||
| 118 | 118 | static double | |
| 119 | 119 | m_nan(void) | |
@@ -1282,7 +1282,7 @@ cmath_exec(PyObject *mod) | |||
| 1282 | 1282 | PyComplex_FromCComplex(c_infj())) < 0) { | |
| 1283 | 1283 | return -1; | |
| 1284 | 1284 | } | |
| 1285 | - #if _PY_SHORT_FLOAT_REPR == 1 || defined(Py_NAN) | ||
| 1285 | + #if _PY_SHORT_FLOAT_REPR == 1 | ||
| 1286 | 1286 | if (PyModule_AddObject(mod, "nan", PyFloat_FromDouble(m_nan())) < 0) { | |
| 1287 | 1287 | return -1; | |
| 1288 | 1288 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ m_inf(void) | |||
| 283 | 283 | /* Constant nan value, generated in the same way as float('nan'). */ | |
| 284 | 284 | /* We don't currently assume that Py_NAN is defined everywhere. */ | |
| 285 | 285 | ||
| 286 | - #if _PY_SHORT_FLOAT_REPR == 1 || defined(Py_NAN) | ||
| 286 | + #if _PY_SHORT_FLOAT_REPR == 1 | ||
| 287 | 287 | ||
| 288 | 288 | static double | |
| 289 | 289 | m_nan(void) | |
@@ -3838,7 +3838,7 @@ math_exec(PyObject *module) | |||
| 3838 | 3838 | if (PyModule_AddObject(module, "inf", PyFloat_FromDouble(m_inf())) < 0) { | |
| 3839 | 3839 | return -1; | |
| 3840 | 3840 | } | |
| 3841 | - #if _PY_SHORT_FLOAT_REPR == 1 || defined(Py_NAN) | ||
| 3841 | + #if _PY_SHORT_FLOAT_REPR == 1 | ||
| 3842 | 3842 | if (PyModule_AddObject(module, "nan", PyFloat_FromDouble(m_nan())) < 0) { | |
| 3843 | 3843 | return -1; | |
| 3844 | 3844 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2486,15 +2486,7 @@ _PyFloat_Unpack2(const unsigned char *p, int le) | |||
| 2486 | 2486 | } | |
| 2487 | 2487 | else { | |
| 2488 | 2488 | /* NaN */ | |
| 2489 | - #ifdef Py_NAN | ||
| 2490 | 2489 | return sign ? -Py_NAN : Py_NAN; | |
| 2491 | - #else | ||
| 2492 | - PyErr_SetString( | ||
| 2493 | - PyExc_ValueError, | ||
| 2494 | - "can't unpack IEEE 754 NaN " | ||
| 2495 | - "on platform that does not support NaNs"); | ||
| 2496 | - return -1; | ||
| 2497 | - #endif // !defined(Py_NAN) | ||
| 2498 | 2490 | } | |
| 2499 | 2491 | #else // _PY_SHORT_FLOAT_REPR == 1 | |
| 2500 | 2492 | if (f == 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,12 +82,10 @@ _Py_parse_inf_or_nan(const char *p, char **endptr) | |||
| 82 | 82 | s += 5; | |
| 83 | 83 | retval = negate ? -Py_HUGE_VAL : Py_HUGE_VAL; | |
| 84 | 84 | } | |
| 85 | - #ifdef Py_NAN | ||
| 86 | 85 | else if (case_insensitive_match(s, "nan")) { | |
| 87 | 86 | s += 3; | |
| 88 | 87 | retval = negate ? -Py_NAN : Py_NAN; | |
| 89 | 88 | } | |
| 90 | - #endif | ||
| 91 | 89 | else { | |
| 92 | 90 | s = p; | |
| 93 | 91 | retval = -1.0; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments