Issue 1:
Migrated issue, originally created by Wichert Akkerman (@wichert)

After upgrading from 0.9.4 to 0.9.5 or 0.9.6 I am suddenly seeing an error appear in my tests:

src/lets_lynk/factory.py:51: in factory
> return query.first()
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/query.py:2334: in first
> ret = list(self[0:1])
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/query.py:2201: in __getitem__
> return list(res)
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/query.py:2404: in __iter__
> self.session._autoflush()
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/session.py:1188: in _autoflush
> self.flush()
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/session.py:1907: in flush
> self._flush(objects)
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/session.py:2025: in _flush
> transaction.rollback(_capture_exception=True)
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/util/langhelpers.py:57: in __exit__
> compat.reraise(exc_type, exc_value, exc_tb)
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/session.py:1989: in _flush
> flush_context.execute()
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/unitofwork.py:350: in execute
> postsort_actions = self._generate_actions()
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/unitofwork.py:324: in _generate_actions
> for rec in cycles
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/unitofwork.py:324: in <genexpr>
> for rec in cycles
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/unitofwork.py:541: in per_state_flush_actions
> dep.per_state_flush_actions(uow, states_for_prop, False)
../../Library/buildout/eggs/SQLAlchemy-0.9.5-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/orm/dependency.py:166: in per_state_flush_actions
> else attributes.PASSIVE_NO_INITIALIZE)
E TypeError: get_all_pending() takes exactly 3 arguments (4 given)

Issue 2:
Migrated issue, originally created by NotTheEvilOne (@NotTheEvilOne)

Hi,

the "autoflush" feature triggers an error in SQLAlchemy 0.9.6.

File "/opt/pas/src/dNG/pas/data/upnp/resources/mp_entry.py", line 588, in init_cds_id
.first()
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2334, in first
ret = list(self[0:1])
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2201, in __getitem__
return list(res)
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2404, in __iter__
self.session._autoflush()
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 1188, in _autoflush
self.flush()
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 1907, in flush
self._flush(objects)
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2025, in _flush
transaction.rollback(_capture_exception=True)
File "/usr/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 57, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/usr/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 172, in reraise
raise value
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 1989, in _flush
flush_context.execute()
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 350, in execute
postsort_actions = self._generate_actions()
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 324, in _generate_actions
for rec in cycles
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 324, in <genexpr>
for rec in cycles
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 541, in per_state_flush_actions
dep.per_state_flush_actions(uow, states_for_prop, False)
File "/usr/lib/python3.4/site-packages/sqlalchemy/orm/dependency.py", line 166, in per_state_flush_actions
else attributes.PASSIVE_NO_INITIALIZE)
TypeError: get_all_pending() takes 3 positional arguments but 4 were given

I think it's related to commit 69dbcdd which in turn is related to #3060 as far as I understand.

Best regards

Tobias