Skip to content

Conversation

bersbersbers
Copy link
Contributor

Close #14722

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
Copy link
Collaborator

srittau commented Sep 15, 2025

I'm a bit wary of annotating this with | None unconditionally. In normal cases (i.e. before close() was called), buf cannot be None. It might be a better idea to annotate this with | MaybeNone, although the negative primer hits might indicate that this isn't a problem. I'm open to other opinions.

@bersbersbers
Copy link
Contributor Author

I have no preference - I hadn't even heard of MaybeNone until now.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Ok, let's try None for now. We can always loosen it if it turns out to cause problems.

@srittau srittau merged commit 9b7a31d into python:main Sep 16, 2025
63 checks passed
@bersbersbers bersbersbers deleted the optional-shm-buf branch September 17, 2025 18:19
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.

SharedMemory.buf should be optional (is None after SharedMemory.close()

2 participants