Skip to content

Conversation

@fried
Copy link
Contributor

@fried fried commented Dec 27, 2016

create_future, create_task, set_task_factory, get_task_factory

create_future, create_task, set_task_factory, get_task_factory
@ambv
Copy link
Contributor

ambv commented Dec 28, 2016

This is adding a few methods that were added in 3.5.2, 3.4.2, and 3.4.4. The correct way to add them would be to add the sys.version_info checks with a three-tuple but Mypy only supports a 'x.y' format in specifying the Python version. In this case, I'd rather use a two-tuple, which while technically incorrect, it's more pragmatically useful.

@gvanrossum, @JukkaL, how have you been solving this before?

@gvanrossum
Copy link
Member

FWIW my recommendation is to just pretend that all versions of 3.x work like the most recent 3.x.y. In fact, despite the theoretical problem with this, that's probably more useful than changing mypy to support 3-digit versions, since we'd have some ambiguity around what e.g. --python-version 3.4 should mean -- would that be 3.4.0 or 3.4.y for the highest possible version of y? Note that there may be code like this:

if sys.version_info > (3, 4):
    ...

Would that mean 3.4.1 and up, or 3.5 and up? So maybe my suggestion from gitter to support 3-digit versions is best ignored.

@ambv
Copy link
Contributor

ambv commented Dec 30, 2016

I will add a linter warning against using three-tuples in sys.version_info checks.

@ambv ambv merged commit 61cdd4b into python:master Jan 3, 2017
@fried fried deleted the patch-2 branch January 3, 2017 23:43
hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
From python/cpython#25298. I also added more tests for get_args/get_origin,
which previously didn't exist in in typing_extensions.
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.

3 participants