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

Incorrect error message for a few functions called with keywod argument #74812

Closed
SylvainDe mannequin opened this issue Jun 10, 2017 · 3 comments
Closed

Incorrect error message for a few functions called with keywod argument #74812

SylvainDe mannequin opened this issue Jun 10, 2017 · 3 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@SylvainDe
Copy link
Mannequin

SylvainDe mannequin commented Jun 10, 2017

BPO 30627
Nosy @serhiy-storchaka, @SylvainDe
PRs
  • bpo-30627: Fix error message when keyword arguments are used #2115
  • 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 = None
    closed_at = <Date 2017-06-15.15:08:04.582>
    created_at = <Date 2017-06-10.23:06:19.611>
    labels = ['extension-modules', 'interpreter-core', 'type-bug', '3.7']
    title = 'Incorrect error message for a few functions called with keywod argument'
    updated_at = <Date 2017-06-15.15:08:04.582>
    user = 'https://github.com/SylvainDe'

    bugs.python.org fields:

    activity = <Date 2017-06-15.15:08:04.582>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-15.15:08:04.582>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules', 'Interpreter Core']
    creation = <Date 2017-06-10.23:06:19.611>
    creator = 'SylvainDe'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30627
    keywords = []
    message_count = 3.0
    messages = ['295676', '295677', '295686']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'SylvainDe']
    pr_nums = ['2115']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30627'
    versions = ['Python 3.7']

    @SylvainDe
    Copy link
    Mannequin Author

    SylvainDe mannequin commented Jun 10, 2017

    Follow-up for http://bugs.python.org/issue30600 which is itself a follow-up for http://bugs.python.org/issue30534 . Not quite sure what the process is in that situation : creating a new ticket or updating the old one ?

    After working on http://bugs.python.org/issue30600 , I thought that maybe other functions not generated by the clinic would have the same issue. "git grep _PyArg_NoStackKeywords | grep -v clinic" gave me some place to look for and indeed:

    Modules/_struct.c: if (!_PyArg_NoStackKeywords("pack", kwnames)) {
    Modules/_struct.c: if (!_PyArg_NoStackKeywords("pack_into", kwnames)) {
    Python/bltinmodule.c: if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
    Python/bltinmodule.c: if (!_PyArg_NoStackKeywords("next", kwnames)) {

    These four functions have a not-so-good error message when called with keyword arguments (and this is a regression compared to other Python versions)

    I have a fix ready to be suggested but:

    • I want to be sure that I had to create a new ticket

    • I suspect functions defined via the GEN_CONSTRUCTOR macro in Modules/_hashopenssl.c have the same issue but I do not know how to test it. Any help is welcome.

    @SylvainDe SylvainDe mannequin added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jun 10, 2017
    @SylvainDe
    Copy link
    Mannequin Author

    SylvainDe mannequin commented Jun 10, 2017

    (Also, I suspect introspection could be used to know if the same bug is still lying somewhere: get all objects (using gc?), keep callables with no __code__ member only, call with keyword argument, check error.)

    @serhiy-storchaka
    Copy link
    Member

    Good catch SylvainDe!

    You already opened a new ticked and old tickets are closed, so that let fix remaining issues here.

    This issue is related to _PyArg_NoKeywords() and _PyArg_NoStackKeywords(), so it is enough to just check all usages of these functions. Most of them are in generated code and already fixed.

    Tests for all these functions are not required.

    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Jun 11, 2017
    @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
    3.7 (EOL) end of life extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant