Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46aa7ef

Browse filesBrowse files
mpagemiss-islington
authored andcommitted
pythongh-117657: Acquire a critical section around SemLock.__{enter,exit}__ (pythonGH-118812)
These methods are purely wrappers around `Semlock.{acquire,release}`, which expect a critical section to be held. (cherry picked from commit c30d8e5) Co-authored-by: mpage <mpage@meta.com>
1 parent 738877a commit 46aa7ef
Copy full SHA for 46aa7ef

File tree

2 files changed

+14
-4
lines changed
Filter options

2 files changed

+14
-4
lines changed

‎Modules/_multiprocessing/clinic/semaphore.c.h

Copy file name to clipboardExpand all lines: Modules/_multiprocessing/clinic/semaphore.c.h
+10-2Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_multiprocessing/semaphore.c

Copy file name to clipboardExpand all lines: Modules/_multiprocessing/semaphore.c
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,19 +682,21 @@ _multiprocessing_SemLock__after_fork_impl(SemLockObject *self)
682682
}
683683

684684
/*[clinic input]
685+
@critical_section
685686
_multiprocessing.SemLock.__enter__
686687
687688
Enter the semaphore/lock.
688689
[clinic start generated code]*/
689690

690691
static PyObject *
691692
_multiprocessing_SemLock___enter___impl(SemLockObject *self)
692-
/*[clinic end generated code: output=beeb2f07c858511f input=c5e27d594284690b]*/
693+
/*[clinic end generated code: output=beeb2f07c858511f input=d35c9860992ee790]*/
693694
{
694695
return _multiprocessing_SemLock_acquire_impl(self, 1, Py_None);
695696
}
696697

697698
/*[clinic input]
699+
@critical_section
698700
_multiprocessing.SemLock.__exit__
699701
700702
exc_type: object = None
@@ -709,7 +711,7 @@ static PyObject *
709711
_multiprocessing_SemLock___exit___impl(SemLockObject *self,
710712
PyObject *exc_type,
711713
PyObject *exc_value, PyObject *exc_tb)
712-
/*[clinic end generated code: output=3b37c1a9f8b91a03 input=7d644b64a89903f8]*/
714+
/*[clinic end generated code: output=3b37c1a9f8b91a03 input=1610c8cc3e0e337e]*/
713715
{
714716
return _multiprocessing_SemLock_release_impl(self);
715717
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.