Skip to content

gh-117657: Make frame clearing thread-safe #120542

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

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert generator fixes
  • Loading branch information
Fidget-Spinner committed Jun 21, 2024
commit acc46444a5a949e004bc956fbb1d3ba4ee748970
12 changes: 1 addition & 11 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_*
#include "pycore_pyerrors.h" // _PyErr_ClearExcState()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION

#include "pystats.h"

Expand Down Expand Up @@ -120,7 +119,7 @@ _PyGen_Finalize(PyObject *self)
}

static void
gen_dealloc_no_lock(PyGenObject *gen)
gen_dealloc(PyGenObject *gen)
{
PyObject *self = (PyObject *) gen;

Expand Down Expand Up @@ -159,15 +158,6 @@ gen_dealloc_no_lock(PyGenObject *gen)
PyObject_GC_Del(gen);
}

static void
gen_dealloc(PyGenObject *gen)
{
// Another generator's finalizer might race on clearing the frame.
Py_BEGIN_CRITICAL_SECTION(gen);
gen_dealloc_no_lock(gen);
Py_END_CRITICAL_SECTION();
}

static PySendResult
gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult,
int exc, int closing)
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy