Skip to content

Commit 802df3e

Browse files
authored
Merge branch 'main' into fix-complex_pow-117999
2 parents 5d4f11a + 38c3cf6 commit 802df3e

File tree

9 files changed

+41
-39
lines changed

9 files changed

+41
-39
lines changed

Lib/sysconfig/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,9 @@ def expand_makefile_vars(s, vars):
718718
"""
719719
import re
720720

721+
_findvar1_rx = r"\$\(([A-Za-z][A-Za-z0-9_]*)\)"
722+
_findvar2_rx = r"\${([A-Za-z][A-Za-z0-9_]*)}"
723+
721724
# This algorithm does multiple expansion, so if vars['foo'] contains
722725
# "${bar}", it will expand ${foo} to ${bar}, and then expand
723726
# ${bar}... and so forth. This is fine as long as 'vars' comes from

Lib/test/test_ctypes/test_c_simple_type_meta.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ class Sub2(Sub):
5454
pass
5555

5656
self.assertIsInstance(POINTER(Sub2), p_meta)
57-
self.assertTrue(issubclass(POINTER(Sub2), Sub2))
58-
self.assertTrue(issubclass(POINTER(Sub2), POINTER(Sub)))
59-
self.assertTrue(issubclass(POINTER(Sub), POINTER(CtBase)))
57+
self.assertIsSubclass(POINTER(Sub2), Sub2)
58+
self.assertIsSubclass(POINTER(Sub2), POINTER(Sub))
59+
self.assertIsSubclass(POINTER(Sub), POINTER(CtBase))
6060

6161
def test_creating_pointer_in_dunder_new_2(self):
6262
# A simpler variant of the above, used in `CoClass` of the `comtypes`
@@ -84,7 +84,7 @@ class Sub(CtBase):
8484
pass
8585

8686
self.assertIsInstance(POINTER(Sub), p_meta)
87-
self.assertTrue(issubclass(POINTER(Sub), Sub))
87+
self.assertIsSubclass(POINTER(Sub), Sub)
8888

8989
def test_creating_pointer_in_dunder_init_1(self):
9090
class ct_meta(type):
@@ -120,9 +120,9 @@ class Sub2(Sub):
120120
pass
121121

122122
self.assertIsInstance(POINTER(Sub2), p_meta)
123-
self.assertTrue(issubclass(POINTER(Sub2), Sub2))
124-
self.assertTrue(issubclass(POINTER(Sub2), POINTER(Sub)))
125-
self.assertTrue(issubclass(POINTER(Sub), POINTER(CtBase)))
123+
self.assertIsSubclass(POINTER(Sub2), Sub2)
124+
self.assertIsSubclass(POINTER(Sub2), POINTER(Sub))
125+
self.assertIsSubclass(POINTER(Sub), POINTER(CtBase))
126126

127127
def test_creating_pointer_in_dunder_init_2(self):
128128
class ct_meta(type):
@@ -149,4 +149,4 @@ class Sub(CtBase):
149149
pass
150150

151151
self.assertIsInstance(POINTER(Sub), p_meta)
152-
self.assertTrue(issubclass(POINTER(Sub), Sub))
152+
self.assertIsSubclass(POINTER(Sub), Sub)

Lib/test/test_ctypes/test_loading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_1703286_B(self):
135135
'test specific to Windows')
136136
def test_load_hasattr(self):
137137
# bpo-34816: shouldn't raise OSError
138-
self.assertFalse(hasattr(ctypes.windll, 'test'))
138+
self.assertNotHasAttr(ctypes.windll, 'test')
139139

140140
@unittest.skipUnless(os.name == "nt",
141141
'test specific to Windows')

Lib/test/test_ctypes/test_repr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class ReprTest(unittest.TestCase):
2222
def test_numbers(self):
2323
for typ in subclasses:
2424
base = typ.__bases__[0]
25-
self.assertTrue(repr(base(42)).startswith(base.__name__))
26-
self.assertEqual("<X object at", repr(typ(42))[:12])
25+
self.assertStartsWith(repr(base(42)), base.__name__)
26+
self.assertStartsWith(repr(typ(42)), "<X object at")
2727

2828
def test_char(self):
2929
self.assertEqual("c_char(b'x')", repr(c_char(b'x')))
30-
self.assertEqual("<X object at", repr(X(b'x'))[:12])
30+
self.assertStartsWith(repr(X(b'x')), "<X object at")
3131

3232

3333
if __name__ == "__main__":

Lib/test/test_embed.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,6 @@ def test_init_compat_env(self):
10491049
'use_hash_seed': True,
10501050
'hash_seed': 42,
10511051
'tracemalloc': 2,
1052-
'perf_profiling': 0,
10531052
'import_time': True,
10541053
'code_debug_ranges': False,
10551054
'malloc_stats': True,
@@ -1086,7 +1085,6 @@ def test_init_python_env(self):
10861085
'use_hash_seed': True,
10871086
'hash_seed': 42,
10881087
'tracemalloc': 2,
1089-
'perf_profiling': 0,
10901088
'import_time': True,
10911089
'code_debug_ranges': False,
10921090
'malloc_stats': True,

Lib/test/test_long.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,6 @@ def equivalent_python(byte_array, byteorder, signed=False):
14701470
b'\x00': 0,
14711471
b'\x00\x00': 0,
14721472
b'\x01': 1,
1473-
b'\x00\x01': 256,
14741473
b'\xff': -1,
14751474
b'\xff\xff': -1,
14761475
b'\x81': -127,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a :exc:`NameError` in :func:`!sysconfig.expand_makefile_vars`. Patch by
2+
Bénédikt Tran.

Objects/clinic/exceptions.c.h

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4256,7 +4256,7 @@ _PyException_AddNote(PyObject *exc, PyObject *note)
42564256
Py_TYPE(exc)->tp_name);
42574257
return -1;
42584258
}
4259-
PyObject *r = BaseException_add_note(_PyBaseExceptionObject_cast(exc), note);
4259+
PyObject *r = BaseException_add_note(exc, note);
42604260
int res = r == NULL ? -1 : 0;
42614261
Py_XDECREF(r);
42624262
return res;

0 commit comments

Comments
 (0)