File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1158,7 +1158,7 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
11581158{
11591159 double self ;
11601160 double float_part ;
1161- long exponent ;
1161+ int exponent ;
11621162
11631163 PyObject * prev ;
11641164 PyObject * py_exponent = NULL ;
@@ -1172,6 +1172,13 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
11721172 obj = call; \
11731173 Py_DECREF(prev); \
11741174
1175+ #ifdef FLT_RADIX
1176+ if (FLT_RADIX != 2 ) {
1177+ /* This routine depends on base-2 floating_point. */
1178+ Py_INCREF (Py_NotImplemented );
1179+ return Py_NotImplemented ;
1180+ }
1181+ #endif
11751182 CONVERT_TO_DOUBLE (v , self );
11761183
11771184 if (Py_IS_INFINITY (self )) {
@@ -1202,7 +1209,7 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
12021209
12031210 /* now self = numerator * 2**exponent exactly; fold in 2**exponent */
12041211 denominator = PyLong_FromLong (1 );
1205- py_exponent = PyLong_FromLong (labs (exponent ));
1212+ py_exponent = PyLong_FromLong (labs (( long ) exponent ));
12061213 if (py_exponent == NULL ) goto error ;
12071214 INPLACE_UPDATE (py_exponent ,
12081215 long_methods -> nb_lshift (denominator , py_exponent ));
You can’t perform that action at this time.
0 commit comments