Skip to content

Commit 2cbb5b3

Browse files
authored
Merge branch 'main' into enable-wasm-dynamic-linking
2 parents fc10e5f + 2dac9e6 commit 2cbb5b3

32 files changed

+1863
-1893
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ Doc/howto/clinic.rst @erlend-aasland @AA-Turner
126126
# C Analyser
127127
Tools/c-analyzer/ @ericsnowcurrently
128128

129+
# C API Documentation Checks
130+
Tools/check-c-api-docs/ @ZeroIntensity
131+
129132
# Fuzzing
130133
Modules/_xxtestfuzz/ @ammaraskar
131134

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ jobs:
142142
- name: Check for unsupported C global variables
143143
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
144144
run: make check-c-globals
145+
- name: Check for undocumented C APIs
146+
run: make check-c-api-docs
147+
145148

146149
build-windows:
147150
name: >-

Include/internal/pycore_ceval.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,64 @@ _PyForIter_VirtualIteratorNext(PyThreadState* tstate, struct _PyInterpreterFrame
408408

409409
PyAPI_DATA(const _Py_CODEUNIT *) _Py_INTERPRETER_TRAMPOLINE_INSTRUCTIONS_PTR;
410410

411+
/* Helper functions for large uops */
412+
413+
PyAPI_FUNC(PyObject *)
414+
_Py_VectorCall_StackRefSteal(
415+
_PyStackRef callable,
416+
_PyStackRef *arguments,
417+
int total_args,
418+
_PyStackRef kwnames);
419+
420+
PyAPI_FUNC(PyObject *)
421+
_Py_BuiltinCallFast_StackRefSteal(
422+
_PyStackRef callable,
423+
_PyStackRef *arguments,
424+
int total_args);
425+
426+
PyAPI_FUNC(PyObject *)
427+
_Py_BuiltinCallFastWithKeywords_StackRefSteal(
428+
_PyStackRef callable,
429+
_PyStackRef *arguments,
430+
int total_args);
431+
432+
PyAPI_FUNC(PyObject *)
433+
_PyCallMethodDescriptorFast_StackRefSteal(
434+
_PyStackRef callable,
435+
PyMethodDef *meth,
436+
PyObject *self,
437+
_PyStackRef *arguments,
438+
int total_args);
439+
440+
PyAPI_FUNC(PyObject *)
441+
_PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
442+
_PyStackRef callable,
443+
PyMethodDef *meth,
444+
PyObject *self,
445+
_PyStackRef *arguments,
446+
int total_args);
447+
448+
PyAPI_FUNC(PyObject *)
449+
_Py_CallBuiltinClass_StackRefSteal(
450+
_PyStackRef callable,
451+
_PyStackRef *arguments,
452+
int total_args);
453+
454+
PyAPI_FUNC(PyObject *)
455+
_Py_BuildString_StackRefSteal(
456+
_PyStackRef *arguments,
457+
int total_args);
458+
459+
PyAPI_FUNC(PyObject *)
460+
_Py_BuildMap_StackRefSteal(
461+
_PyStackRef *arguments,
462+
int half_args);
463+
464+
PyAPI_FUNC(void)
465+
_Py_assert_within_stack_bounds(
466+
_PyInterpreterFrame *frame, _PyStackRef *stack_pointer,
467+
const char *filename, int lineno);
468+
411469
#ifdef __cplusplus
412470
}
413471
#endif

Include/internal/pycore_jit.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ extern "C" {
1313
# error "this header requires Py_BUILD_CORE define"
1414
#endif
1515

16+
/* To be able to reason about code layout and branches, keep code size below 1 MB */
17+
#define PY_MAX_JIT_CODE_SIZE ((1 << 20)-1)
18+
1619
#ifdef _Py_JIT
1720

1821
typedef _Py_CODEUNIT *(*jit_func)(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate);

Include/internal/pycore_uop.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ typedef struct _PyUOpInstruction{
3636
} _PyUOpInstruction;
3737

3838
// This is the length of the trace we translate initially.
39+
#ifdef Py_DEBUG
40+
// With asserts, the stencils are a lot larger
41+
#define UOP_MAX_TRACE_LENGTH 1000
42+
#else
3943
#define UOP_MAX_TRACE_LENGTH 3000
44+
#endif
4045
#define UOP_BUFFER_SIZE (UOP_MAX_TRACE_LENGTH * sizeof(_PyUOpInstruction))
4146

4247
/* Bloom filter with m = 256

Include/modsupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ PyAPI_FUNC(int) PyABIInfo_Check(PyABIInfo *info, const char *module_name);
132132
) \
133133
/////////////////////////////////////////////////////////
134134

135-
#define _PyABIInfo_DEFAULT() { \
135+
#define _PyABIInfo_DEFAULT { \
136136
1, 0, \
137137
PyABIInfo_DEFAULT_FLAGS, \
138138
PY_VERSION_HEX, \

Lib/test/datetimetester.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6300,21 +6300,21 @@ def test_vilnius_1941_fromutc(self):
63006300

63016301
gdt = datetime(1941, 6, 23, 20, 59, 59, tzinfo=timezone.utc)
63026302
ldt = gdt.astimezone(Vilnius)
6303-
self.assertEqual(ldt.strftime("%c %Z%z"),
6303+
self.assertEqual(ldt.strftime("%a %b %d %H:%M:%S %Y %Z%z"),
63046304
'Mon Jun 23 23:59:59 1941 MSK+0300')
63056305
self.assertEqual(ldt.fold, 0)
63066306
self.assertFalse(ldt.dst())
63076307

63086308
gdt = datetime(1941, 6, 23, 21, tzinfo=timezone.utc)
63096309
ldt = gdt.astimezone(Vilnius)
6310-
self.assertEqual(ldt.strftime("%c %Z%z"),
6310+
self.assertEqual(ldt.strftime("%a %b %d %H:%M:%S %Y %Z%z"),
63116311
'Mon Jun 23 23:00:00 1941 CEST+0200')
63126312
self.assertEqual(ldt.fold, 1)
63136313
self.assertTrue(ldt.dst())
63146314

63156315
gdt = datetime(1941, 6, 23, 22, tzinfo=timezone.utc)
63166316
ldt = gdt.astimezone(Vilnius)
6317-
self.assertEqual(ldt.strftime("%c %Z%z"),
6317+
self.assertEqual(ldt.strftime("%a %b %d %H:%M:%S %Y %Z%z"),
63186318
'Tue Jun 24 00:00:00 1941 CEST+0200')
63196319
self.assertEqual(ldt.fold, 0)
63206320
self.assertTrue(ldt.dst())
@@ -6324,22 +6324,22 @@ def test_vilnius_1941_toutc(self):
63246324

63256325
ldt = datetime(1941, 6, 23, 22, 59, 59, tzinfo=Vilnius)
63266326
gdt = ldt.astimezone(timezone.utc)
6327-
self.assertEqual(gdt.strftime("%c %Z"),
6327+
self.assertEqual(gdt.strftime("%a %b %d %H:%M:%S %Y %Z"),
63286328
'Mon Jun 23 19:59:59 1941 UTC')
63296329

63306330
ldt = datetime(1941, 6, 23, 23, 59, 59, tzinfo=Vilnius)
63316331
gdt = ldt.astimezone(timezone.utc)
6332-
self.assertEqual(gdt.strftime("%c %Z"),
6332+
self.assertEqual(gdt.strftime("%a %b %d %H:%M:%S %Y %Z"),
63336333
'Mon Jun 23 20:59:59 1941 UTC')
63346334

63356335
ldt = datetime(1941, 6, 23, 23, 59, 59, tzinfo=Vilnius, fold=1)
63366336
gdt = ldt.astimezone(timezone.utc)
6337-
self.assertEqual(gdt.strftime("%c %Z"),
6337+
self.assertEqual(gdt.strftime("%a %b %d %H:%M:%S %Y %Z"),
63386338
'Mon Jun 23 21:59:59 1941 UTC')
63396339

63406340
ldt = datetime(1941, 6, 24, 0, tzinfo=Vilnius)
63416341
gdt = ldt.astimezone(timezone.utc)
6342-
self.assertEqual(gdt.strftime("%c %Z"),
6342+
self.assertEqual(gdt.strftime("%a %b %d %H:%M:%S %Y %Z"),
63436343
'Mon Jun 23 22:00:00 1941 UTC')
63446344

63456345
def test_constructors(self):

Lib/test/test_dict.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,14 @@ def __eq__(self, other):
16211621

16221622
self.assertEqual(len(d), 1)
16231623

1624+
def test_split_table_update_with_str_subclass(self):
1625+
class MyStr(str): pass
1626+
class MyClass: pass
1627+
obj = MyClass()
1628+
obj.attr = 1
1629+
obj.__dict__[MyStr('attr')] = 2
1630+
self.assertEqual(obj.attr, 2)
1631+
16241632

16251633
class CAPITest(unittest.TestCase):
16261634

0 commit comments

Comments
 (0)