diff --git a/eventlet/support/__init__.py b/eventlet/support/__init__.py index b311c8a..0970f31 100644 --- a/eventlet/support/__init__.py +++ b/eventlet/support/__init__.py @@ -73,8 +73,10 @@ Autoupgrade: fgrep -rl '{old}' . |xargs -t sed --in-place='' -e 's/{old}/{new}/' def wrapper(base): klass = None if inspect.isclass(base): - klass = base - base = klass.__init__ + class klass(base): + pass + klass.__name__ = base.__name__ + klass.__module__ = base.__module__ @functools.wraps(base) def wrapped(*a, **kw): diff --git a/tests/api_test.py b/tests/api_test.py index 2b2e93f..3ebc67c 100644 --- a/tests/api_test.py +++ b/tests/api_test.py @@ -177,3 +177,10 @@ def test_wrap_is_timeout(): obj = eventlet.wrap_is_timeout(A)() tests.check_is_timeout(obj) + + +def test_timeouterror_deprecated(): + # https://github.com/eventlet/eventlet/issues/378 + code = '''import eventlet; eventlet.Timeout(1).cancel(); print('pass')''' + args = ['-Werror:eventlet.Timeout:DeprecationWarning', '-c', code] + tests.run_python(path=None, args=args, expect_pass=True)