Message121117
> Consider here:
> http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/engine/base.py?rev=6884:b181f1e53603#L1329
> the py3k code uses the "raise ... from" syntax which isn't legal in Python 2.
In this case, I would write
error = exc.DBAPIError.instance(statement,
parameters,
e,
connection_invalidated=is_disconnect)
if sys.version_info < (3,):
raise error, None, sys.exc_info()[2]
else:
error.__cause__ = e
raise error
You don't *have* to use the from syntax to set the cause.
> Approach B isn't a general solution because it requires you to replace entire functions at a time.
I don't claim that. However, I claim that there will be always an
appropriate solution using existing techniques, so that such a macro
processing wouldn't be necessary. IOW, I'm not aware of a case where
using such preprocessing would be appropriate and better than what
you can do without. |
|
Date |
User |
Action |
Args |
2010-11-13 06:53:13 | loewis | set | recipients:
+ loewis, hfuru, vstinner, benjamin.peterson, eric.araujo, bobbyi |
2010-11-13 06:53:11 | loewis | link | issue10070 messages |
2010-11-13 06:53:11 | loewis | create | |
|