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 46c8081

Browse filesBrowse files
authored
Revert "gh-115432: Add critical section variant that handles a NULL object (#115433)" (#118861)
This reverts commit ad4f909. The API ended up not being used.
1 parent 68fbc00 commit 46c8081
Copy full SHA for 46c8081

File tree

2 files changed

+0
-38
lines changed
Filter options

2 files changed

+0
-38
lines changed

‎Include/internal/pycore_critical_section.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_critical_section.h
-29Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,6 @@ extern "C" {
9999
_PyCriticalSection_End(&_cs); \
100100
}
101101

102-
# define Py_XBEGIN_CRITICAL_SECTION(op) \
103-
{ \
104-
_PyCriticalSection _cs_opt = {0}; \
105-
_PyCriticalSection_XBegin(&_cs_opt, _PyObject_CAST(op))
106-
107-
# define Py_XEND_CRITICAL_SECTION() \
108-
_PyCriticalSection_XEnd(&_cs_opt); \
109-
}
110-
111102
# define Py_BEGIN_CRITICAL_SECTION2(a, b) \
112103
{ \
113104
_PyCriticalSection2 _cs2; \
@@ -144,8 +135,6 @@ extern "C" {
144135
# define Py_BEGIN_CRITICAL_SECTION_MUT(mut)
145136
# define Py_BEGIN_CRITICAL_SECTION(op)
146137
# define Py_END_CRITICAL_SECTION()
147-
# define Py_XBEGIN_CRITICAL_SECTION(op)
148-
# define Py_XEND_CRITICAL_SECTION()
149138
# define Py_BEGIN_CRITICAL_SECTION2(a, b)
150139
# define Py_END_CRITICAL_SECTION2()
151140
# define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex)
@@ -202,16 +191,6 @@ _PyCriticalSection_Begin(_PyCriticalSection *c, PyMutex *m)
202191
}
203192
}
204193

205-
static inline void
206-
_PyCriticalSection_XBegin(_PyCriticalSection *c, PyObject *op)
207-
{
208-
#ifdef Py_GIL_DISABLED
209-
if (op != NULL) {
210-
_PyCriticalSection_Begin(c, &_PyObject_CAST(op)->ob_mutex);
211-
}
212-
#endif
213-
}
214-
215194
// Removes the top-most critical section from the thread's stack of critical
216195
// sections. If the new top-most critical section is inactive, then it is
217196
// resumed.
@@ -234,14 +213,6 @@ _PyCriticalSection_End(_PyCriticalSection *c)
234213
_PyCriticalSection_Pop(c);
235214
}
236215

237-
static inline void
238-
_PyCriticalSection_XEnd(_PyCriticalSection *c)
239-
{
240-
if (c->mutex) {
241-
_PyCriticalSection_End(c);
242-
}
243-
}
244-
245216
static inline void
246217
_PyCriticalSection2_Begin(_PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2)
247218
{

‎Modules/_testinternalcapi/test_critical_sections.c

Copy file name to clipboardExpand all lines: Modules/_testinternalcapi/test_critical_sections.c
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ test_critical_sections(PyObject *self, PyObject *Py_UNUSED(args))
4949
Py_END_CRITICAL_SECTION2();
5050
assert_nogil(!PyMutex_IsLocked(&d2->ob_mutex));
5151

52-
// Optional variant behaves the same if the object is non-NULL
53-
Py_XBEGIN_CRITICAL_SECTION(d1);
54-
assert_nogil(PyMutex_IsLocked(&d1->ob_mutex));
55-
Py_XEND_CRITICAL_SECTION();
56-
57-
// No-op
58-
Py_XBEGIN_CRITICAL_SECTION(NULL);
59-
Py_XEND_CRITICAL_SECTION();
60-
6152
Py_DECREF(d2);
6253
Py_DECREF(d1);
6354
Py_RETURN_NONE;

0 commit comments

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