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

Add _PyObject_VectorcallMethod() function #81518

Closed
jdemeyer opened this issue Jun 19, 2019 · 6 comments
Closed

Add _PyObject_VectorcallMethod() function #81518

jdemeyer opened this issue Jun 19, 2019 · 6 comments

Comments

@jdemeyer
Copy link
Contributor

BPO 37337
Nosy @encukou, @methane, @markshannon, @jdemeyer, @ZackerySpytz
PRs
  • bpo-37337: Add _PyObject_VectorcallMethod() #14228
  • bpo-37337: Add _PyObject_CallMethodNoArgs() #14267
  • bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c #14814
  • 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 2019-07-08.08:29:02.702>
    created_at = <Date 2019-06-19.09:35:31.586>
    labels = []
    title = 'Add _PyObject_VectorcallMethod() function'
    updated_at = <Date 2019-08-14.05:51:09.280>
    user = 'https://github.com/jdemeyer'

    bugs.python.org fields:

    activity = <Date 2019-08-14.05:51:09.280>
    actor = 'methane'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-07-08.08:29:02.702>
    closer = 'petr.viktorin'
    components = []
    creation = <Date 2019-06-19.09:35:31.586>
    creator = 'jdemeyer'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37337
    keywords = ['patch']
    message_count = 6.0
    messages = ['346032', '346816', '347487', '347490', '348065', '349648']
    nosy_count = 5.0
    nosy_names = ['petr.viktorin', 'methane', 'Mark.Shannon', 'jdemeyer', 'ZackerySpytz']
    pr_nums = ['14228', '14267', '14814']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37337'
    versions = []

    @jdemeyer
    Copy link
    Contributor Author

    To augment the various PyObject_CallMethod...() functions, we add _PyObject_VectorcallMethod() which uses the vectorcall calling convention. To be consistent with the other vectorcall functions, this function is provisional for now.

    For efficiency, the "self" argument is NOT passed as separate argument but as part of the usual args array. In other words, the call looks like an unbound method call.

    I am also adding _PyObject_VectorcallMethodId() taking a _Py_Identifier* as argument and convenience functions PyObject_CallMethodNoArgs() and _PyObject_CallMethodIdNoArgs(), analogous to the recently added PyObject_CallNoArgs().

    @methane
    Copy link
    Member

    methane commented Jun 28, 2019

    New changeset b1263d5 by Inada Naoki (Jeroen Demeyer) in branch 'master':
    bpo-37337: Add _PyObject_VectorcallMethod() (GH-14228)
    b1263d5

    @methane
    Copy link
    Member

    methane commented Jul 8, 2019

    New changeset 762f93f by Inada Naoki (Jeroen Demeyer) in branch 'master':
    bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
    762f93f

    @encukou
    Copy link
    Member

    encukou commented Jul 8, 2019

    Thank you, Jeroen and INADA-san!

    @encukou encukou closed this as completed Jul 8, 2019
    @ZackerySpytz
    Copy link
    Mannequin

    ZackerySpytz mannequin commented Jul 17, 2019

    Commit b1263d5 causes GCC 9.1.0 to give a warning in Objects/descrobject.c.

    Objects/descrobject.c:1050:19: warning: cast between incompatible function types from ‘PyObject * ()(mappingproxyobject *, PyObject * const, Py_ssize_t)’ {aka ‘struct _object * ()(struct <anonymous> *, struct _object * const, long int)’} to ‘PyObject * ()(PyObject *, PyObject *)’ {aka ‘struct _object * ()(struct _object *, struct _object *)’} [-Wcast-function-type]
    1050 | {"get", (PyCFunction)mappingproxy_get, METH_FASTCALL,
    | ^

    PR 14814 fixes this.

    @methane
    Copy link
    Member

    methane commented Aug 14, 2019

    New changeset 43d564c by Inada Naoki (Zackery Spytz) in branch 'master':
    bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c (GH-14814)
    43d564c

    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants