-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
clarify in types.rst that FunctionTypes & co constructors don't have stable signature #81077
Comments
From bpo-36886, IT is unclear the FunctionTypes, CodeTypes ... etc are not stable between python versions, and the recent addition of This suggest 2 things:
|
In msg342227 Pablo Galindo Salgado said "I am +1 to such a sentence, but I think this is a decision that more core devs should agree on."
At least Petr Vidtorin and I disagree with this part. As Petr wrote on pydev thread "Expected stability of PyCode_New() and types.CodeType() signatures", there are multiple tools that instantiate code objects, in particular Cython, which is far from being a rogue project. Python is a 'consenting adults' languages, and we generally do not officially tell people what they are 'supposed' to do or not do. |
Although I completely agree with the decision of figuring out an explicit consensus regarding these APIs, I will explain a bit my +1: My +1 is not about the usage of PyCode_New, is about the usage of The more we expose and call "stable" regarding internals, the less freedom we will have to apply optimizations and add additional data members to internal structures. With this, I am not saying that we should say that whoever uses this is a "roge" project but marking these APIs as stable will greatly restrict future changes. |
Victor recently implemented CodeType.replace(); which I believe will cover many of the usecase. Should I also send a PR that update the DocStrings of (some of) ? these objects? many people don't go and read the html docs... |
Pablo, I am all for respectfully preserving implementation freedom where we can. From idlelib.__init__: [idlelib files other than idle*.*] "are private implementations. Their details are subject to change. See PEP-434 for more. Import them at your own risk." Matthias: I don't believe we put version changed notes in docstrings, as they are for the current code. But if a docstring covers arguments, as usual, then the new one should be added. |
Oh no I was thinking a note in the docstring "constructor signature may change between Python versions". Whether to put changed/addition info in docstrings is another subject and a thing I would be in favor of; but let's not digress and the current issue which is to convey to users the non-stability of interface. |
Yes, I think " Not for the faint of heart." could be replaced or augmented by 'api may change' |
Would it be the right place to document the new CodeType.replace() method which is designed to help to write "future-proof" code? (not rely on the exact constructor API) |
CodeType.replace() was documented in https://bugs.python.org/issue37032. |
Somehow related: @encukou wrote PEP 689 "Unstable C API tier": https://peps.python.org/pep-0689/ |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: