fix(pyi): drop fabricated 6-arg from_datetime overload (#105)#108
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
.pyistub declared twotime.from_datetimeoverloads — only one (thedatetime.datetimeargument form) actually has a Rust binding. The 6-argfrom_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 astime.from_gregorianand is correctly documented in the stubs.This PR deletes the bogus overload and the now-redundant
@typing.overloaddecorator 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 (singledatetime.datetimeargument)grep "def from_gregorian" python/satkit/satkit.pyiconfirms the 6-arg constructor is documented under its correct nametime.from_datetime🤖 Generated with Claude Code