| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| // 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), |
There was a problem hiding this comment.
| "__reduce__" => ctx.new_method("__str__", excs.os_error, os_error_reduce), | |
| "__reduce__" => ctx.new_method("__reduce__", excs.os_error, os_error_reduce), |
Sorry, something went wrong.
| if new_args.args.len() >= 2 { | ||
| new_args.args.truncate(2); | ||
| } |
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?
Sorry, something went wrong.
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
Sorry, something went wrong.
There was a problem hiding this comment.
Let's discuss this point in #4194 ...
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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