Merged
Conversation
a00dac2 to
637870a
Compare
27 tasks
youknowone
reviewed
Oct 3, 2022
vm/src/exceptions.rs
Outdated
| // second exception filename | ||
| "filename2" => ctx.none(), | ||
| "__str__" => ctx.new_method("__str__", excs.os_error, os_error_str), | ||
| "__reduce__" => ctx.new_method("__str__", excs.os_error, os_error_reduce), |
Member
There was a problem hiding this comment.
Suggested change
| "__reduce__" => ctx.new_method("__str__", excs.os_error, os_error_reduce), | |
| "__reduce__" => ctx.new_method("__reduce__", excs.os_error, os_error_reduce), |
vm/src/exceptions.rs
Outdated
Comment on lines
+1347
to
+1357
| if new_args.args.len() >= 2 { | ||
| new_args.args.truncate(2); | ||
| } |
Member
There was a problem hiding this comment.
This is a question because I don't know the spec very well. Exceptions usually takes infinite args and store it. What happens for more args than 4 in this case?
Contributor
There was a problem hiding this comment.
It seems to work that no matter how we put arguments to its parenthesis (work means it does not throw exceptions).
But according to code and behavior. it works as expected when only the given argument length is between 2 and 5.
>>> OSError(1,2).errno
1
>>> OSError(1,2).strerror
2
>>> OSError(1)
OSError(1)
>>> OSError(1).errnohttps://github.com/python/cpython/blob/3.10/Objects/exceptions.c#L820-L876
df5bca4 to
e7b6f1e
Compare
youknowone
approved these changes
Oct 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tested by removing expected failure and commenting everything but OSError in Lib/test/test_exceptions.py::testAttributes::exceptionList, WindowsError of the test.
Part of #3611