| 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 | 7 |
| 8 | 8 |
| 9 #ifdef __cplusplus | 9 #ifdef __cplusplus |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 804 |
| 805 if (PyUnicode_READY(arg)) | 805 if (PyUnicode_READY(arg)) |
| 806 RETURN_ERR_OCCURRED; | 806 RETURN_ERR_OCCURRED; |
| 807 | 807 |
| 808 if (PyUnicode_GET_LENGTH(arg) != 1) | 808 if (PyUnicode_GET_LENGTH(arg) != 1) |
| 809 return converterr("a unicode character", arg, msgbuf, bufsize); | 809 return converterr("a unicode character", arg, msgbuf, bufsize); |
| 810 | 810 |
| 811 kind = PyUnicode_KIND(arg); | 811 kind = PyUnicode_KIND(arg); |
| 812 data = PyUnicode_DATA(arg); | 812 data = PyUnicode_DATA(arg); |
| 813 *p = PyUnicode_READ(kind, data, 0); | 813 *p = PyUnicode_READ(kind, data, 0); |
| 814 break; |
| 815 } |
| 816 |
| 817 case 'p': {/* boolean *p*redicate */ |
| 818 int *p = va_arg(*p_va, int *); |
| 819 int val = PyObject_IsTrue(arg); |
| 820 if (val > 0) |
| 821 *p = 1; |
| 822 else if (val == 0) |
| 823 *p = 0; |
| 824 else |
| 825 RETURN_ERR_OCCURRED; |
| 814 break; | 826 break; |
| 815 } | 827 } |
| 816 | 828 |
| 817 /* XXX WAAAAH! 's', 'y', 'z', 'u', 'Z', 'e', 'w' codes all | 829 /* XXX WAAAAH! 's', 'y', 'z', 'u', 'Z', 'e', 'w' codes all |
| 818 need to be cleaned up! */ | 830 need to be cleaned up! */ |
| 819 | 831 |
| 820 case 'y': {/* any buffer-like object, but not PyUnicode */ | 832 case 'y': {/* any buffer-like object, but not PyUnicode */ |
| 821 void **p = (void **)va_arg(*p_va, char **); | 833 void **p = (void **)va_arg(*p_va, char **); |
| 822 char *buf; | 834 char *buf; |
| 823 Py_ssize_t count; | 835 Py_ssize_t count; |
| (...skipping 972 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 |