From 88cbe52e81995a039111833eb852f099a89e1b60 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Fri, 4 Apr 2025 11:32:03 -0700 Subject: [PATCH 1/7] more cspell fixes --- .cspell.json | 12 +++++++++++- wtf8/src/lib.rs | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.cspell.json b/.cspell.json index caa53a2879..9196a291d0 100644 --- a/.cspell.json +++ b/.cspell.json @@ -50,6 +50,7 @@ // RustPython "aiterable", "alnum", + "awaitpromise", "baseclass", "boxvec", "Bytecode", @@ -67,8 +68,12 @@ "GetSet", "groupref", "internable", + "jserr", + "jsresult", + "lossily", "makeunicodedata", "miri", + "nonoverlapping", "notrace", "openat", "pyarg", @@ -96,21 +101,26 @@ "PyResult", "pyslot", "PyStaticMethod", + "pystone", "pystr", "pystruct", "pystructseq", "pytrace", "reducelib", "richcompare", + "rustpy", "RustPython", "struc", + "surrogateescape", "sysmodule", "tracebacks", "typealiases", - "Unconstructible", + "ufrexp", + "unconstructible", "unhashable", "uninit", "unraisable", + "unresizable", "wasi", "zelf", // unix diff --git a/wtf8/src/lib.rs b/wtf8/src/lib.rs index 3ba28a5146..73b5168453 100644 --- a/wtf8/src/lib.rs +++ b/wtf8/src/lib.rs @@ -757,7 +757,7 @@ impl Wtf8 { /// Create a WTF-8 slice from a WTF-8 byte slice. // - // whooops! using WTF-8 for interchange! + // whoops! using WTF-8 for interchange! #[inline] pub fn from_bytes(b: &[u8]) -> Option<&Self> { let mut rest = b; From 431d4a847b9b929384c232a06a95bfc4a266675b Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Thu, 10 Apr 2025 10:11:03 -0700 Subject: [PATCH 2/7] Update .cspell.json Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com> --- .cspell.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/.cspell.json b/.cspell.json index 9196a291d0..f88244d353 100644 --- a/.cspell.json +++ b/.cspell.json @@ -68,8 +68,6 @@ "GetSet", "groupref", "internable", - "jserr", - "jsresult", "lossily", "makeunicodedata", "miri", From 5351f1aa3062159e1a91b2d0f3990ec9a6a7679c Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Thu, 10 Apr 2025 10:14:18 -0700 Subject: [PATCH 3/7] address comments --- .cspell.dict/rust-more.txt | 1 + .cspell.json | 4 ---- wasm/lib/src/js_module.rs | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.cspell.dict/rust-more.txt b/.cspell.dict/rust-more.txt index 99e87e532c..e92f1ff8c1 100644 --- a/.cspell.dict/rust-more.txt +++ b/.cspell.dict/rust-more.txt @@ -43,6 +43,7 @@ modpow msvc muldiv nanos +nonoverlapping objclass peekable powc diff --git a/.cspell.json b/.cspell.json index f88244d353..c5bb0f1a91 100644 --- a/.cspell.json +++ b/.cspell.json @@ -47,10 +47,8 @@ // words - list of words to be always considered correct "words": [ "RUSTPYTHONPATH", - // RustPython "aiterable", "alnum", - "awaitpromise", "baseclass", "boxvec", "Bytecode", @@ -71,7 +69,6 @@ "lossily", "makeunicodedata", "miri", - "nonoverlapping", "notrace", "openat", "pyarg", @@ -109,7 +106,6 @@ "rustpy", "RustPython", "struc", - "surrogateescape", "sysmodule", "tracebacks", "typealiases", diff --git a/wasm/lib/src/js_module.rs b/wasm/lib/src/js_module.rs index f159c467d0..5a3ac4025b 100644 --- a/wasm/lib/src/js_module.rs +++ b/wasm/lib/src/js_module.rs @@ -575,7 +575,7 @@ mod _js { Some(prom) => { if val.is_some() { Err(vm.new_type_error( - "can't send non-None value to an awaitpromise".to_owned(), + "can't send non-None value to an AwaitPromise".to_owned(), )) } else { Ok(PyIterReturn::Return(prom)) From e8e7daaf63c6b8af8354cd3539b7875754ef56c7 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Thu, 10 Apr 2025 10:17:04 -0700 Subject: [PATCH 4/7] rename ufrexp to decompose_float --- .cspell.json | 1 - common/src/float_ops.rs | 2 +- common/src/hash.rs | 2 +- stdlib/src/math.rs | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.cspell.json b/.cspell.json index c5bb0f1a91..72d3eefbb0 100644 --- a/.cspell.json +++ b/.cspell.json @@ -109,7 +109,6 @@ "sysmodule", "tracebacks", "typealiases", - "ufrexp", "unconstructible", "unhashable", "uninit", diff --git a/common/src/float_ops.rs b/common/src/float_ops.rs index 46e2d57067..b3c90d0ac6 100644 --- a/common/src/float_ops.rs +++ b/common/src/float_ops.rs @@ -2,7 +2,7 @@ use malachite_bigint::{BigInt, ToBigInt}; use num_traits::{Float, Signed, ToPrimitive, Zero}; use std::f64; -pub fn ufrexp(value: f64) -> (f64, i32) { +pub fn decompose_float(value: f64) -> (f64, i32) { if 0.0 == value { (0.0, 0i32) } else { diff --git a/common/src/hash.rs b/common/src/hash.rs index 1ae561650c..88af9b6f56 100644 --- a/common/src/hash.rs +++ b/common/src/hash.rs @@ -97,7 +97,7 @@ pub fn hash_float(value: f64) -> Option { }; } - let frexp = super::float_ops::ufrexp(value); + let frexp = super::float_ops::decompose_float(value); // process 28 bits at a time; this should work well both for binary // and hexadecimal floating point. diff --git a/stdlib/src/math.rs b/stdlib/src/math.rs index a7da60949c..4854bdd75e 100644 --- a/stdlib/src/math.rs +++ b/stdlib/src/math.rs @@ -557,7 +557,7 @@ mod math { fn frexp(x: ArgIntoFloat) -> (f64, i32) { let value = *x; if value.is_finite() { - let (m, exp) = float_ops::ufrexp(value); + let (m, exp) = float_ops::decompose_float(value); (m * value.signum(), exp) } else { (value, 0) From e3c0cacdb3e0f808d12615450b9cd0a4848fe292 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Thu, 10 Apr 2025 10:22:37 -0700 Subject: [PATCH 5/7] fix typos and rename rustpy to rustpython --- .cspell.json | 1 - Lib/test/test_bytes.py | 4 ++-- Lib/test/test_sqlite3/test_dbapi.py | 2 +- benches/execution.rs | 6 +++--- benches/microbenchmarks.rs | 4 ++-- wasm/demo/src/index.js | 6 +++--- wasm/notebook/src/index.js | 6 +++--- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.cspell.json b/.cspell.json index 72d3eefbb0..489c40069e 100644 --- a/.cspell.json +++ b/.cspell.json @@ -103,7 +103,6 @@ "pytrace", "reducelib", "richcompare", - "rustpy", "RustPython", "struc", "sysmodule", diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index baf84642ee..cc1affc669 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -1992,7 +1992,7 @@ def test_join(self): s3 = s1.join([b"abcd"]) self.assertIs(type(s3), self.basetype) - @unittest.skip("TODO: RUSTPYHON, Fails on ByteArraySubclassWithSlotsTest") + @unittest.skip("TODO: RUSTPYTHON, Fails on ByteArraySubclassWithSlotsTest") def test_pickle(self): a = self.type2test(b"abcd") a.x = 10 @@ -2007,7 +2007,7 @@ def test_pickle(self): self.assertEqual(type(a.z), type(b.z)) self.assertFalse(hasattr(b, 'y')) - @unittest.skip("TODO: RUSTPYHON, Fails on ByteArraySubclassWithSlotsTest") + @unittest.skip("TODO: RUSTPYTHON, Fails on ByteArraySubclassWithSlotsTest") def test_copy(self): a = self.type2test(b"abcd") a.x = 10 diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index bbc151fcb7..56cd8f8a68 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -591,7 +591,7 @@ def test_connection_bad_reinit(self): ((v,) for v in range(3))) -@unittest.skip("TODO: RUSTPYHON") +@unittest.skip("TODO: RUSTPYTHON") class UninitialisedConnectionTests(unittest.TestCase): def setUp(self): self.cx = sqlite.Connection.__new__(sqlite.Connection) diff --git a/benches/execution.rs b/benches/execution.rs index d38dab0890..88e5e3650b 100644 --- a/benches/execution.rs +++ b/benches/execution.rs @@ -18,7 +18,7 @@ fn bench_cpython_code(b: &mut Bencher, source: &str) { }) } -fn bench_rustpy_code(b: &mut Bencher, name: &str, source: &str) { +fn bench_rustpython_code(b: &mut Bencher, name: &str, source: &str) { // NOTE: Take long time. let mut settings = Settings::default(); settings.path_list.push("Lib/".to_string()); @@ -41,7 +41,7 @@ pub fn benchmark_file_execution(group: &mut BenchmarkGroup, name: &str bench_cpython_code(b, contents) }); group.bench_function(BenchmarkId::new(name, "rustpython"), |b| { - bench_rustpy_code(b, name, contents) + bench_rustpython_code(b, name, contents) }); } @@ -77,7 +77,7 @@ pub fn benchmark_pystone(group: &mut BenchmarkGroup, contents: String) bench_cpython_code(b, code_str) }); group.bench_function(BenchmarkId::new("rustpython", idx), |b| { - bench_rustpy_code(b, "pystone", code_str) + bench_rustpython_code(b, "pystone", code_str) }); } } diff --git a/benches/microbenchmarks.rs b/benches/microbenchmarks.rs index 6f41f00d6c..c62ecf239a 100644 --- a/benches/microbenchmarks.rs +++ b/benches/microbenchmarks.rs @@ -104,7 +104,7 @@ fn cpy_compile_code<'a>( compile.call1((code, name, "exec"))?.extract() } -fn bench_rustpy_code(group: &mut BenchmarkGroup, bench: &MicroBenchmark) { +fn bench_rustpython_code(group: &mut BenchmarkGroup, bench: &MicroBenchmark) { let mut settings = Settings::default(); settings.path_list.push("Lib/".to_string()); settings.write_bytecode = false; @@ -169,7 +169,7 @@ pub fn run_micro_benchmark(c: &mut Criterion, benchmark: MicroBenchmark) { let mut group = c.benchmark_group("microbenchmarks"); bench_cpython_code(&mut group, &benchmark); - bench_rustpy_code(&mut group, &benchmark); + bench_rustpython_code(&mut group, &benchmark); group.finish(); } diff --git a/wasm/demo/src/index.js b/wasm/demo/src/index.js index 1af847d59d..0b568fa1d9 100644 --- a/wasm/demo/src/index.js +++ b/wasm/demo/src/index.js @@ -13,10 +13,10 @@ let rp; // A dependency graph that contains any wasm must be imported asynchronously. import('rustpython') - .then((rustpy) => { - rp = rustpy; + .then((rustpython) => { + rp = rustpython; // so people can play around with it - window.rp = rustpy; + window.rp = rustpython; onReady(); }) .catch((e) => { diff --git a/wasm/notebook/src/index.js b/wasm/notebook/src/index.js index 422bc4d0d6..64b058a9ac 100644 --- a/wasm/notebook/src/index.js +++ b/wasm/notebook/src/index.js @@ -34,10 +34,10 @@ let rp; // A dependency graph that contains any wasm must be imported asynchronously. import('rustpython') - .then((rustpy) => { - rp = rustpy; + .then((rustpython) => { + rp = rustpython; // so people can play around with it - window.rp = rustpy; + window.rp = rustpython; onReady(); }) .catch((e) => { From 3909ebe659ed13b9c8ea354dc325909fa6e203a3 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Thu, 10 Apr 2025 10:26:20 -0700 Subject: [PATCH 6/7] fix cspell --- .cspell.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cspell.json b/.cspell.json index 489c40069e..26e33bdfd4 100644 --- a/.cspell.json +++ b/.cspell.json @@ -105,6 +105,8 @@ "richcompare", "RustPython", "struc", + // plural of summand + "summands", "sysmodule", "tracebacks", "typealiases", From 1a61296040132ea9b450fa1a9459bdaf54c0a0ed Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Fri, 11 Apr 2025 09:36:54 +0900 Subject: [PATCH 7/7] Update .cspell.json --- .cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.cspell.json b/.cspell.json index 26e33bdfd4..69ace83483 100644 --- a/.cspell.json +++ b/.cspell.json @@ -47,6 +47,7 @@ // words - list of words to be always considered correct "words": [ "RUSTPYTHONPATH", + // RustPython terms "aiterable", "alnum", "baseclass",