Skip to content

fix(pyi): drop fabricated 6-arg from_datetime overload (#105)#108

Merged
ssmichael1 merged 2 commits into
mainfrom
fix/pyi-from-datetime-overload
May 25, 2026
Merged

fix(pyi): drop fabricated 6-arg from_datetime overload (#105)#108
ssmichael1 merged 2 commits into
mainfrom
fix/pyi-from-datetime-overload

Conversation

@ssmichael1
Copy link
Copy Markdown
Owner

@ssmichael1 ssmichael1 commented May 25, 2026

Summary

The .pyi stub declared two time.from_datetime overloads — only one (the datetime.datetime argument form) actually has a Rust binding. The 6-arg from_datetime(year, month, day, hour, min, sec, scale) overload was a stub-file fabrication; calls against it failed at runtime with "takes 1 positional argument but 6 were given" while the language server happily auto-completed the broken signature. The 6-arg constructor already exists at runtime as time.from_gregorian and is correctly documented in the stubs.

This PR deletes the bogus overload and the now-redundant @typing.overload decorator on the surviving single signature. .pyi-only — no Rust changes.

Fixes #105.

Test plan

  • grep "fn from_datetime" python/src/ confirms exactly one Rust binding (single datetime.datetime argument)
  • grep "def from_gregorian" python/satkit/satkit.pyi confirms the 6-arg constructor is documented under its correct name
  • Spot-check in an editor that the language server no longer suggests the 6-arg form for time.from_datetime

🤖 Generated with Claude Code

ssmichael1 and others added 2 commits May 25, 2026 07:51
The `.pyi` stub claimed two `time.from_datetime` overloads, but only one
matched a real Rust binding (the single-arg `datetime.datetime` form at
`python/src/pyinstant.rs:485`). The 6-arg variant
`from_datetime(year, month, day, hour, min, sec, scale)` was a
stub-file fabrication — no Rust function backs it, so calls like
`time.from_datetime(2024, 3, 1, 12, 0, 0.0)` blew up at runtime with
"takes 1 positional argument but 6 were given" while the language
server happily auto-completed the broken signature.

Fix is `.pyi`-only:
* Delete the bogus 6-arg `@overload` block.
* Drop the now-redundant `@typing.overload` decorator from the
  surviving single signature.

Users wanting the 6-arg constructor: that already exists at runtime
and in the stubs as `time.from_gregorian(year, month, day, hour, min,
sec)`.

Fixes #105.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same lint-fix as PR #107: rustfmt has been failing on main since PR
#106 merged. Whichever of #107 / #108 merges first will clear the
duplicate fix from the other.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ssmichael1 ssmichael1 merged commit 2779178 into main May 25, 2026
5 checks passed
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.

time.from_datetime(...) overloads are broken

1 participant