Skip to content

GH-106485: Create object's dict-values instead of creating __dict__, when we can. #107843

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

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Aug 10, 2023

When assigning to an attribute of an object with Py_TPFLAGS_MANAGED_DICT that lacked either a values array or a __dict__,
we currently create a __dict__.
This PR allocates a values array instead.

In an ideal world, we would allocate the values array when we allocate the object.
But that will require better integration of the VM, allocator and GC. So that's for another PR in the future.

@markshannon markshannon requested a review from methane as a code owner August 10, 2023 14:08
@markshannon markshannon changed the title Create object's dict-values instead of creating __dict__, when we can. GH-106485: Create object's dict-values instead of creating __dict__, when we can. Aug 10, 2023
@markshannon
Copy link
Member Author

Skipping news as this is a strictly internal feature.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@markshannon markshannon merged commit 666b68e into python:main Aug 11, 2023
@markshannon markshannon deleted the always-allocate-value-for-managed-dict-objects branch September 26, 2023 12:56
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.

3 participants