Skip to content

Commit

Permalink
Merge pull request #408 from enthought/fix/deprecated-getargspec
Browse files Browse the repository at this point in the history
Fix use of deprecated getargspec function
  • Loading branch information
mdickinson committed Oct 24, 2018
2 parents 992e8c7 + 02a973f commit 7cd60f6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions traits/interface_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@

from __future__ import absolute_import

# inspect.getargspec is deprecated in Python 3; inspect.getfullargspec is
# unavailable in Python 2.
try:
from inspect import getfullargspec, getmro
except ImportError:
from inspect import getargspec as getfullargspec, getmro
import logging
from types import FunctionType

from inspect import getargspec, getmro

from .has_traits import HasTraits

#-------------------------------------------------------------------------------
# Logging:
#-------------------------------------------------------------------------------

import logging

logger = logging.getLogger( __name__ )

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -129,8 +132,8 @@ def _check_methods ( self, cls, interface, error_mode ):


# Check that the method signatures are the same:
cls_argspec = getargspec( cls_methods[ name ] )
interface_argspec = getargspec( interface_methods[ name ] )
cls_argspec = getfullargspec( cls_methods[ name ] )
interface_argspec = getfullargspec( interface_methods[ name ] )

if cls_argspec != interface_argspec:
return self._handle_error( BAD_SIGNATURE %
Expand Down Expand Up @@ -193,4 +196,3 @@ def check_implements ( cls, interfaces, error_mode = 0 ):
'interfaces' can be a single interface or a list of interfaces.
"""
return checker.check_implements( cls, interfaces, error_mode )

0 comments on commit 7cd60f6

Please sign in to comment.