Skip to content

Commit 22985ca

Browse files
Merge remote-tracking branch 'origin/main' into capi-errors
2 parents 4e4f7df + bf7bb1b commit 22985ca

22 files changed

Lines changed: 1352 additions & 241 deletions

.github/workflows/ci.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ env:
3939
jobs:
4040
determine_changes:
4141
name: Determine changes
42-
runs-on: ubuntu-latest
42+
runs-on: ubuntu-slim
4343
outputs:
4444
# Flag that is raised when any rust code is changed.
4545
rust_code: ${{ steps.check_rust_code.outputs.changed }}
@@ -107,6 +107,8 @@ jobs:
107107
restore-keys: |
108108
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
109109
${{ runner.os }}-stable--
110+
# Windows runners randomly crashes, https://github.com/actions/cache/issues/1754
111+
continue-on-error: true
110112

111113
- name: Install macOS dependencies
112114
uses: ./.github/actions/install-macos-deps
@@ -173,7 +175,7 @@ jobs:
173175
) || github.ref == 'refs/heads/main'
174176
strategy:
175177
matrix:
176-
include:
178+
include:
177179
- os: ubuntu-latest
178180
target: aarch64-linux-android
179181
- os: ubuntu-latest
@@ -330,6 +332,8 @@ jobs:
330332
restore-keys: |
331333
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
332334
${{ runner.os }}-stable--
335+
# Windows runners randomly crashes, https://github.com/actions/cache/issues/1754
336+
continue-on-error: true
333337

334338
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
335339

@@ -474,6 +478,8 @@ jobs:
474478
restore-keys: |
475479
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
476480
${{ runner.os }}-stable--
481+
# Windows runners randomly crashes, https://github.com/actions/cache/issues/1754
482+
continue-on-error: true
477483

478484
- name: Clippy
479485
run: cargo clippy --keep-going ${{ env.CARGO_ARGS }} --workspace --all-targets ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings

Cargo.lock

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

Cargo.toml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ rustyline = { workspace = true }
5454

5555
[dev-dependencies]
5656
criterion = { workspace = true }
57-
pyo3 = { version = "0.28.2", features = ["auto-initialize"] }
57+
pyo3 = { workspace = true, features = ["auto-initialize"] }
5858
rustpython-stdlib = { workspace = true }
5959
ruff_python_parser = { workspace = true }
6060

@@ -186,7 +186,8 @@ bitflags = "2.11.0"
186186
bitflagset = "0.0.3"
187187
bstr = "1"
188188
bzip2 = "0.6"
189-
chrono = { version = "0.4.44", default-features = false, features = ["clock", "oldtime", "std"] }
189+
caseless = "0.2.2"
190+
chrono = { version = "0.4.44", default-features = false, features = ["clock", "std"] }
190191
constant_time_eq = "0.4"
191192
cranelift = "0.131.0"
192193
cranelift-jit = "0.131.1"
@@ -198,12 +199,16 @@ csv-core = "0.1.11"
198199
digest = "0.10.7"
199200
dns-lookup = "3.0"
200201
dyn-clone = "1.0.10"
202+
exitcode = "1.1.2"
203+
errno = "0.3"
201204
flame = "0.2.2"
205+
flamer = "0.5"
202206
flate2 = { version = "1.1.9", default-features = false }
203207
foreign-types-shared = "0.3.1"
204208
gethostname = "1.0.2"
205209
getrandom = { version = "0.3", features = ["std"] }
206210
glob = "0.3"
211+
half = "2"
207212
hex = "0.4.3"
208213
hexf-parse = "0.2.1"
209214
hmac = "0.12"
@@ -215,6 +220,7 @@ junction = "1.4.2"
215220
lexical-parse-float = "1.0.6"
216221
libc = "0.2.186"
217222
libffi = "5"
223+
libloading = "0.9"
218224
liblzma = "0.4"
219225
liblzma-sys = "0.4"
220226
libsqlite3-sys = "0.37"
@@ -234,9 +240,10 @@ mt19937 = "<=3.2" # upgrade it once rand is upgraded
234240
num-complex = "0.4.6"
235241
num-integer = "0.1.46"
236242
num-traits = "0.2"
243+
num_cpus = "1.17.0"
237244
num_enum = { version = "0.7", default-features = false }
238245
oid-registry = "0.8"
239-
openssl = "0.10.78"
246+
openssl = "0.10.79"
240247
openssl-sys = "0.9.110"
241248
openssl-probe = "0.2.1"
242249
optional = "0.5"
@@ -247,12 +254,15 @@ pbkdf2 = "0.12"
247254
pem-rfc7468 = "1.0"
248255
pkcs8 = "0.10"
249256
proc-macro2 = "1.0.105"
257+
psm = "0.1"
250258
pymath = { version = "0.2.0", features = ["mul_add", "malachite-bigint", "complex"] }
259+
pyo3 = "0.28"
251260
quote = "1.0.45"
252261
radium = "1.1.1"
253262
rand = "0.9"
254263
rand_core = { version = "0.9", features = ["os_rng"] }
255-
rustix = { version = "1.1", features = ["event"] }
264+
result-like = "0.5.0"
265+
rustix = { version = "1.1", features = ["event", "system"] }
256266
rustls = { version = "0.23.39", default-features = false }
257267
rustls-native-certs = "0.8"
258268
rustls-pemfile = "2.2"
@@ -276,6 +286,7 @@ tcl-sys = { git = "https://github.com/arihant2math/tkinter.git", tag = "v0.2.0"
276286
textwrap = { version = "0.16.2", default-features = false }
277287
termios = "0.3.3"
278288
thiserror = "2.0"
289+
timsort = "0.1.2"
279290
tk-sys = { git = "https://github.com/arihant2math/tkinter.git", tag = "v0.2.0" }
280291
icu_properties = "2"
281292
icu_normalizer = "2"
@@ -288,6 +299,7 @@ widestring = "1.2.0"
288299
windows-sys = "0.61.2"
289300
wasm-bindgen = "0.2.106"
290301
webpki-roots = "1.0"
302+
which = "8"
291303
x509-cert = "0.2.5"
292304
x509-parser = "0.18"
293305
xml = "1.2"

Lib/test/test_charmapcodec.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ def codec_search_function(encoding):
2020
return tuple(testcodec.getregentry())
2121
return None
2222

23-
codecs.register(codec_search_function)
24-
2523
# test codec's name (see test/testcodec.py)
2624
codecname = 'testcodec'
2725

2826
class CharmapCodecTest(unittest.TestCase):
27+
28+
def setUp(self):
29+
codecs.register(codec_search_function)
30+
self.addCleanup(codecs.unregister, codec_search_function)
31+
2932
def test_constructorx(self):
3033
self.assertEqual(str(b'abc', codecname), 'abc')
3134
self.assertEqual(str(b'xdef', codecname), 'abcdef')

Lib/test/test_complex.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def assertAlmostEqual(self, a, b):
7272
else:
7373
unittest.TestCase.assertAlmostEqual(self, a, b)
7474

75-
def assertCloseAbs(self, x, y, eps=1e-9):
76-
"""Return true iff floats x and y "are close"."""
75+
def assertClose(self, x, y, eps=1e-9):
76+
"""Return true iff complexes x and y "are close"."""
7777
# put the one with larger magnitude second
7878
if abs(x) > abs(y):
7979
x, y = y, x
@@ -82,26 +82,15 @@ def assertCloseAbs(self, x, y, eps=1e-9):
8282
if x == 0:
8383
return abs(y) < eps
8484
# check that relative difference < eps
85-
self.assertTrue(abs((x-y)/y) < eps)
86-
87-
def assertClose(self, x, y, eps=1e-9):
88-
"""Return true iff complexes x and y "are close"."""
89-
self.assertCloseAbs(x.real, y.real, eps)
90-
self.assertCloseAbs(x.imag, y.imag, eps)
85+
self.assertTrue(abs(x-y)/abs(y) < eps)
9186

9287
def check_div(self, x, y):
9388
"""Compute complex z=x*y, and check that z/x==y and z/y==x."""
9489
z = x * y
95-
if x != 0:
96-
q = z / x
97-
self.assertClose(q, y)
98-
q = z.__truediv__(x)
99-
self.assertClose(q, y)
100-
if y != 0:
101-
q = z / y
102-
self.assertClose(q, x)
103-
q = z.__truediv__(y)
104-
self.assertClose(q, x)
90+
if x:
91+
self.assertClose(z / x, y)
92+
if y:
93+
self.assertClose(z / y, x)
10594

10695
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: floats nan and inf are not identical
10796
def test_truediv(self):
@@ -116,10 +105,20 @@ def test_truediv(self):
116105
self.check_div(complex(1e200, 1e200), 1+0j)
117106
self.check_div(complex(1e-200, 1e-200), 1+0j)
118107

108+
# Smith's algorithm has several sources of inaccuracy
109+
# for components of the result. In examples below,
110+
# it's cancellation of digits in computation of sum.
111+
self.check_div(1e-09+1j, 1+1j)
112+
self.check_div(8.289760544677449e-09+0.13257307440728516j,
113+
0.9059966714925808+0.5054864708672686j)
114+
119115
# Just for fun.
120116
for i in range(100):
121-
self.check_div(complex(random(), random()),
122-
complex(random(), random()))
117+
x = complex(random(), random())
118+
y = complex(random(), random())
119+
self.check_div(x, y)
120+
y = complex(1e10*y.real, y.imag)
121+
self.check_div(x, y)
123122

124123
self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j)
125124
self.assertRaises(TypeError, operator.truediv, 1j, None)
@@ -457,7 +456,7 @@ def test_boolcontext(self):
457456
self.assertTrue(1j)
458457

459458
def test_conjugate(self):
460-
self.assertClose(complex(5.3, 9.8).conjugate(), 5.3-9.8j)
459+
self.assertEqual(complex(5.3, 9.8).conjugate(), 5.3-9.8j)
461460

462461
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: DeprecationWarning not triggered
463462
def test_constructor(self):

0 commit comments

Comments
 (0)