Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
TheMemoryError freelist isn't thread-safe if the GIL is disabled:
Lines 3850 to 3860 in285c1c4
| /* Fetch object from freelist and revive it */ | |
| self=state->memerrors_freelist; | |
| self->args=PyTuple_New(0); | |
| /* This shouldn't happen since the empty tuple is persistent */ | |
| if (self->args==NULL) { | |
| returnNULL; | |
| } | |
| state->memerrors_freelist= (PyBaseExceptionObject*)self->dict; | |
| state->memerrors_numfree--; |
Most of the freelists were made thread-safe by making them per-thread in the free threaded build (usingpycore_freelist.h), but we don't want to do that forMemoryError because its freelist serves a different purpose (it's not really for performance). I think we should just use a lock forMemoryError's freelist.