Skip to content

Correct fractional return types in boltons.timeutils - #16956

Open
Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix-boltons-fractional-time-types
Open

Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix-boltons-fractional-time-types

Conversation

@Lushiyao5

Copy link
Copy Markdown
Contributor

dt_to_timestamp() returns the result of timedelta.total_seconds(), including fractional seconds. ConstantTZInfo.utcoffset_hours divides the offset in seconds by 3600 and likewise returns a float. Correct both return types in the stub.

I verified a fractional timestamp for both aware and naive datetimes and a 5.5-hour timezone offset at runtime. Both mypy assertions failed before the change. The example and the changed stub pass mypy after the change.

This patch was prepared with assistance from OpenAI Codex.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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.

1 participant