Skip to content

Conversation

@encukou
Copy link

@encukou encukou commented Jun 24, 2019

I see two issues with python#13781:

  • PyCFunction's vectorcall implementations are only used in methodobject.c,
    so IMO they should be moved there and made static.
  • The big macros make debugging harder. Can we do without magically defined
    variables and return from macros?
    I'd prefer somewhat longer, but more straightforward code.

I made these changes, so I'm sending a PR to your branch. I didn't yet have time
to polish them; feel free to work change them if you agree.

@jdemeyer
Copy link
Owner

Just a few comments:

  1. There is no point in declaring vectorcall_FASTCALL and friends as inline. They are called through a function pointer, inlining is meaningless.
  2. I suggest more verbose names like cfunction_vectorcall_FASTCALL instead, especially for the GDB implementation (there may be other functions called vectorcall_foo, unrelated to PyCFunctionObject.
  3. For PyCFunctionObject, there already helpers for accessing members like PyCFunction_GET_FUNCTION and PyCFunction_GET_SELF.
  4. I suggest return -1 in case of an exception, to follow the more common CPython convention.

Please let me know whether you plan to fix these, otherwise I will.

@encukou
Copy link
Author

encukou commented Jun 25, 2019

Right on all counts.
I'll most likely not get to do the changes this week. If you have the time, go ahead!

@jdemeyer
Copy link
Owner

OK, I will do it in the next days.

@jdemeyer jdemeyer merged this pull request into jdemeyer:pycfunction_vectorcall Jun 26, 2019
@encukou encukou deleted the jdemeyer-pycfunction_vectorcall branch July 5, 2019 12:44
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

Successfully merging this pull request may close these issues.

2 participants