Skip to content

Commit 5a77f02

Browse files
authored
gh-79315: Remove Include/pylock.h and Include/monitoring.h (#139731)
Keep Include/cpython/pylock.h and Include/cpython/monitoring.h.
1 parent 1cf2260 commit 5a77f02

File tree

9 files changed

+30
-48
lines changed

9 files changed

+30
-48
lines changed

Include/Python.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ __pragma(warning(disable: 4201))
7878
#include "pybuffer.h"
7979
#include "pystats.h"
8080
#include "pyatomic.h"
81-
#include "pylock.h"
81+
#include "cpython/pylock.h"
8282
#include "critical_section.h"
8383
#include "object.h"
8484
#include "refcount.h"
@@ -105,7 +105,7 @@ __pragma(warning(disable: 4201))
105105
#include "setobject.h"
106106
#include "methodobject.h"
107107
#include "moduleobject.h"
108-
#include "monitoring.h"
108+
#include "cpython/monitoring.h"
109109
#include "cpython/funcobject.h"
110110
#include "cpython/classobject.h"
111111
#include "fileobject.h"

Include/cpython/monitoring.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
#ifndef Py_CPYTHON_MONITORING_H
2-
# error "this header file must not be included directly"
1+
#ifndef Py_MONITORING_H
2+
#define Py_MONITORING_H
3+
#ifndef Py_LIMITED_API
4+
#ifdef __cplusplus
5+
extern "C" {
36
#endif
47

8+
// There is currently no limited API for monitoring
9+
10+
511
/* Local events.
612
* These require bytecode instrumentation */
713

@@ -267,3 +273,9 @@ PyMonitoring_FireStopIterationEvent(PyMonitoringState *state, PyObject *codelike
267273
}
268274

269275
#undef _PYMONITORING_IF_ACTIVE
276+
277+
#ifdef __cplusplus
278+
}
279+
#endif
280+
#endif // !Py_LIMITED_API
281+
#endif // !Py_MONITORING_H

Include/cpython/pylock.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
#ifndef Py_CPYTHON_LOCK_H
2-
# error "this header file must not be included directly"
1+
#ifndef Py_LOCK_H
2+
#define Py_LOCK_H
3+
#ifndef Py_LIMITED_API
4+
#ifdef __cplusplus
5+
extern "C" {
36
#endif
47

8+
59
#define _Py_UNLOCKED 0
610
#define _Py_LOCKED 1
711

@@ -72,3 +76,10 @@ _PyMutex_IsLocked(PyMutex *m)
7276
return (_Py_atomic_load_uint8(&m->_bits) & _Py_LOCKED) != 0;
7377
}
7478
#define PyMutex_IsLocked _PyMutex_IsLocked
79+
80+
81+
#ifdef __cplusplus
82+
}
83+
#endif
84+
#endif // !Py_LIMITED_API
85+
#endif // !Py_LOCK_H

Include/monitoring.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

Include/pylock.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

Makefile.pre.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,14 +1191,12 @@ PYTHON_HEADERS= \
11911191
$(srcdir)/Include/intrcheck.h \
11921192
$(srcdir)/Include/iterobject.h \
11931193
$(srcdir)/Include/listobject.h \
1194-
$(srcdir)/Include/pylock.h \
11951194
$(srcdir)/Include/longobject.h \
11961195
$(srcdir)/Include/marshal.h \
11971196
$(srcdir)/Include/memoryobject.h \
11981197
$(srcdir)/Include/methodobject.h \
11991198
$(srcdir)/Include/modsupport.h \
12001199
$(srcdir)/Include/moduleobject.h \
1201-
$(srcdir)/Include/monitoring.h \
12021200
$(srcdir)/Include/object.h \
12031201
$(srcdir)/Include/objimpl.h \
12041202
$(srcdir)/Include/opcode.h \

Modules/_testcapi/monitoring.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include "parts.h"
22
#include "util.h"
33

4-
#include "monitoring.h"
5-
64
#define Py_BUILD_CORE
75
#include "internal/pycore_instruments.h"
86

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
<ClInclude Include="..\Include\cpython\memoryobject.h" />
173173
<ClInclude Include="..\Include\cpython\methodobject.h" />
174174
<ClInclude Include="..\Include\cpython\modsupport.h" />
175+
<ClInclude Include="..\Include\cpython\monitoring.h" />
175176
<ClInclude Include="..\Include\cpython\object.h" />
176177
<ClInclude Include="..\Include\cpython\objimpl.h" />
177178
<ClInclude Include="..\Include\cpython\odictobject.h" />
@@ -334,7 +335,6 @@
334335
<ClInclude Include="..\Include\intrcheck.h" />
335336
<ClInclude Include="..\Include\iterobject.h" />
336337
<ClInclude Include="..\Include\listobject.h" />
337-
<ClInclude Include="..\Include\pylock.h" />
338338
<ClInclude Include="..\Include\longobject.h" />
339339
<ClInclude Include="..\Include\marshal.h" />
340340
<ClInclude Include="..\Include\memoryobject.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
<ClInclude Include="..\Include\listobject.h">
121121
<Filter>Include</Filter>
122122
</ClInclude>
123-
<ClInclude Include="..\Include\pylock.h">
124-
<Filter>Include</Filter>
125-
</ClInclude>
126123
<ClInclude Include="..\Include\longobject.h">
127124
<Filter>Include</Filter>
128125
</ClInclude>

0 commit comments

Comments
 (0)