Skip to content

bpo-37249: add declaration of _PyObject_GetMethod#14015

Merged
methane merged 1 commit into
python:masterfrom
jdemeyer:bpo37249
Jun 14, 2019
Merged

bpo-37249: add declaration of _PyObject_GetMethod#14015
methane merged 1 commit into
python:masterfrom
jdemeyer:bpo37249

Conversation

@jdemeyer

@jdemeyer jdemeyer commented Jun 12, 2019

Copy link
Copy Markdown
Contributor

@mangrisano

Copy link
Copy Markdown
Contributor

/cc @methane @msullivan @1st1

Comment thread Include/internal/pycore_object.h Outdated
Comment thread Include/internal/pycore_object.h Outdated
@jdemeyer

Copy link
Copy Markdown
Contributor Author

I'm not actually convinced that _PyObject_GetMethod should be super-internal. For example, Cython literally copied the code of _PyObject_GetMethod from CPython because CPython does not expose it. So maybe we shouldn't actually make it internal.

@methane

methane commented Jun 13, 2019

Copy link
Copy Markdown
Member

I expect further optimization which requires changing this API completely.

For general use, I want more high level API for calling method with vectercall.

So, if expected user is only Cython, please keep copying.

@jdemeyer

Copy link
Copy Markdown
Contributor Author

So, if expected user is only Cython, please keep copying.

OK, got it.

@msullivan

Copy link
Copy Markdown
Contributor

So, if expected user is only Cython, please keep copying.

I'm probably also going to copy it for mypyc at some point, but I think that falls in the same bucket.

@methane

methane commented Jun 13, 2019

Copy link
Copy Markdown
Member

As I send to ML, it seems dllexport doesn't affect calling convention (and calling performance).

It may affects LTO. But I don't think LTO is important here because _PyObject_GetMethod is relatively heavy function.

@methane

methane commented Jun 13, 2019

Copy link
Copy Markdown
Member

If there are at least two users (mypyc and Cython), I'm OK to move it to private/.

@jdemeyer

Copy link
Copy Markdown
Contributor Author

I'm OK to move it to private/.

What do you mean here? There is a directory cpython/ for the default non-limited API and a directory internal/ for the API that is only defined when Py_BUILD_CORE is defined. Which of the two do you mean?

@methane

methane commented Jun 14, 2019

Copy link
Copy Markdown
Member

I'm sorry, there is no private/ directory. As @vstinner said:

Python 3.8 now has a better separation between "private" and "internal" 
APIs:

* private are "_Py" symbols which are exported in the python DLL: they 
should not be used, but can be used techically

* internal are symbols defined in internal header files 
(Include/internal/). Some symbols use PyAPI_FUNC()/PyAPI_DATA(), some 
only use "extern".

So I meant put this API in Include/cpython/object.h, near to _PyObject_GetAttrId.

I will add new really internal API to implement per-opcode cache for LOAD_METHOD,
instead of changing existing _PyObject_GetMethod.

@jdemeyer

Copy link
Copy Markdown
Contributor Author

So I meant put this API in Include/cpython/object.h, near to _PyObject_GetAttrId.

OK, done.

@methane methane merged commit b2f9473 into python:master Jun 14, 2019
@jdemeyer jdemeyer deleted the bpo37249 branch June 17, 2019 09:51
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants