diff options
| author | Joshua Harlow <harlowja@gmail.com> | 2013-09-20 23:18:03 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@gmail.com> | 2013-09-22 23:28:33 +0000 |
| commit | 134d0951b0fc8ecf213eda9b9715d3cd4ed4abf1 (patch) | |
| tree | 2fac94b1e297171f8adfc7ca1a827afa7ad59b35 /taskflow/persistence/backends/impl_sqlalchemy.py | |
| parent | c108f6a1f5bc32ef7e2041bcce7223740ddefaf8 (diff) | |
| download | taskflow-134d0951b0fc8ecf213eda9b9715d3cd4ed4abf1.tar.gz | |
Remove weakref usage
If a connection escapes the scope of the
backend object, then python will actually
garbage collect the backend object even
though the connection object has a property
that allows you to fetch the backend. If the
property is used after the gc occurs a weakref
failure occurs.
Python is smart enough to correctly deallocate
these types of object links by itself so lets
just let it do that.
Fixes: bug 1228968
Change-Id: I49d36b74f896bd1be6c7a1a373b07bdaded3ef4b
Diffstat (limited to 'taskflow/persistence/backends/impl_sqlalchemy.py')
| -rw-r--r-- | taskflow/persistence/backends/impl_sqlalchemy.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/taskflow/persistence/backends/impl_sqlalchemy.py b/taskflow/persistence/backends/impl_sqlalchemy.py index 1456cbf..83a98c9 100644 --- a/taskflow/persistence/backends/impl_sqlalchemy.py +++ b/taskflow/persistence/backends/impl_sqlalchemy.py @@ -25,7 +25,6 @@ import contextlib import copy import logging import time -import weakref import sqlalchemy as sa from sqlalchemy import exceptions as sa_exc @@ -260,7 +259,7 @@ class SQLAlchemyBackend(base.Backend): class Connection(base.Connection): def __init__(self, backend, session_maker): - self._backend = weakref.proxy(backend) + self._backend = backend self._session_maker = session_maker self._engine = backend.engine |
