This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Return converter code generated by Argument Clinic has a warning for unsigned types
Type: behavior Stage: resolved
Components: Build Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, neologix, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

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:06adminsetgithub: 66318
2016-06-19 16:15:03serhiy.storchakalinkissue20256 superseder
2014-08-06 10:38:45vstinnersetmessages: + msg224925
2014-08-05 09:57:13larrysetstatus: open -> closed
versions: - Python 3.4
messages: + msg224817

resolution: fixed
stage: commit review -> resolved
2014-08-05 09:55:40python-devsetnosy: + python-dev
messages: + msg224816
2014-08-05 08:08:02serhiy.storchakasetversions: + Python 3.4, Python 3.5
messages: + msg224813

assignee: larry
components: + Build
type: behavior
stage: commit review
2014-08-05 06:21:07larrysettitle: Code Argument Clinic has a warning -> Return converter code generated by Argument Clinic has a warning for unsigned types
2014-08-05 06:20:36larrysetfiles: + larry.fix.unsigned.int.return.-1.converter.cast.1.txt

messages: + msg224811
title: Fix compiler warnings -> Code Argument Clinic has a warning
2014-08-02 12:10:03vstinnersetfiles: + fix_warnings.patch

messages: + msg224555
2014-08-02 11:46:27neologixsetmessages: - msg224550
2014-08-02 11:04:24neologixsetmessages: + msg224550
2014-08-02 08:56:54serhiy.storchakasetmessages: + msg224543
2014-08-02 08:04:26vstinnersetmessages: + msg224540
2014-08-02 04:58:58serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg224534
2014-08-02 00:15:00vstinnersetfiles: + clinic.patch

nosy: + larry, neologix
messages: + msg224529

keywords: + patch
2014-08-02 00:14:08vstinnercreate