Skip to content

time.time_struct should be a 9-tuple with 2 extra properties in python3.3+ #3297

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
gwk opened this issue Oct 3, 2019 · 1 comment
Closed

Comments

@gwk
Copy link
Contributor

gwk commented Oct 3, 2019

For Python 3.3+, time.pyi represents time_struct as an 11-field NamedTuple. This is incorrect; despite the additional tm_zone and tm_gmtoff fields, it behaves as a 9-tuple: len(gmtime()) == 9. Note however that gmtime().n_fields == 11.

It appears to me that time_struct was modified to keep it's 9-tuple shape while adding two additional fields. The type stub needs to reflect this, or else mypy messes up unpacking of time_struct.

Would the correct solution be define the NamedTuple with 9 fields, plus two additional properties?

@srittau
Copy link
Collaborator

srittau commented Oct 3, 2019

Duplicate of #3286.

@srittau srittau closed this as completed Oct 3, 2019
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