[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-09 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 08.02.2022 11:54, Erlend E. Aasland wrote:
> 
> The sqlite3 timestamp converter is buggy, as already noted in the docs[^1]. 
> Adding timezone support is out of the question[^2][^3][^4][^5], 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.

I think it's better to deprecate these converters and let users implement
their own.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The sqlite3 timestamp converter is buggy, as already noted in the docs[^1]. 
Adding timezone support is out of the question[^2][^3][^4][^5], 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.


[^1]: 
https://docs.python.org/3/library/sqlite3.html#default-adapters-and-converters
[^2]: bpo-19065
[^3]: bpo-26651
[^4]: bpo-45858
[^5]: 
https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/10985

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-07 Thread Ned Deily


Change by Ned Deily :


--
nosy: +erlendaasland

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-06 Thread Bo-wei Chen


Change by Bo-wei Chen :


--
keywords: +patch
pull_requests: +29342
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31169

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-06 Thread Bo-wei Chen


New submission from Bo-wei Chen :

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 
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'

--
components: Library (Lib)
messages: 412655
nosy: Rayologist
priority: normal
severity: normal
status: open
title: Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly 
parse timestamp
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com