Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-45753: Move function object struct to an internal header.#29516

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

markshannon
Copy link
Member

@markshannonmarkshannon commentedNov 10, 2021
edited by bedevere-bot
Loading

The layout of the function object struct should not be exposed in the API. It is not part of the ABI.

We will want to change the layout to improve performance of Python-to-Python calls and other purposes, and having it in a public header prevents us from doing that.

@encukou does this seem OK to you?

https://bugs.python.org/issue45753

@markshannonmarkshannonforce-pushed themake-function-object-struct-internal branch from4e4def7 to7c3738dCompareNovember 10, 2021 13:09
@markshannonmarkshannon requested a review froma team as acode ownerNovember 10, 2021 13:15
@markshannonmarkshannonforce-pushed themake-function-object-struct-internal branch fromcfa7d3e to2b0075cCompareNovember 10, 2021 13:16
@encukou
Copy link
Member

Not part of the stable ABI, but since it was exposed in the C-API, I expect that people are using it. Thebackwards compatibility policy applies.
If you get an exception from the policy, please add some instructions to "Porting to Python 3.11":https://docs.python.org/3.11/whatsnew/3.11.html#id2

@markshannon
Copy link
MemberAuthor

The struct is exposed in a header file, but that doesn't make it part of the C API.

I've said it before, and I'll say it again: the fields of a struct cannot be part of an API, unless that struct is used as an input to an API function, and even in that case, the meaning of those fields must be documented.

Fishing fields out of a struct has no meaning unless the meaning of those fields is documented.

@encukou
Copy link
Member

The struct is exposed in a header file, but that doesn't make it part of the C API.

Whatis the C API, then?
You know my opinion – the C API is, unfortnately, historically defined by the source/headers.
Your opinion is also consistent.

@markshannon
Copy link
MemberAuthor

Whatis the C API, then? You know my opinion – the C API is, unfortnately, historically defined by the source/headers. Your opinion is also consistent.

The problem is that source/headers cannot define an API by themselves. An API is not just syntax, it is semantics as well.

Why is this not the definition of the C API?https://docs.python.org/3/c-api/index.html

@encukou
Copy link
Member

An API is not just syntax, it is semantics as well.

Right, so you'd also look how CPython uses the API. AFAIK, that's historically how you'd use the underdocumented parts of the API.

As for the "Porting to Python 3.11" section in What's new, I think we should write for a target audience of someone who's inherited an old dusty C extension, and needs to port it without knowing much about the C-API (andespecially the undocumented parts). I suggest writing something forany change of API that's been around for a decade – even if it's private.

@markshannon
Copy link
MemberAuthor

Ok, this is more controversial than I had hoped.
Maybe I'll bundle up moving the function, frame and codeobject headers into a single PEP.

@encukou
Copy link
Member

Thanks. Getting other opinions sounds like the right thing.

@vstinner
Copy link
Member

Maybe I'll bundle up moving the function, frame and codeobject headers into a single PEP.

A PEP to make PyThreadState and PyFrameObject opaque sounds like a good idea. I expect less users of PyFunctionObject, but I didn't look at this structure yet. I'm working on making these structures for 2 years :-)

@vstinner
Copy link
Member

IMO a PEP is a good way to ask for an exception for the PEP 387 policy ;-) So we can consider to implement such PEP in Python 3.11.

@markshannonmarkshannon deleted the make-function-object-struct-internal branchSeptember 26, 2023 12:51
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@markshannon@encukou@vstinner@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp