Commit ccdbbaa7 authored by Marius Wachtler's avatar Marius Wachtler

float.cpp: now that we have float.c use some of the functions directly

this also workarounds the problem we were having on ubuntu 16.04 where we have to use std::isinf instead of isinf()
parent 5ae5bf2c
...@@ -409,9 +409,7 @@ float_str(PyFloatObject *v) ...@@ -409,9 +409,7 @@ float_str(PyFloatObject *v)
* coercion to double. So this part is painful too. * coercion to double. So this part is painful too.
*/ */
// Pyston change: don't need this for now PyObject*
#if 0
static PyObject*
float_richcompare(PyObject *v, PyObject *w, int op) float_richcompare(PyObject *v, PyObject *w, int op)
{ {
double i, j; double i, j;
...@@ -624,7 +622,6 @@ float_richcompare(PyObject *v, PyObject *w, int op) ...@@ -624,7 +622,6 @@ float_richcompare(PyObject *v, PyObject *w, int op)
Py_INCREF(Py_NotImplemented); Py_INCREF(Py_NotImplemented);
return Py_NotImplemented; return Py_NotImplemented;
} }
#endif
static long static long
float_hash(PyFloatObject *v) float_hash(PyFloatObject *v)
...@@ -1887,7 +1884,7 @@ float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -1887,7 +1884,7 @@ float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return newobj; return newobj;
} }
static PyObject * PyObject *
float_getnewargs(PyFloatObject *v) float_getnewargs(PyFloatObject *v)
{ {
return Py_BuildValue("(d)", v->ob_fval); return Py_BuildValue("(d)", v->ob_fval);
...@@ -1902,7 +1899,7 @@ typedef enum { ...@@ -1902,7 +1899,7 @@ typedef enum {
static float_format_type double_format, float_format; static float_format_type double_format, float_format;
static float_format_type detected_double_format, detected_float_format; static float_format_type detected_double_format, detected_float_format;
static PyObject * PyObject *
float_getformat(PyTypeObject *v, PyObject* arg) float_getformat(PyTypeObject *v, PyObject* arg)
{ {
char* s; char* s;
...@@ -2200,6 +2197,8 @@ PyTypeObject PyFloat_Type = { ...@@ -2200,6 +2197,8 @@ PyTypeObject PyFloat_Type = {
0, /* tp_alloc */ 0, /* tp_alloc */
float_new, /* tp_new */ float_new, /* tp_new */
}; };
// pyston change:
#endif
void void
_PyFloat_Init(void) _PyFloat_Init(void)
...@@ -2255,6 +2254,8 @@ _PyFloat_Init(void) ...@@ -2255,6 +2254,8 @@ _PyFloat_Init(void)
PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc);
} }
// pyston change: don't need this
#if 0
int int
PyFloat_ClearFreeList(void) PyFloat_ClearFreeList(void)
{ {
...@@ -2351,8 +2352,6 @@ PyFloat_Fini(void) ...@@ -2351,8 +2352,6 @@ PyFloat_Fini(void)
} }
#endif #endif
// pyston change: comment this out
#if 0
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h. * _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h.
*/ */
...@@ -2762,4 +2761,3 @@ _PyFloat_Unpack8(const unsigned char *p, int le) ...@@ -2762,4 +2761,3 @@ _PyFloat_Unpack8(const unsigned char *p, int le)
return x; return x;
} }
} }
#endif
...@@ -509,8 +509,10 @@ extern "C" long _Py_HashDouble(double v) noexcept { ...@@ -509,8 +509,10 @@ extern "C" long _Py_HashDouble(double v) noexcept {
* of mapping keys will turn out weird. * of mapping keys will turn out weird.
*/ */
// pyston change: was if (!Py_IS_FINITE(v)) {
if (!std::isfinite(v)) { if (!std::isfinite(v)) {
if (Py_IS_INFINITY(v)) // pyston change: was if (Py_IS_INFINITY(v)) {
if (std::isinf(v))
return v < 0 ? -271828 : 314159; return v < 0 ? -271828 : 314159;
else else
return 0; return 0;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment