"SET IDENTITY_INSERT %s OFF" %
self.dialect.identifier_preparer. format_table(
self.compiled.statement.table)))
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
def get_result_proxy(self):
# basic operations via autocommit fail.
try:
dbapi_connection.commit()
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
if self.server_version_info < (3, 23, 15):
args = sys.exc_info()[1].args
if args and args[0] == 1064:
try:
dbapi_connection.rollback()
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
if self.server_version_info < (3, 23, 15):
args = sys.exc_info()[1].args
if args and args[0] == 1064:
'client_flags', ClientFlag.get_default())
client_flags |= ClientFlag.FOUND_ROWS
opts['client_flags'] = client_flags
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
return [[], opts]
"""
try:
cursor.close()
- except (SystemExit, KeyboardInterrupt):
- raise
except Exception:
# log the error through the connection pool's logger.
self.engine.pool.logger.error(
per_fn = fn(ctx)
if per_fn is not None:
ctx.chained_exception = newraise = per_fn
- except (SystemExit, KeyboardInterrupt):
- raise
except Exception as _raised:
# handler raises an exception - stop processing
newraise = _raised
connection_invalidated=False):
# Don't ever wrap these, just return them directly as if
# DBAPIError didn't exist.
- if isinstance(orig, (KeyboardInterrupt, SystemExit, DontWrapMixin)):
+ if (isinstance(orig, BaseException) and
+ not isinstance(orig, Exception)) or \
+ isinstance(orig, DontWrapMixin):
return orig
if orig is not None:
def __init__(self, statement, params, orig, connection_invalidated=False):
try:
text = str(orig)
- except (KeyboardInterrupt, SystemExit):
- raise
except Exception as e:
text = 'Error in str() of DB-API-generated exception: ' + str(e)
StatementError.__init__(
mapper._expire_memoizations()
mapper.dispatch.mapper_configured(
mapper, mapper.class_)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
exc = sys.exc_info()[1]
if not hasattr(exc, '_configure_failed'):
mapper._configure_failed = exc
self.logger.debug("Closing connection %r", connection)
try:
self._dialect.do_close(connection)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
self.logger.error("Exception closing connection %r",
connection, exc_info=True)
# Immediately close detached instances
if not connection_record:
pool._close_connection(connection)
- except Exception as e:
+ except BaseException as e:
pool.logger.error(
"Exception during reset or similar", exc_info=True)
if connection_record:
connection_record.invalidate(e=e)
- if isinstance(e, (SystemExit, KeyboardInterrupt)):
+ if not isinstance(e, Exception):
raise
if connection_record:
for conn in self._all_conns:
try:
conn.close()
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
# pysqlite won't even let you close a conn from a thread
# that didn't create it
pass
else:
try:
return str(element)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
return "unprintable element %r" % element
def _safe(self, fn):
try:
fn()
- except (SystemExit, KeyboardInterrupt):
- raise
except Exception as e:
warnings.warn(
"testing_reaper couldn't "
def _safe(self, fn):
try:
fn()
- except (SystemExit, KeyboardInterrupt):
- raise
except Exception as e:
warnings.warn(
"ReconnectFixture couldn't "
isolation_level="AUTOCOMMIT") as conn:
try:
_pg_drop_db(cfg, conn, ident)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
currentdb = conn.scalar("select current_database()")
conn.execute("CREATE DATABASE %s TEMPLATE %s" % (ident, currentdb))
with eng.connect() as conn:
try:
_mysql_drop_db(cfg, conn, ident)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
conn.execute("CREATE DATABASE %s" % ident)
conn.execute("CREATE DATABASE %s_test_schema" % ident)
with eng.connect() as conn:
try:
conn.execute("DROP DATABASE %s_test_schema" % ident)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
try:
conn.execute("DROP DATABASE %s_test_schema_2" % ident)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
try:
conn.execute("DROP DATABASE %s" % ident)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
val = getattr(obj, arg, missing)
if val is not missing and val != defval:
output.append('%s=%r' % (arg, val))
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
if additional_kw:
val = getattr(obj, arg, missing)
if val is not missing and val != defval:
output.append('%s=%r' % (arg, val))
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
pass
return "%s(%s)" % (obj.__class__.__name__, ", ".join(output))
"""
try:
return func(*args, **kwargs)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
warn("%s('%s') ignored" % sys.exc_info()[0:2])