summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorGaëtan de Menten <gdementen@gmail.com>2010-02-14 21:21:40 +0000
committerGaëtan de Menten <gdementen@gmail.com>2010-02-14 21:21:40 +0000
commitded4e1d76b634b94a161bc91a3b4eb9d8777332b (patch)
tree506bbae8952047314bd2e576edd04d5060fdc708 /lib/sqlalchemy/engine/base.py
parentf43ef377289eef8e8ae936723c0c0903e83075e9 (diff)
downloadsqlalchemy-ded4e1d76b634b94a161bc91a3b4eb9d8777332b.tar.gz
- fix C version of rowproxy pickling so that it pickles to the same format
as the Python version. - changelog my earlier processor optimization work
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 4dc9665c0..ff475ee3d 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -1596,21 +1596,16 @@ def _proxy_connection_cls(cls, proxy):
# This reconstructor is necessary so that pickles with the C extension or
# without use the same Binary format.
-# We need a different reconstructor on the C extension so that we can
-# add extra checks that fields have correctly been initialized by
-# __setstate__.
try:
- from sqlalchemy.cresultproxy import rowproxy_reconstructor
-
- # this is a hack so that the reconstructor function is pickled with the
- # same name as without the C extension.
- # BUG: It fails for me if I run the "python" interpreter and
- # then say "import sqlalchemy":
- # TypeError: 'builtin_function_or_method' object has only read-only attributes (assign to .__module__)
- # However, if I run the tests with nosetests, it succeeds !
- # I've verified with pdb etc. that this is the case.
- #rowproxy_reconstructor.__module__ = 'sqlalchemy.engine.base'
+ # We need a different reconstructor on the C extension so that we can
+ # add extra checks that fields have correctly been initialized by
+ # __setstate__.
+ from sqlalchemy.cresultproxy import safe_rowproxy_reconstructor
+ # The extra function embedding is needed so that the reconstructor function
+ # has the same signature whether or not the extension is present.
+ def rowproxy_reconstructor(cls, state):
+ return safe_rowproxy_reconstructor(cls, state)
except ImportError:
def rowproxy_reconstructor(cls, state):
obj = cls.__new__(cls)