-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp #90820
Comments
convert_timestamp function in Lib/sqlite3/dbapi2.py fails to parse a timestamp correctly, if it does not have microseconds but comes with timezone information, e.g. b"2022-02-01 16:09:35+00:00" Traceback: Traceback (most recent call last):
File "/Users/user/Desktop/test.py", line 121, in <module>
convert_timestamp(b"2022-02-01 16:09:35+00:00")
File "/Users/user/Desktop/test.py", line 112, in convert_timestamp
hours, minutes, seconds = map(int, timepart_full[0].split(b":"))
ValueError: invalid literal for int() with base 10: b'35+00' |
The sqlite3 timestamp converter is buggy, as already noted in the docs1. Adding timezone support is out of the question2345, but fixing it to be able to discard any attached timezone info _may_ be ok; at first sight, I don't see how this could break existing applications (like, for example adding time zone support could do). I need to think it through. In the meanwhile, I suggest taking a look at the linked issues. Footnotes |
On 08.02.2022 11:54, Erlend E. Aasland wrote:
I think it's better to deprecate these converters and let users implement |
Suggesting to deprecate the built-in converters when 3.12 dev opens up. |
As per discussion on Discourse, we will deprecate the built-in, default adapters and converters. Thus, this issue is now superseded by gh-90016. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: