Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return converter code generated by Argument Clinic has a warning for unsigned types #66318

Closed
vstinner opened this issue Aug 2, 2014 · 11 comments
Assignees
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Aug 2, 2014

BPO 22120
Nosy @vstinner, @larryhastings, @serhiy-storchaka
Files
  • clinic.patch
  • fix_warnings.patch
  • larry.fix.unsigned.int.return.-1.converter.cast.1.txt
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/larryhastings'
    closed_at = <Date 2014-08-05.09:57:13.800>
    created_at = <Date 2014-08-02.00:14:08.539>
    labels = ['type-bug', 'build']
    title = 'Return converter code generated by Argument Clinic has a warning for unsigned types'
    updated_at = <Date 2014-08-06.10:38:45.228>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2014-08-06.10:38:45.228>
    actor = 'vstinner'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2014-08-05.09:57:13.800>
    closer = 'larry'
    components = ['Build']
    creation = <Date 2014-08-02.00:14:08.539>
    creator = 'vstinner'
    dependencies = []
    files = ['36201', '36205', '36266']
    hgrepos = []
    issue_num = 22120
    keywords = ['patch']
    message_count = 11.0
    messages = ['224528', '224529', '224534', '224540', '224543', '224555', '224811', '224813', '224816', '224817', '224925']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'larry', 'neologix', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22120'
    versions = ['Python 3.5']

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 2, 2014

    The issue bpo-22110 enabled more compiler warnings. Attached patch tries to fix most of them on Linux.

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 2, 2014

    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.

    @serhiy-storchaka
    Copy link
    Member

    I think this should be done only for unsigned integer types. Otherwise it just dirty sources and can hide actual bugs.

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 2, 2014

    It would be better to only modify clinic for unsigned types, but how do you
    check if a type is signed or not?

    @serhiy-storchaka
    Copy link
    Member

    Either override render() for unsigned type converters, or add new converter
    attribute (in additional to "type", "cast", "conversion_fn", etc).

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 2, 2014

    Hum, I forgot the attach the most important patch: fix_warnings.patch.

    @larryhastings
    Copy link
    Contributor

    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.

    @larryhastings larryhastings changed the title Fix compiler warnings Code Argument Clinic has a warning Aug 5, 2014
    @larryhastings larryhastings changed the title Code Argument Clinic has a warning Return converter code generated by Argument Clinic has a warning for unsigned types Aug 5, 2014
    @serhiy-storchaka
    Copy link
    Member

    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.

    @serhiy-storchaka serhiy-storchaka added the build The build process and cross-build label Aug 5, 2014
    @serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Aug 5, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 5, 2014

    New changeset 9c949e0115e2 by Larry Hastings in branch 'default':
    Issue bpo-22120: For functions using an unsigned integer return converter,
    http://hg.python.org/cpython/rev/9c949e0115e2

    @larryhastings
    Copy link
    Contributor

    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.

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 6, 2014

    Since my argument clinic patch hijacked this issue, I created a new one for fix_warnings.patch: issue bpo-22156.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants