Skip to content

Conversation

@fanninpm
Copy link
Contributor

Addresses three items in #3611.

cc @Snowapril

@Snowapril
Copy link
Contributor

Looks good! This PR can be a good specimen for the other remaining works. Does "three items" mean OSError, ImportError, BaseException?

@fanninpm
Copy link
Contributor Author

Does "three items" mean OSError, ImportError, BaseException?

Yes. I only had to add things to BaseException, since ImportError and OSError inherit from BaseException.

@Snowapril
Copy link
Contributor

@fanninpm
Copy link
Contributor Author

Unfortunately, OSError's and ImportError's reduce act different than BaseException's 😭

I would direct future contributors to look at the extend_exception! macro.

@Snowapril
Copy link
Contributor

Ok good 😊. Except for the issue about the empty set that I commented on, everything seems fine.

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thank you! @Snowapril and thank you for the review!

}

#[pymethod(magic)]
fn reduce(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyTupleRef {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't require type checking, this may be:

Suggested change
fn reduce(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyTupleRef {
fn reduce(zelf: PyObjectRef, vm: &VirtualMachine) -> PyTupleRef {

Copy link
Contributor Author

@fanninpm fanninpm Apr 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work in practice because rustc will complain:

no method named `args` found for struct `core::PyObjectRef` in the current scope
method not found in `core::PyObjectRef`

@fanninpm fanninpm requested a review from youknowone April 29, 2022 14:59
@youknowone youknowone merged commit 4c39668 into RustPython:main Apr 29, 2022
@fanninpm fanninpm deleted the baseexception-reduce branch April 29, 2022 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants