8000 gh-128421: Add locking to most frame object functions by colesbury · Pull Request #131479 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-128421: Add locking to most frame object functions #131479

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

Merged
merged 6 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
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
Next Next commit
Add missing critical sections
  • Loading branch information
colesbury committed Mar 20, 2025
commit e404ece69582f2c099f3826baceb03c9b1a2380a
22 changes: 19 additions & 3 deletions Objects/clinic/frameobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@
}

/*[clinic input]
@critical_section
@getter
frame.f_trace_opcodes as frame_trace_opcodes

Expand All @@ -1087,19 +1088,20 @@

static PyObject *
frame_trace_opcodes_get_impl(PyFrameObject *self)
/*[clinic end generated code: output=53ff41d09cc32e87 input=1ce9af95c28e903f]*/
/*[clinic end generated code: output=53ff41d09cc32e87 input=4eb91dc88e04677a]*/
{
return self->f_trace_opcodes ? Py_True : Py_False;
}

/*[clinic input]
@critical_section
@setter
frame.f_trace_opcodes as frame_trace_opcodes
[clinic start generated code]*/

static int
frame_trace_opcodes_set_impl(PyFrameObject *self, PyObject *value)
/*[clinic end generated code: output=92619da2bfccd449 input=0b0f3df0ef997359]*/
/*[clinic end generated code: output=92619da2bfccd449 input=7e286eea3c0333ff]*/
{
if (!PyBool_Check(value)) {
PyErr_SetString(PyExc_TypeError,
Expand Down Expand Up @@ -1793,6 +1795,7 @@
}

/*[clinic input]
@critical_section
@getter
frame.f_trace as frame_trace

Expand All @@ -1801,7 +1804,7 @@

static PyObject *
frame_trace_get_impl(PyFrameObject *self)
/*[clinic end generated code: output=5475cbfce07826cd input=7b47c6f37b8ad405]*/
/*[clinic end generated code: output=5475cbfce07826cd input=f382612525829773]*/
{
PyObject* trace = self->f_trace;
if (trace == NULL) {
Expand All @@ -1811,13 +1814,14 @@
}

/*[clinic input]
@critical_section
@setter
frame.f_trace as frame_trace
[clinic start generated code]*/

static int
frame_trace_set_impl(PyFrameObject *self, PyObject *value)
/*[clinic end generated code: output=d6fe08335cf76ae4 input=3476aee610ee0aef]*/
/*[clinic end generated code: output=d6fe08335cf76ae4 input=d96a18bda085707f]*/
{
if (value == Py_None) {
value = NULL;
Expand Down Expand Up @@ -2355,23 +2359,23 @@
PyFrame_GetLocals(PyFrameObject *frame)
{
assert(!_PyFrame_IsIncomplete(frame->f_frame));
return frame_locals_get_impl(frame);
return frame_locals_get(frame, NULL);
}

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_locals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2364 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]
PyObject*
PyFrame_GetGlobals(PyFrameObject *frame)
{
assert(!_PyFrame_IsIncomplete(frame->f_frame));
return frame_globals_get_impl(frame);
return frame_globals_get(frame, NULL);
}

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_globals_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2371 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]
PyObject*
PyFrame_GetBuiltins(PyFrameObject *frame)
{
assert(!_PyFrame_IsIncomplete(frame->f_frame));
return frame_builtins_get_impl(frame);
return frame_builtins_get(frame, NULL);
}

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘frame_builtins_get’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 2378 in Objects/frameobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': incompatible types - from 'PyFrameObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]
int
PyFrame_GetLasti(PyFrameObject *frame)
{
Expand Down
Loading
0