Skip to content

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 <[email protected]>
@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