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 a7f55a5

Browse filesBrowse files
André Malofarcepest
authored andcommitted
Patch 1/4: Minor exception handling improvements (don't swallow program exits)
https://sourceforge.net/p/mysql-python/patches/77/
1 parent fa248cf commit a7f55a5
Copy full SHA for a7f55a5

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+18
-4
lines changed

‎MySQLdb/MySQLdb/cursors.py

Copy file name to clipboardExpand all lines: MySQLdb/MySQLdb/cursors.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ def execute(self, query, args=None):
174174
else:
175175
self.messages.append((TypeError, m))
176176
self.errorhandler(self, TypeError, m)
177+
except (SystemExit, KeyboardInterrupt):
178+
raise
177179
except:
178180
exc, value, tb = sys.exc_info()
179181
del tb
@@ -223,6 +225,8 @@ def executemany(self, query, args):
223225
self.errorhandler(self, ProgrammingError, msg.args[0])
224226
else:
225227
self.errorhandler(self, TypeError, msg)
228+
except (SystemExit, KeyboardInterrupt):
229+
raise
226230
except:
227231
exc, value, tb = sys.exc_info()
228232
del tb

‎MySQLdb/MySQLdb/times.py

Copy file name to clipboardExpand all lines: MySQLdb/MySQLdb/times.py
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def DateTime_or_None(s):
5252
try:
5353
d, t = s.split(sep, 1)
5454
return datetime(*[ int(x) for x in d.split('-')+t.split(':') ])
55+
except (SystemExit, KeyboardInterrupt):
56+
raise
5557
except:
5658
return Date_or_None(s)
5759

@@ -79,8 +81,12 @@ def Time_or_None(s):
7981
return None
8082

8183
def Date_or_None(s):
82-
try: return date(*[ int(x) for x in s.split('-',2)])
83-
except: return None
84+
try:
85+
return date(*[ int(x) for x in s.split('-',2)])
86+
except (SystemExit, KeyboardInterrupt):
87+
raise
88+
except:
89+
return None
8490

8591
def DateTime2literal(d, c):
8692
"""Format a DateTime object as an ISO timestamp."""
@@ -97,5 +103,9 @@ def mysql_timestamp_converter(s):
97103
s = s + "0"*(14-len(s)) # padding
98104
parts = map(int, filter(None, (s[:4],s[4:6],s[6:8],
99105
s[8:10],s[10:12],s[12:14])))
100-
try: return Timestamp(*parts)
101-
except: return None
106+
try:
107+
return Timestamp(*parts)
108+
except (SystemExit, KeyboardInterrupt):
109+
raise
110+
except:
111+
return None

0 commit comments

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