Skip to content

Commit 84781b4

Browse files
Merge branch 'main' into llvm-20
2 parents 13e9f5b + a15aeec commit 84781b4

File tree

22 files changed

+387
-260
lines changed

22 files changed

+387
-260
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ repos:
3434
name: Run Ruff (format) on Tools/build/check_warnings.py
3535
args: [--check, --config=Tools/build/.ruff.toml]
3636
files: ^Tools/build/check_warnings.py
37+
- id: ruff-format
38+
name: Run Ruff (format) on Tools/wasm/
39+
args: [--check, --config=Tools/wasm/.ruff.toml]
40+
files: ^Tools/wasm/
3741

3842
- repo: https://github.com/psf/black-pre-commit-mirror
3943
rev: 25.9.0

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/cpython/sliceobject.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef Py_CPYTHON_SLICEOBJECT_H
2+
# error "this header file must not be included directly"
3+
#endif
4+
5+
/* Slice object interface */
6+
7+
/*
8+
A slice object containing start, stop, and step data members (the
9+
names are from range). After much talk with Guido, it was decided to
10+
let these be any arbitrary python type. Py_None stands for omitted values.
11+
*/
12+
typedef struct {
13+
PyObject_HEAD
14+
PyObject *start, *stop, *step; /* not NULL */
15+
} PySliceObject;
16+
17+
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
18+
PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
19+
PyObject **start_ptr, PyObject **stop_ptr,
20+
PyObject **step_ptr);

Include/cpython/structseq.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef Py_CPYTHON_STRUCTSEQ_H
2+
# error "this header file must not be included directly"
3+
#endif
4+
5+
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
6+
PyStructSequence_Desc *desc);
7+
PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
8+
PyStructSequence_Desc *desc);
9+
10+
typedef PyTupleObject PyStructSequence;
11+
#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
12+
#define PyStructSequence_GET_ITEM PyStructSequence_GetItem

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.

Include/sliceobject.h

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,13 @@ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
1616

1717
/* Slice object interface */
1818

19-
/*
20-
21-
A slice object containing start, stop, and step data members (the
22-
names are from range). After much talk with Guido, it was decided to
23-
let these be any arbitrary python type. Py_None stands for omitted values.
24-
*/
25-
#ifndef Py_LIMITED_API
26-
typedef struct {
27-
PyObject_HEAD
28-
PyObject *start, *stop, *step; /* not NULL */
29-
} PySliceObject;
30-
#endif
31-
3219
PyAPI_DATA(PyTypeObject) PySlice_Type;
3320
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
3421

3522
#define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
3623

3724
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
3825
PyObject* step);
39-
#ifndef Py_LIMITED_API
40-
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
41-
PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
42-
PyObject **start_ptr, PyObject **stop_ptr,
43-
PyObject **step_ptr);
44-
#endif
4526
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
4627
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
4728
Py_DEPRECATED(3.7)
@@ -63,6 +44,12 @@ PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
6344
Py_ssize_t step);
6445
#endif
6546

47+
#ifndef Py_LIMITED_API
48+
# define Py_CPYTHON_SLICEOBJECT_H
49+
# include "cpython/sliceobject.h"
50+
# undef Py_CPYTHON_SLICEOBJECT_H
51+
#endif
52+
6653
#ifdef __cplusplus
6754
}
6855
#endif

Include/structseq.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ typedef struct PyStructSequence_Desc {
2121

2222
PyAPI_DATA(const char * const) PyStructSequence_UnnamedField;
2323

24-
#ifndef Py_LIMITED_API
25-
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
26-
PyStructSequence_Desc *desc);
27-
PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
28-
PyStructSequence_Desc *desc);
29-
#endif
3024
PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
3125

3226
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
@@ -35,9 +29,9 @@ PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
3529
PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
3630

3731
#ifndef Py_LIMITED_API
38-
typedef PyTupleObject PyStructSequence;
39-
#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
40-
#define PyStructSequence_GET_ITEM PyStructSequence_GetItem
32+
# define Py_CPYTHON_STRUCTSEQ_H
33+
# include "cpython/structseq.h"
34+
# undef Py_CPYTHON_STRUCTSEQ_H
4135
#endif
4236

4337
#ifdef __cplusplus

0 commit comments

Comments
 (0)