Issue 22120: Return converter code generated by Argument Clinic has a warning for unsigned types (original) (raw)

Created on 2014-08-02 00:14 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
clinic.patch vstinner,2014-08-02 00:15 review
fix_warnings.patch vstinner,2014-08-02 12:10 review
larry.fix.unsigned.int.return.-1.converter.cast.1.txt larry,2014-08-05 06:20 review
Messages (11)
msg224528 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-02 00:14
The issue #22110 enabled more compiler warnings. Attached patch tries to fix most of them on Linux.
msg224529 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-02 00:15
clinic.patch: modify clinic.py to generate "return_value == (type)-1" instead of "return_value == -1" to avoid a warning if return_value is unsigned.
msg224534 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-02 04:58
I think this should be done only for unsigned integer types. Otherwise it just dirty sources and can hide actual bugs.
msg224540 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-02 08:04
It would be better to only modify clinic for unsigned types, but how do you check if a type is signed or not?
msg224543 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-02 08:56
Either override render() for unsigned type converters, or add new converter attribute (in additional to "type", "cast", "conversion_fn", etc).
msg224555 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-02 12:10
Hum, I forgot the attach the most important patch: fix_warnings.patch.
msg224811 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-08-05 06:20
The title for this bug was almost offensively generic; it was hard to find in my email. If this new one is inaccurate, fix it--but please pick something more specific. Attached is a patch for the "_return_value == -1" behavior for unsigned.
msg224813 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-05 08:08
larry.fix.unsigned.int.return.-1.converter.cast.1.txt LGTM. Victor, looks as you should open new issue for fix_warnings.patch. This is large patch and requires long time for careful review and may be discussion.
msg224816 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-05 09:55
New changeset 9c949e0115e2 by Larry Hastings in branch 'default': Issue #22120: For functions using an unsigned integer return converter, http://hg.python.org/cpython/rev/9c949e0115e2
msg224817 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-08-05 09:57
Fixed and closed. I'm assuming Victor will break the other patch out into its own issue. Since IIUC there's no code in 3.4 that uses an unsigned integer return converter, I'm not backporting the fix.
msg224925 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-06 10:38
Since my argument clinic patch hijacked this issue, I created a new one for fix_warnings.patch: issue #22156.
History
Date User Action Args
2022-04-11 14:58:06 admin set github: 66318
2016-06-19 16:15:03 serhiy.storchaka link issue20256 superseder
2014-08-06 10:38:45 vstinner set messages: +
2014-08-05 09:57:13 larry set status: open -> closedversions: - Python 3.4messages: + resolution: fixedstage: commit review -> resolved
2014-08-05 09:55:40 python-dev set nosy: + python-devmessages: +
2014-08-05 08:08:02 serhiy.storchaka set versions: + Python 3.4, Python 3.5messages: + assignee: larrycomponents: + Buildtype: behaviorstage: commit review
2014-08-05 06:21:07 larry set title: Code Argument Clinic has a warning -> Return converter code generated by Argument Clinic has a warning for unsigned types
2014-08-05 06:20:36 larry set files: + larry.fix.unsigned.int.return.-1.converter.cast.1.txtmessages: + title: Fix compiler warnings -> Code Argument Clinic has a warning
2014-08-02 12:10:03 vstinner set files: + fix_warnings.patchmessages: +
2014-08-02 11:46:27 neologix set messages: -
2014-08-02 11:04:24 neologix set messages: +
2014-08-02 08:56:54 serhiy.storchaka set messages: +
2014-08-02 08:04:26 vstinner set messages: +
2014-08-02 04:58:58 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2014-08-02 00:15:00 vstinner set files: + clinic.patchnosy: + larry, neologixmessages: + keywords: + patch
2014-08-02 00:14:08 vstinner create