Skip to content

bpo-43908: Add Py_TPFLAGS_IMMUTABLETYPE flag #25520

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

Merged
merged 10 commits into from
Apr 28, 2021

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 22, 2021

@erlend-aasland erlend-aasland marked this pull request as draft April 26, 2021 08:22
@erlend-aasland erlend-aasland changed the title bpo-43908: Add Py_TPFLAGS_IMMUTABLE flag and use it in arraymodule bpo-43908: Add Py_TPFLAGS_IMMUTABLE flag Apr 26, 2021
@erlend-aasland erlend-aasland marked this pull request as ready for review April 26, 2021 18:50
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland changed the title bpo-43908: Add Py_TPFLAGS_IMMUTABLE flag bpo-43908: Add Py_TPFLAGS_IMMUTABLETYPE flag Apr 26, 2021
@erlend-aasland
Copy link
Contributor Author

@pablogsal are you ok with the PR as it is?

Erlend Egeberg Aasland and others added 3 commits April 28, 2021 17:16
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Erlend Egeberg Aasland and others added 2 commits April 28, 2021 17:37
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

IMO it was important to mention "type attributes cannot be set nor deleted" to explain what "immutable" means. I stop nitpicking, let's move on to add this flag to types recently converted to heap types.

@erlend-aasland
Copy link
Contributor Author

Thanks, @vstinner! I appreciate the doc/comment nitpicking; you're improved the PR considerably.

@vstinner
Copy link
Member

@erlend-aasland: Travis CI failed:

Fixing docs whitespace ... 1 file:

  Doc/c-api/typeobj.rst

Please fix the 1 file(s) with whitespace issues

(on UNIX you can run `make patchcheck` to make the fixes)

@erlend-aasland
Copy link
Contributor Author

@erlend-aasland: Travis CI failed:

Oops, I'll fix it. I normally do make html in the Doc directory to make sure I've got the reST markup right.

@erlend-aasland
Copy link
Contributor Author

FYI, unrelated random ssl test failure on the macOS CI, @vstinner.

@vstinner vstinner merged commit 3b52c8d into python:master Apr 28, 2021
@vstinner
Copy link
Member

Merged, thanks.

@erlend-aasland erlend-aasland deleted the immutable-types branch April 28, 2021 17:08
@pablogsal
Copy link
Member

pablogsal commented Apr 28, 2021

FYI, unrelated random ssl test failure on the macOS CI, @vstinner.

CC: @tiran This is happening white a lot

da-woods pushed a commit to cython/cython that referenced this pull request Jan 1, 2023
Since python/cpython#25520 types are automatically marked as immutable if they are static.
While we still have the Py_TPFLAGS_HEAPTYPE hack in place we need to manually mark our types as immutable.
It's possible to crash Python by trying to modify mutable static types.
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.

7 participants