Skip to content

Commit

Permalink
Do not proxy _is_coroutine attr, fixes #136
Browse files Browse the repository at this point in the history
  • Loading branch information
brondsem committed May 20, 2023
1 parent fdbea31 commit b171594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tests/test_stack/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import inspect
import asyncio
import pytest
from webtest import TestApp
from tg.support.registry import RegistryManager, StackedObjectProxy, DispatchingConfig
Expand Down Expand Up @@ -192,6 +193,11 @@ def test_stacked_object_inspect():
assert inspect.unwrap(so) is so


def test_stacked_object_iscoroutinefunction():
so = StackedObjectProxy()
assert not asyncio.iscoroutinefunction(so)


def test_simple():
app = TestApp(simpleapp)
response = app.get('/')
Expand Down Expand Up @@ -400,4 +406,4 @@ def app(environ, start_response):
except:
# Looping again will crash because we already popped
# The registered object and cleanup will fail.
pass
pass
4 changes: 3 additions & 1 deletion tg/support/objectproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ def __contains__(self, key):

def __nonzero__(self):
return bool(self._current_obj())
__bool__ = __nonzero__
__bool__ = __nonzero__

_is_coroutine = None

0 comments on commit b171594

Please sign in to comment.