diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index c6e28ffd6ad0..13585ea1c516 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1588,13 +1588,12 @@ def foo(ax, *args, **kwargs) def param(func): new_sig = None - ver_info = sys.version_info - # py2.6 compatible version, use line below as soon as we can - python_has_signature = ver_info[0] > 2 and ver_info[1] > 2 - # python_has_signature = ver_info.major > 2 and ver_info.minor > 2 - python_has_wrapped = ver_info[0] > 2 and ver_info[1] > 1 - # python_has_wrapped = ver_info.major > 2 and ver_info.minor > 1 - if not python_has_signature: + python_has_signature = major >= 3 and minor1 >= 3 + python_has_wrapped = major >= 3 and minor1 >= 2 + + # if in a legacy version of python and IPython is already imported + # try to use their back-ported signature + if not python_has_signature and 'IPython' in sys.modules: try: import IPython.utils.signatures signature = IPython.utils.signatures.signature