Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate registering synchronous web handlers #1993

Closed
asvetlov opened this issue Jun 20, 2017 · 6 comments
Closed

Deprecate registering synchronous web handlers #1993

asvetlov opened this issue Jun 20, 2017 · 6 comments
Labels
Milestone

Comments

@asvetlov
Copy link
Member

Right now aiohttp.web wraps sync handlers by async wrapper.
I think the behavior should be deprecated.

Opinions?

@kxepal
Copy link
Member

kxepal commented Jun 20, 2017

+1

1 similar comment
@fafhrd91
Copy link
Member

+1

@asvetlov asvetlov added this to the 2.3.0 milestone Jun 25, 2017
@asvetlov asvetlov added the good first issue Good for newcomers label Jul 2, 2017
@kornsn
Copy link

kornsn commented Sep 6, 2018

Possible we have a little bug.

I have a handler that looks like a code below:

class MyHandler:
    aync def __call__(self, request):
        ...

This handler is asinchronous, but aiohttp thinks like it is sinchronous and writes deprecation warning.

Please, let's check it.

We can add one more test into test_urldispatch.py

def test_not_deprecate_async_call_class(router, recwarn):
    class Handler:
        async def __call__(self, request):
            pass
            
    router.add_route('GET', '/handler', handler)
     
    assert len(recwarn) == 0

What do you think? Should I make a pull-request?

@kornsn
Copy link

kornsn commented Sep 6, 2018

Also, using of lambda functions leads to deprecation warnings too, and we have not async lambdas. May be just let to use both of sync and async functions?

Sorry for late opinion.

@asvetlov
Copy link
Member Author

asvetlov commented Sep 7, 2018

Sorry, lambdas support is deprecated and will be removed.
Both sync and async makes a mess and unnecessary slowdown.

Regarding async __call__ -- I really like to solve it on Python stdlib introspection level.
Maybe async_calllable(arg) utility (we have callable(arg) already)

If you are interested in -- file a bug on https://bugs.python.org , add asvetlov and yselivanov to nosy list

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants