Skip to content

Bug: stub for time.gmtime() is not working correctly #7588

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

Closed
jolaf opened this issue Sep 30, 2019 · 1 comment
Closed

Bug: stub for time.gmtime() is not working correctly #7588

jolaf opened this issue Sep 30, 2019 · 1 comment

Comments

@jolaf
Copy link
Contributor

jolaf commented Sep 30, 2019

The following code:

from time import gmtime
(a, b, c, d, e, f, g, h, i) = gmtime()
print(a, b, c, d, e, f, g, h, i)

produces the following output:

$ python3 Test.py 
2019 9 30 16 29 49 0 273 0
$ mypy Test.py
Test.py:3: error: Too many values to unpack (9 expected, 11 provided)

$ mypy --version
mypy 0.730
$ python3 --version
Python 3.6.8

reveal_type(gmtime) produces the following output:
Revealed type is 'def (secs: Union[builtins.float, None] =) -> Tuple[builtins.int, builtins.int, builtins.int, builtins.int, builtins.int, builtins.int, builtins.int, builtins.int, builtins.int, builtins.str, builtins.int, fallback=time.struct_time]

@msullivan
Copy link
Collaborator

This seems to be a real issue that stems from all of the fields being listed as part of a namedtuple in the typeshed stub, when only 9 of them are part of the tuple and the rest are just attributes.

The bug should be filed against typeshed, though.
Thanks!

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

No branches or pull requests

2 participants