diff --git a/ipdb/__main__.py b/ipdb/__main__.py index 3965725..beee6c9 100644 --- a/ipdb/__main__.py +++ b/ipdb/__main__.py @@ -8,7 +8,7 @@ import os import sys -from contextlib import contextmanager +from decorator import contextmanager __version__ = '0.13.8.dev0' @@ -228,27 +228,8 @@ def launch_ipdb_on_exception(): pass -class Decontext(object): - """ - Makes a context manager also act as decorator. - """ - def __init__(self, context_manager): - self._cm = context_manager - - def __enter__(self): - return self._cm.__enter__() - - def __exit__(self, *args, **kwds): - return self._cm.__exit__(*args, **kwds) - - def __call__(self, func): - def wrapper(*args, **kwds): - with self: - return func(*args, **kwds) - return wrapper - - -iex = Decontext(launch_ipdb_on_exception()) +# iex is a concise alias +iex = launch_ipdb_on_exception() _usage = """\ diff --git a/setup.py b/setup.py index 60b249f..6d2344c 100644 --- a/setup.py +++ b/setup.py @@ -61,6 +61,7 @@ 'toml >= 0.10.2' ], # No support for python 3.0, 3.1, 3.2. + # decorator is also a dependency of Ipython. ':python_version == "3.4"': ['ipython >= 6.0.0, < 7.0.0', 'toml >= 0.10.2', 'decorator < 5.0.0'], ':python_version == "3.5"': ['ipython >= 7.0.0, < 7.10.0', 'toml >= 0.10.2'], ':python_version == "3.6"': ['ipython >= 7.10.0, < 7.17.0', 'toml >= 0.10.2'],