diff options
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 704c0d19c..3e62cb350 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1694,7 +1694,7 @@ class SQLCompiler(Compiled): # at all if the key were present in the parameters if autoinc_key in self.binds: - def autoinc_getter(lastrowid, parameters): + def _autoinc_getter(lastrowid, parameters): param_value = parameters.get(autoinc_key, lastrowid) if param_value is not None: # they supplied non-None parameter, use that. @@ -1706,6 +1706,9 @@ class SQLCompiler(Compiled): # use lastrowid return lastrowid + # work around mypy https://github.com/python/mypy/issues/14027 + autoinc_getter = _autoinc_getter + else: lastrowid_processor = None @@ -1727,7 +1730,7 @@ class SQLCompiler(Compiled): return row_fn( ( autoinc_getter(lastrowid, parameters) - if autoinc_getter + if autoinc_getter is not None else lastrowid ) if col is autoinc_col |