diff options
author | Larry Hastings <larry@hastings.org> | 2014-08-05 09:55:21 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-08-05 09:55:21 (GMT) |
commit | a73cb8a6b82b4dbf0aa9684d4356f0b6e689360a (patch) | |
tree | c547420011185cf5c0704cc4fb8e0a8de4eaba47 /Tools/clinic | |
parent | 57acacdfcf6cf61ef22c92e4848e01fd2aef9911 (diff) | |
download | cpython-a73cb8a6b82b4dbf0aa9684d4356f0b6e689360a.zip cpython-a73cb8a6b82b4dbf0aa9684d4356f0b6e689360a.tar.gz cpython-a73cb8a6b82b4dbf0aa9684d4356f0b6e689360a.tar.bz2 |
Issue #22120: For functions using an unsigned integer return converter,
Argument Clinic now generates a cast to that type for the comparison
to -1 in the generated code. (This supresses a compilation warning.)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index d15318e..962abdf 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -2865,10 +2865,11 @@ class long_return_converter(CReturnConverter): type = 'long' conversion_fn = 'PyLong_FromLong' cast = '' + unsigned_cast = '' def render(self, function, data): self.declare(data) - self.err_occurred_if("_return_value == -1", data) + self.err_occurred_if("_return_value == {}-1".format(self.unsigned_cast), data) data.return_conversion.append( ''.join(('return_value = ', self.conversion_fn, '(', self.cast, '_return_value);\n'))) @@ -2889,10 +2890,12 @@ class init_return_converter(long_return_converter): class unsigned_long_return_converter(long_return_converter): type = 'unsigned long' conversion_fn = 'PyLong_FromUnsignedLong' + unsigned_cast = '(unsigned long)' class unsigned_int_return_converter(unsigned_long_return_converter): type = 'unsigned int' cast = '(unsigned long)' + unsigned_cast = '(unsigned int)' class Py_ssize_t_return_converter(long_return_converter): type = 'Py_ssize_t' @@ -2901,6 +2904,7 @@ class Py_ssize_t_return_converter(long_return_converter): class size_t_return_converter(long_return_converter): type = 'size_t' conversion_fn = 'PyLong_FromSize_t' + unsigned_cast = '(size_t)' class double_return_converter(CReturnConverter): |