Skip to content

Fixed UTF-8 encoding for whats_left.py and type mismatching in stdlib/src/ssl.rs #4440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@
"rdiv",
"idiv",
"ndim",
"unionable",
"varnames",
"getweakrefs",
"getweakrefcount",
"stacklevel",
"MemoryView",
"metatype",
"warningregistry",
"defaultaction",
"unraisablehook",
Expand Down Expand Up @@ -129,7 +131,12 @@
"posonlyargs",
"kwonlyargs",
"uninit",
"miri"
"miri",
// cpython
"linearise",
"dictoffset",
"heaptype",
"IMMUTABLETYPE"
],
// flagWords - list of words to be always considered incorrect
"flagWords": [
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down Expand Up @@ -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') }}
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 7 additions & 7 deletions vm/src/builtins/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -1156,14 +1156,14 @@ fn take_next_base(bases: &mut [Vec<PyTypeRef>]) -> Option<PyTypeRef> {
}

fn linearise_mro(mut bases: Vec<Vec<PyTypeRef>>) -> Result<Vec<PyTypeRef>, 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.
Expand Down
2 changes: 1 addition & 1 deletion whats_left.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down