Skip to content

Commit a5091c5

Browse files
authored
Merge pull request RustPython#4440 from MrrRaph/whats_left_utf8
Fixed UTF-8 encoding for `whats_left.py` and type mismatching in `stdlib/src/ssl.rs`
2 parents c037e17 + daca1f3 commit a5091c5

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

.cspell.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@
8080
"rdiv",
8181
"idiv",
8282
"ndim",
83+
"unionable",
8384
"varnames",
8485
"getweakrefs",
8586
"getweakrefcount",
8687
"stacklevel",
8788
"MemoryView",
89+
"metatype",
8890
"warningregistry",
8991
"defaultaction",
9092
"unraisablehook",
@@ -129,7 +131,12 @@
129131
"posonlyargs",
130132
"kwonlyargs",
131133
"uninit",
132-
"miri"
134+
"miri",
135+
// cpython
136+
"linearise",
137+
"dictoffset",
138+
"heaptype",
139+
"IMMUTABLETYPE"
133140
],
134141
// flagWords - list of words to be always considered incorrect
135142
"flagWords": [

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ jobs:
295295
run: |
296296
mkdir site-packages
297297
target/release/rustpython --install-pip ensurepip --user
298+
- name: Check whats_left is not broken
299+
run: python -I whats_left.py
298300

299301
lalrpop:
300302
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
@@ -361,8 +363,6 @@ jobs:
361363
run: cd wasm && git ls-files -z | xargs -0 prettier --check -u
362364
- name: Check update_asdl.sh consistency
363365
run: bash scripts/update_asdl.sh && git diff --exit-code
364-
- name: Check whats_left is not broken
365-
run: python -I whats_left.py
366366

367367
miri:
368368
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}

stdlib/src/ssl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ mod _ssl {
121121
#[pyattr]
122122
const PROTO_MAXIMUM_SUPPORTED: i32 = ProtoVersion::MaxSupported as i32;
123123
#[pyattr]
124-
const OP_ALL: libc::c_ulong = sys::SSL_OP_ALL & !sys::SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
124+
const OP_ALL: libc::c_ulong = (sys::SSL_OP_ALL & !sys::SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) as _;
125125
#[pyattr]
126126
const HAS_TLS_UNIQUE: bool = true;
127127
#[pyattr]

vm/src/builtins/type.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,11 +868,11 @@ impl PyType {
868868
})?;
869869
}
870870

871-
if let Some(initter) = typ.get_super_attr(identifier!(vm, __init_subclass__)) {
872-
let initter = vm
873-
.call_get_descriptor_specific(initter.clone(), None, Some(typ.clone().into()))
874-
.unwrap_or(Ok(initter))?;
875-
vm.invoke(&initter, kwargs)?;
871+
if let Some(init_subclass) = typ.get_super_attr(identifier!(vm, __init_subclass__)) {
872+
let init_subclass = vm
873+
.call_get_descriptor_specific(init_subclass.clone(), None, Some(typ.clone().into()))
874+
.unwrap_or(Ok(init_subclass))?;
875+
vm.invoke(&init_subclass, kwargs)?;
876876
};
877877

878878
Ok(typ.into())
@@ -1156,14 +1156,14 @@ fn take_next_base(bases: &mut [Vec<PyTypeRef>]) -> Option<PyTypeRef> {
11561156
}
11571157

11581158
fn linearise_mro(mut bases: Vec<Vec<PyTypeRef>>) -> Result<Vec<PyTypeRef>, String> {
1159-
vm_trace!("Linearising MRO: {:?}", bases);
1159+
vm_trace!("Linearise MRO: {:?}", bases);
11601160
// Python requires that the class direct bases are kept in the same order.
11611161
// This is called local precedence ordering.
11621162
// This means we must verify that for classes A(), B(A) we must reject C(A, B) even though this
11631163
// algorithm will allow the mro ordering of [C, B, A, object].
11641164
// To verify this, we make sure non of the direct bases are in the mro of bases after them.
11651165
for (i, base_mro) in bases.iter().enumerate() {
1166-
let base = &base_mro[0]; // Mros cannot be empty.
1166+
let base = &base_mro[0]; // MROs cannot be empty.
11671167
for later_mro in &bases[i + 1..] {
11681168
// We start at index 1 to skip direct bases.
11691169
// This will not catch duplicate bases, but such a thing is already tested for.

whats_left.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def remove_one_indent(s):
441441
compare_src = inspect.getsourcelines(compare)[0][1:]
442442
output += "".join(remove_one_indent(line) for line in compare_src)
443443

444-
with open(GENERATED_FILE, "w") as f:
444+
with open(GENERATED_FILE, "w", encoding='utf-8') as f:
445445
f.write(output + "\n")
446446

447447

0 commit comments

Comments
 (0)