-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Upgrade RustPython #5192
Upgrade RustPython #5192
Conversation
870be5b
to
cb19936
Compare
3984ae6
to
9e01948
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This looks good to me. I am a bit concerned about all the new dependencies that the upgrade introduces and wonder if it could make sense to add helpers to Arguments
to avoid the many chain
in the user code (get all defaults, get all named arguments, get all positional arguments, get all arguments) etc.
Cargo.lock
Outdated
@@ -198,6 +198,22 @@ version = "2.3.1" | |||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||
checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" | |||
|
|||
[[package]] | |||
name = "block-buffer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So many new dependencies. Are they all introduced because of the bigint library migration? Would it make sense for us to stay on numbigint for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but we are staying on num-bigint, aren't we? I'm not using the malachite feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does look like block-buffer
comes from malachite
. But does this actually affect the binary? I can also just remove the malachite
stuff in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think rustpython_format
doesn't have this properly gated as a feature. I'll fix this separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fixed this. No new deps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
for arg in &args.posonlyargs { | ||
if let Some(expr) = &arg.annotation { | ||
for arg_with_default in chain!(&args.posonlyargs, &args.args, &args.kwonlyargs) { | ||
if let Some(expr) = &arg_with_default.def.annotation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm another acronym with def
. I should have catched that during the review. I guess that's fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah don't love it.
} in chain!( | ||
&arguments.posonlyargs, | ||
&arguments.args, | ||
&arguments.kwonlyargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation for using chain!
over iter.chain
? I know we have a few use cases for itertools
but I try to keep them to a minimum, in the hope, that we could someday remove the dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it to iter.chain
. I just wanted to be consistent everywhere and this was more concise.
def, | ||
default: _, | ||
range: _, | ||
} in chain!(&arguments.posonlyargs, &arguments.args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add some custom methods to arguments
that allow you iterating over all arguments, over all defaults, etc? It feels very repetitive to have these chain
calls sprinkled across the code base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe, I'm gonna punt it on now under "leave it better" (it's no worse than before).
crates/ruff/src/rules/pylint/rules/unexpected_special_method_signature.rs
Outdated
Show resolved
Hide resolved
PR Check ResultsEcosystem✅ ecosystem check detected no changes. |
83e127f
to
d1bbc6f
Compare
d1bbc6f
to
a348cf5
Compare
Summary
This PR upgrade RustPython to pull in the changes to
Arguments
(zip defaults with their identifiers) and all the renames toCmpOp
and friends.