-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
[sqlite3] Fetching an empty value from date column raises ValueError #87918
Comments
We noticed a regression in Python3.10.0a7 (it works properly in Python3.10.0a6) when running Django's test suite. File "python3.10/lib/sqlite3/dbapi2.py", line 64, in convert_date I will bisect a regression and submit PR. [1] Lines 63 to 64 in 5061622
|
A regression test: def test_convert_null_date(self):
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)
cur = con.cursor()
cur.execute("CREATE TABLE t (x DATE NULL)")
cur.execute("INSERT INTO t (x) VALUES (NULL)")
cur.execute("SELECT * FROM t")
values = [x[0] for x in cur.fetchall()]
self.assertEqual(values, [None]) |
Thanks for the report and the test case! :) Regression was introduced by e161ec5, where it was assumed that the handling of zero-sized blobs should be consistent. Unfortunately, the handling of zero-sized blobs is not consistent. Zero-sized blobs _with_ converters must return None; zero-sized blobs _without_ converters must return b"". |
BTW, you might be interested in this bpo, Mariusz: bpo-43553 |
Maybe the docs should be updated to reflect this inconsistency. |
Thank you for the report and reproducer, Mariusz and thank you for the PR, Erlend. |
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: