Skip to content

Commit eb01d6b

Browse files
authored
Merge branch 'main' into warnings-as-error-2
2 parents 37900e1 + f3bf304 commit eb01d6b

38 files changed

+267
-179
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ A function definition defines a user-defined function object (see section
12221222
parameter_list_no_posonly: `defparameter` ("," `defparameter`)* ["," [`parameter_list_starargs`]]
12231223
: | `parameter_list_starargs`
12241224
parameter_list_starargs: "*" [`star_parameter`] ("," `defparameter`)* ["," [`parameter_star_kwargs`]]
1225-
: "*" ("," `defparameter`)+ ["," [`parameter_star_kwargs`]]
1225+
: | "*" ("," `defparameter`)+ ["," [`parameter_star_kwargs`]]
12261226
: | `parameter_star_kwargs`
12271227
parameter_star_kwargs: "**" `parameter` [","]
12281228
parameter: `identifier` [":" `expression`]

Include/internal/pycore_gc.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,6 @@ union _PyStackRef;
352352
extern int _PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg);
353353
extern int _PyGC_VisitStackRef(union _PyStackRef *ref, visitproc visit, void *arg);
354354

355-
// Like Py_VISIT but for _PyStackRef fields
356-
#define _Py_VISIT_STACKREF(ref) \
357-
do { \
358-
if (!PyStackRef_IsNull(ref)) { \
359-
int vret = _PyGC_VisitStackRef(&(ref), visit, arg); \
360-
if (vret) \
361-
return vret; \
362-
} \
363-
} while (0)
364-
365355
#ifdef Py_GIL_DISABLED
366356
extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
367357
gcvisitobjects_t callback, void *arg);

Include/internal/pycore_genobject.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#include "pycore_interpframe.h" // _PyInterpreterFrame
1211
#include "pycore_interpframe_structs.h" // _PyGenObject
1312

13+
#include <stddef.h> // offsetof()
14+
1415

1516
static inline
1617
PyGenObject *_PyGen_GetGeneratorFromFrame(_PyInterpreterFrame *frame)

Include/internal/pycore_setobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ PyAPI_FUNC(int) _PySet_Contains(PySetObject *so, PyObject *key);
3333
// Clears the set without acquiring locks. Used by _PyCode_Fini.
3434
extern void _PySet_ClearInternal(PySetObject *so);
3535

36+
PyAPI_FUNC(int) _PySet_AddTakeRef(PySetObject *so, PyObject *key);
37+
3638
#ifdef __cplusplus
3739
}
3840
#endif

Include/internal/pycore_stackref.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,16 @@ _Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
658658

659659
#endif
660660

661+
// Like Py_VISIT but for _PyStackRef fields
662+
#define _Py_VISIT_STACKREF(ref) \
663+
do { \
664+
if (!PyStackRef_IsNull(ref)) { \
665+
int vret = _PyGC_VisitStackRef(&(ref), visit, arg); \
666+
if (vret) \
667+
return vret; \
668+
} \
669+
} while (0)
670+
661671
#ifdef __cplusplus
662672
}
663673
#endif

Lib/test/test__interpchannels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import time
77
import unittest
88

9-
from test.support import import_helper
9+
from test.support import import_helper, skip_if_sanitizer
1010

1111
_channels = import_helper.import_module('_interpchannels')
1212
from test.support.interpreters import _crossinterp
@@ -365,6 +365,7 @@ def test_shareable(self):
365365
#self.assertIsNot(got, obj)
366366

367367

368+
@skip_if_sanitizer('gh-129824: race on _waiting_release', thread=True)
368369
class ChannelTests(TestBase):
369370

370371
def test_create_cid(self):

Lib/test/test__interpreters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ def test_unique_id(self):
365365

366366
self.assertEqual(len(seen), 100)
367367

368+
@support.skip_if_sanitizer('gh-129824: race on tp_flags', thread=True)
368369
def test_in_thread(self):
369370
lock = threading.Lock()
370371
id = None

Lib/test/test_capi/test_bytearray.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class CAPITest(unittest.TestCase):
2020
def test_check(self):
2121
# Test PyByteArray_Check()
2222
check = _testlimitedcapi.bytearray_check
23+
self.assertTrue(check(bytearray(b'')))
2324
self.assertTrue(check(bytearray(b'abc')))
2425
self.assertFalse(check(b'abc'))
2526
self.assertTrue(check(ByteArraySubclass(b'abc')))
@@ -33,6 +34,7 @@ def test_check(self):
3334
def test_checkexact(self):
3435
# Test PyByteArray_CheckExact()
3536
check = _testlimitedcapi.bytearray_checkexact
37+
self.assertTrue(check(bytearray(b'')))
3638
self.assertTrue(check(bytearray(b'abc')))
3739
self.assertFalse(check(b'abc'))
3840
self.assertFalse(check(ByteArraySubclass(b'abc')))
@@ -78,7 +80,7 @@ def test_fromobject(self):
7880
def test_size(self):
7981
# Test PyByteArray_Size()
8082
size = _testlimitedcapi.bytearray_size
81-
83+
self.assertEqual(size(bytearray(b'')), 0)
8284
self.assertEqual(size(bytearray(b'abc')), 3)
8385
self.assertEqual(size(ByteArraySubclass(b'abc')), 3)
8486

@@ -89,7 +91,7 @@ def test_size(self):
8991
def test_asstring(self):
9092
"""Test PyByteArray_AsString()"""
9193
asstring = _testlimitedcapi.bytearray_asstring
92-
94+
self.assertEqual(asstring(bytearray(b''), 1), b'\0')
9395
self.assertEqual(asstring(bytearray(b'abc'), 4), b'abc\0')
9496
self.assertEqual(asstring(ByteArraySubclass(b'abc'), 4), b'abc\0')
9597
self.assertEqual(asstring(bytearray(b'abc\0def'), 8), b'abc\0def\0')
@@ -105,6 +107,7 @@ def test_concat(self):
105107
ba = bytearray(b'abc')
106108
self.assertEqual(concat(ba, b'def'), bytearray(b'abcdef'))
107109
self.assertEqual(ba, b'abc')
110+
self.assertEqual(concat(ba, ba), bytearray(b'abcabc'))
108111

109112
self.assertEqual(concat(b'abc', b'def'), bytearray(b'abcdef'))
110113
self.assertEqual(concat(b'a\0b', b'c\0d'), bytearray(b'a\0bc\0d'))

Lib/test/test_capi/test_misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,7 @@ def run_tasks():
14111411
self.assertNotIn(task.requester_tid, runner_tids)
14121412

14131413
@requires_subinterpreters
1414+
@support.skip_if_sanitizer("gh-129824: race on assign_version_tag", thread=True)
14141415
def test_isolated_subinterpreter(self):
14151416
# We exercise the most important permutations.
14161417

Lib/test/test_faulthandler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def test_fatal_error_c_thread(self):
227227
func='faulthandler_fatal_error_thread',
228228
py_fatal_error=True)
229229

230+
@support.skip_if_sanitizer("TSAN itercepts SIGABRT", thread=True)
230231
def test_sigabrt(self):
231232
self.check_fatal_error("""
232233
import faulthandler
@@ -238,6 +239,7 @@ def test_sigabrt(self):
238239

239240
@unittest.skipIf(sys.platform == 'win32',
240241
"SIGFPE cannot be caught on Windows")
242+
@support.skip_if_sanitizer("TSAN itercepts SIGFPE", thread=True)
241243
def test_sigfpe(self):
242244
self.check_fatal_error("""
243245
import faulthandler
@@ -249,6 +251,7 @@ def test_sigfpe(self):
249251

250252
@unittest.skipIf(_testcapi is None, 'need _testcapi')
251253
@unittest.skipUnless(hasattr(signal, 'SIGBUS'), 'need signal.SIGBUS')
254+
@support.skip_if_sanitizer("TSAN itercepts SIGBUS", thread=True)
252255
@skip_segfault_on_android
253256
def test_sigbus(self):
254257
self.check_fatal_error("""
@@ -263,6 +266,7 @@ def test_sigbus(self):
263266

264267
@unittest.skipIf(_testcapi is None, 'need _testcapi')
265268
@unittest.skipUnless(hasattr(signal, 'SIGILL'), 'need signal.SIGILL')
269+
@support.skip_if_sanitizer("TSAN itercepts SIGILL", thread=True)
266270
@skip_segfault_on_android
267271
def test_sigill(self):
268272
self.check_fatal_error("""

0 commit comments

Comments
 (0)