| OLD | NEW |
| 1 | 1 |
| 2 /* New getargs implementation */ | 2 /* New getargs implementation */ |
| 3 | 3 |
| 4 #include "Python.h" | 4 #include "Python.h" |
| 5 | 5 |
| 6 #include <ctype.h> | 6 #include <ctype.h> |
| 7 #include <float.h> |
| 7 | 8 |
| 8 | 9 |
| 9 #ifdef __cplusplus | 10 #ifdef __cplusplus |
| 10 extern "C" { | 11 extern "C" { |
| 11 #endif | 12 #endif |
| 12 int PyArg_Parse(PyObject *, const char *, ...); | 13 int PyArg_Parse(PyObject *, const char *, ...); |
| 13 int PyArg_ParseTuple(PyObject *, const char *, ...); | 14 int PyArg_ParseTuple(PyObject *, const char *, ...); |
| 14 int PyArg_VaParse(PyObject *, const char *, va_list); | 15 int PyArg_VaParse(PyObject *, const char *, va_list); |
| 15 | 16 |
| 16 int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, | 17 int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 *p = ival; | 751 *p = ival; |
| 751 break; | 752 break; |
| 752 } | 753 } |
| 753 #endif | 754 #endif |
| 754 | 755 |
| 755 case 'f': {/* float */ | 756 case 'f': {/* float */ |
| 756 float *p = va_arg(*p_va, float *); | 757 float *p = va_arg(*p_va, float *); |
| 757 double dval = PyFloat_AsDouble(arg); | 758 double dval = PyFloat_AsDouble(arg); |
| 758 if (PyErr_Occurred()) | 759 if (PyErr_Occurred()) |
| 759 RETURN_ERR_OCCURRED; | 760 RETURN_ERR_OCCURRED; |
| 760 else | 761 if (Py_IS_FINITE(dval)) { |
| 761 *p = (float) dval; | 762 if (dval < -FLT_MAX) { |
| 763 PyErr_SetString(PyExc_OverflowError, |
| 764 "float is less than minimum"); |
| 765 RETURN_ERR_OCCURRED; |
| 766 } |
| 767 else if (dval > FLT_MAX) { |
| 768 PyErr_SetString(PyExc_OverflowError, |
| 769 "float is greater than maximum"); |
| 770 RETURN_ERR_OCCURRED; |
| 771 } |
| 772 } |
| 773 *p = (float) dval; |
| 762 break; | 774 break; |
| 763 } | 775 } |
| 764 | 776 |
| 765 case 'd': {/* double */ | 777 case 'd': {/* double */ |
| 766 double *p = va_arg(*p_va, double *); | 778 double *p = va_arg(*p_va, double *); |
| 767 double dval = PyFloat_AsDouble(arg); | 779 double dval = PyFloat_AsDouble(arg); |
| 768 if (PyErr_Occurred()) | 780 if (PyErr_Occurred()) |
| 769 RETURN_ERR_OCCURRED; | 781 RETURN_ERR_OCCURRED; |
| 770 else | 782 else |
| 771 *p = dval; | 783 *p = dval; |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 if (PyDict_Size(kw) == 0) | 1808 if (PyDict_Size(kw) == 0) |
| 1797 return 1; | 1809 return 1; |
| 1798 | 1810 |
| 1799 PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments", | 1811 PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments", |
| 1800 funcname); | 1812 funcname); |
| 1801 return 0; | 1813 return 0; |
| 1802 } | 1814 } |
| 1803 #ifdef __cplusplus | 1815 #ifdef __cplusplus |
| 1804 }; | 1816 }; |
| 1805 #endif | 1817 #endif |
| OLD | NEW |