summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/loading_speedups.pyx27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/loading_speedups.pyx b/lib/sqlalchemy/orm/loading_speedups.pyx
index 8d4f917c1..1254f329a 100644
--- a/lib/sqlalchemy/orm/loading_speedups.pyx
+++ b/lib/sqlalchemy/orm/loading_speedups.pyx
@@ -109,6 +109,12 @@ def _instance_processor(
def _instance(row):
+ cdef dict dict_
+ cdef bint isnew
+ cdef bint currentload
+ cdef bint loaded_instance
+ cdef tuple identitykey
+
# determine the state that we'll be populating
if refresh_identity_key:
# fixed state that we're refreshing
@@ -175,7 +181,7 @@ def _instance_processor(
_populate_full(
context, row, state, dict_, isnew,
- loaded_instance, populate_existing, populators)
+ loaded_instance, populate_existing, <dict>populators)
if isnew:
if loaded_instance and load_evt:
@@ -204,7 +210,7 @@ def _instance_processor(
to_load = _populate_partial(
context, row, state, dict_, isnew,
- unloaded, populators)
+ unloaded, <dict>populators)
if isnew:
if refresh_evt:
@@ -225,9 +231,11 @@ def _instance_processor(
return _instance
-def _populate_full(
- context, row, state, dict_, isnew,
- loaded_instance, populate_existing, populators):
+cdef _populate_full(
+ context, row, state, dict dict_, bint isnew,
+ loaded_instance, populate_existing, dict populators):
+ cdef str key
+
if isnew:
# first time we are seeing a row with this identity.
state.runid = context.runid
@@ -253,9 +261,12 @@ def _populate_full(
populator(state, dict_, row)
-def _populate_partial(
- context, row, state, dict_, isnew,
- unloaded, populators):
+cdef _populate_partial(
+ context, row, state, dict dict_, bint isnew,
+ set unloaded, dict populators):
+ cdef str key
+ cdef set to_load
+
if not isnew:
to_load = context.partials[state]
for key, populator in populators["existing"]: