Skip to content

Conversation

@ericsnowcurrently
Copy link
Member

@ericsnowcurrentlyericsnowcurrently commented Apr 25, 2023

We do two things here: immortalize the builtin structseq types, and immortalize tp_dict, tp_bases, and tp_mro for builtin types. This is necessary for a per-interpreter GIL.

Note that we could also take the approach to immortalization that no immortal object should ever be freed, even if allocated dynamically. That's something we'll sort out as soon as we can. In the meantime, the change here takes care of isolation concerns.

@ericsnowcurrentlyericsnowcurrently changed the title gh-84436: Immortalized Objectsgh-84436: Improve Immortalization for Builtin TypesApr 25, 2023
@ericsnowcurrentlyericsnowcurrently added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 25, 2023
ericsnowcurrently added a commit that referenced this pull request May 3, 2023
…3912) his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses. Those three fields are effectively const for builtin static types (unlike tp_subclasses). In theory we only need to make their values immortal, along with their contents. However, that isn't such a simple proposition. (See gh-103823.) In the meantime the simplest solution is to move the fields into the interpreter. One alternative is to statically allocate the values, but that's its own can of worms.
@zwarezware removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 5, 2023
Sign up for freeto 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

@ericsnowcurrently@zware@bedevere-bot