From a4629db52064b7380415985fc12b362b3665c29e Mon Sep 17 00:00:00 2001 From: MrrRaph Date: Wed, 11 Jan 2023 15:56:27 +0100 Subject: [PATCH 1/4] Added UTF-8 encoding when opening a file --- whats_left.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whats_left.py b/whats_left.py index 46517468db..0c1426bf96 100755 --- a/whats_left.py +++ b/whats_left.py @@ -441,7 +441,7 @@ def remove_one_indent(s): compare_src = inspect.getsourcelines(compare)[0][1:] output += "".join(remove_one_indent(line) for line in compare_src) -with open(GENERATED_FILE, "w") as f: +with open(GENERATED_FILE, "w", encoding='utf-8') as f: f.write(output + "\n") From 371b5e2a6ed67c3823695878484e6e735cffbd5c Mon Sep 17 00:00:00 2001 From: MrrRaph Date: Wed, 11 Jan 2023 16:02:22 +0100 Subject: [PATCH 2/4] Fixed type mismatchs --- stdlib/src/ssl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/src/ssl.rs b/stdlib/src/ssl.rs index c7726203cd..ec1c52fef8 100644 --- a/stdlib/src/ssl.rs +++ b/stdlib/src/ssl.rs @@ -121,7 +121,7 @@ mod _ssl { #[pyattr] const PROTO_MAXIMUM_SUPPORTED: i32 = ProtoVersion::MaxSupported as i32; #[pyattr] - const OP_ALL: libc::c_ulong = sys::SSL_OP_ALL & !sys::SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS; + const OP_ALL: libc::c_ulong = (sys::SSL_OP_ALL & !sys::SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) as _; #[pyattr] const HAS_TLS_UNIQUE: bool = true; #[pyattr] From 5df8d29fe433cfd1039776c1e456ff08eb04a917 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 17 Feb 2023 22:25:17 +0900 Subject: [PATCH 3/4] Add whats_left running to CI --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a06efd52cf..ccc1ad6ed9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -295,6 +295,8 @@ jobs: run: | mkdir site-packages target/release/rustpython --install-pip ensurepip --user + - name: Check whats_left is not broken + run: python -I whats_left.py lalrpop: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} @@ -361,8 +363,6 @@ jobs: run: cd wasm && git ls-files -z | xargs -0 prettier --check -u - name: Check update_asdl.sh consistency run: bash scripts/update_asdl.sh && git diff --exit-code - - name: Check whats_left is not broken - run: python -I whats_left.py miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} From daca1f38cf0b2a12329caa2f54f323c4671deabe Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 17 Feb 2023 23:26:02 +0900 Subject: [PATCH 4/4] Fix cspell warnings --- .cspell.json | 9 ++++++++- vm/src/builtins/type.rs | 14 +++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.cspell.json b/.cspell.json index 090b581c1a..f1b9b7f6d7 100644 --- a/.cspell.json +++ b/.cspell.json @@ -80,11 +80,13 @@ "rdiv", "idiv", "ndim", + "unionable", "varnames", "getweakrefs", "getweakrefcount", "stacklevel", "MemoryView", + "metatype", "warningregistry", "defaultaction", "unraisablehook", @@ -129,7 +131,12 @@ "posonlyargs", "kwonlyargs", "uninit", - "miri" + "miri", + // cpython + "linearise", + "dictoffset", + "heaptype", + "IMMUTABLETYPE" ], // flagWords - list of words to be always considered incorrect "flagWords": [ diff --git a/vm/src/builtins/type.rs b/vm/src/builtins/type.rs index a4db53225b..1ab0f72e27 100644 --- a/vm/src/builtins/type.rs +++ b/vm/src/builtins/type.rs @@ -868,11 +868,11 @@ impl PyType { })?; } - if let Some(initter) = typ.get_super_attr(identifier!(vm, __init_subclass__)) { - let initter = vm - .call_get_descriptor_specific(initter.clone(), None, Some(typ.clone().into())) - .unwrap_or(Ok(initter))?; - vm.invoke(&initter, kwargs)?; + if let Some(init_subclass) = typ.get_super_attr(identifier!(vm, __init_subclass__)) { + let init_subclass = vm + .call_get_descriptor_specific(init_subclass.clone(), None, Some(typ.clone().into())) + .unwrap_or(Ok(init_subclass))?; + vm.invoke(&init_subclass, kwargs)?; }; Ok(typ.into()) @@ -1156,14 +1156,14 @@ fn take_next_base(bases: &mut [Vec]) -> Option { } fn linearise_mro(mut bases: Vec>) -> Result, String> { - vm_trace!("Linearising MRO: {:?}", bases); + vm_trace!("Linearise MRO: {:?}", bases); // Python requires that the class direct bases are kept in the same order. // This is called local precedence ordering. // This means we must verify that for classes A(), B(A) we must reject C(A, B) even though this // algorithm will allow the mro ordering of [C, B, A, object]. // To verify this, we make sure non of the direct bases are in the mro of bases after them. for (i, base_mro) in bases.iter().enumerate() { - let base = &base_mro[0]; // Mros cannot be empty. + let base = &base_mro[0]; // MROs cannot be empty. for later_mro in &bases[i + 1..] { // We start at index 1 to skip direct bases. // This will not catch duplicate bases, but such a thing is already tested for.