summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorJacob MacDonald <jaccarmac@gmail.com>2015-10-28 18:52:06 -0600
committerJacob MacDonald <jaccarmac@gmail.com>2015-10-29 12:09:15 -0600
commite8a5ed9c1cbc5e9f0aebffad5ea78abb16167778 (patch)
treee52d3a0616e79a57ec4bd42244db3401007f41eb /lib/sqlalchemy/orm
parent98c1dcc6bcade313a254fe11e8efa3c5b5ad959e (diff)
downloadsqlalchemy-pr/210.tar.gz
Update usages of getargspec to compat version.pr/210
The places inspect.getargspec was being used were causing problems for newer Python versions.
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/collections.py3
-rw-r--r--lib/sqlalchemy/orm/events.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index 4f988a8d4..b9145bae2 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -111,6 +111,7 @@ from ..sql import expression
from .. import util, exc as sa_exc
from . import base
+from sqlalchemy.util.compat import inspect_getargspec
__all__ = ['collection', 'collection_adapter',
'mapped_collection', 'column_mapped_collection',
@@ -982,7 +983,7 @@ def _instrument_membership_mutator(method, before, argument, after):
adapter."""
# This isn't smart enough to handle @adds(1) for 'def fn(self, (a, b))'
if before:
- fn_args = list(util.flatten_iterator(inspect.getargspec(method)[0]))
+ fn_args = list(util.flatten_iterator(inspect_getargspec(method)[0]))
if isinstance(argument, int):
pos_arg = argument
named_arg = len(fn_args) > argument and fn_args[argument] or None
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py
index 993385e15..0d2b0850f 100644
--- a/lib/sqlalchemy/orm/events.py
+++ b/lib/sqlalchemy/orm/events.py
@@ -18,6 +18,7 @@ from .session import Session, sessionmaker
from .scoping import scoped_session
from .attributes import QueryableAttribute
from .query import Query
+from sqlalchemy.util.compat import inspect_getargspec
class InstrumentationEvents(event.Events):
"""Events related to class instrumentation events.
@@ -603,7 +604,7 @@ class MapperEvents(event.Events):
meth = getattr(cls, identifier)
try:
target_index = \
- inspect.getargspec(meth)[0].index('target') - 1
+ inspect_getargspec(meth)[0].index('target') - 1
except ValueError:
target_index = None