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

Move tornado to 2and3 #3780

Merged
merged 4 commits into from
Feb 26, 2020
Merged

Conversation

ilevkivskyi
Copy link
Member

This also uses a trick to avoid Incompatible with supertype errors for get() etc. that used to have signature like def get(*args, **kwars): ... (that btw is used in tornado itself, see https://github.com/tornadoweb/tornado/blob/master/tornado/web.py#L266).

Copy link
Contributor

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, assuming the build passes, though I have one question.

from tornado import httputil

MIN_SUPPORTED_SIGNED_VALUE_VERSION: Any
MAX_SUPPORTED_SIGNED_VALUE_VERSION: Any
DEFAULT_SIGNED_VALUE_VERSION: Any
DEFAULT_SIGNED_VALUE_MIN_VERSION: Any

if sys.version_info[:2] >= (3, 5):
from typing import Awaitable
_MethodType = Callable[..., Optional[Awaitable[None]]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the return type have None in Python 3.5+ but is Any in earlier versions? Is it because we can't represent the type in prior Python versions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure but IIUC the API logic changed at some point. At least on Python 2 these methods used to return something in subclasses (like self.render()), while on Python 3 they act via side effects only (like self.write()).

@ilevkivskyi ilevkivskyi merged commit ca1ca0c into python:master Feb 26, 2020
@ilevkivskyi ilevkivskyi deleted the move-tornado-py3 branch February 26, 2020 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants