Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0f96ff

Browse filesBrowse files
committed
Return in case of higher precision than expected
1 parent f7bb72e commit d0f96ff
Copy full SHA for d0f96ff

File tree

Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed

‎MySQLdb/times.py

Copy file name to clipboardExpand all lines: MySQLdb/times.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def DateTime_or_None(s):
6161
# 12:00:00.123456
6262
micros = int(micros) * 10 ** (6 - len(micros))
6363
else:
64-
# 12:00:00.123456789
65-
micros = int(micros)
64+
return None
6665

6766
return datetime(
6867
int(s[:4]), # year

‎tests/test_MySQLdb_times.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_times.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_date_or_none(self):
1919
assert times.Date_or_None('fail') is None
2020
assert times.Date_or_None('2015-12') is None
2121
assert times.Date_or_None('2015-12-40') is None
22+
assert times.Date_or_None('0000-00-00') is None
2223

2324
def test_time_or_none(self):
2425
assert times.Time_or_None('00:00:00') == time(0, 0)
@@ -44,6 +45,8 @@ def test_datetime_or_none(self):
4445

4546
assert times.DateTime_or_None('') is None
4647
assert times.DateTime_or_None('fail') is None
48+
assert times.DateTime_or_None('0000-00-00 00:00:00') is None
49+
assert times.DateTime_or_None('0000-00-00 00:00:00.000000') is None
4750
assert times.DateTime_or_None('2015-12-13T01:02:03.123456789') is None
4851

4952
def test_timedelta_or_none(self):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.