-
Notifications
You must be signed in to change notification settings - Fork 1.3k
time.strftime(arg)
fails when arg is not valid format string
#4157
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
Comments
I think this could be related to the below issue. |
Now, I'm waiting for the below PR to be merged and v0.5 to be released. |
Should we add a validation check in fn strptime for supported formats? |
There's a simpler solution for now, we can use Do you want to give it a shot? If so, lmk and I'll assign you. |
Did some more digging. CPython uses wcsftime for formatting time (if system supports it) After building latest python 3.12, I got following
Same for Python 3.10 as well Playing around with wcsftime for same input also yields same result Now, as for chrono in rust: I played around chrono too, it doesn't support %4Y at all. What can be done now is to add exception handling so that rustpython don't panic if there is an exception in chrono.
Sure, I have raised PR #4474 Pending: one test case is failing viz embedded null character |
After reading a bit more, it seems that the |
+1 and on compiler version
|
yeah, |
Yes, current version implements this behavior. |
Did #4530 fix this? |
it did go from panicking to simply failing so partially yes? 😄 |
time.strftime(arg)
raise panic when arg is not valid format stringtime.strftime(arg)
fails when arg is not valid format string
Hi, new to this project and just reviewing the "good first issue" label and i cannot reproduce the issue!
|
Expected Result
In cpython, when arg is not a valid format string,
strftime
returns arg itself.Actual Result
In RustPython,strftime
raise panic when arg is not a valid format stringThe text was updated successfully, but these errors were encountered: