Skip to content

Update typeshed to 0abbaf725bf8439af222272e14326037fa5d4b2b - #11996

Merged
Bill Schnurr (bschnurr) merged 3 commits into
microsoft:mainfrom
bschnurr:bschnurr/update-typeshed-20261109
Nov 16, 2026
Merged

Bill Schnurr (bschnurr) merged 3 commits into
microsoft:mainfrom
bschnurr:bschnurr/update-typeshed-20261109

Conversation

@bschnurr

@bschnurr Bill Schnurr (bschnurr) commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Upstream typeshed update

Update bundled typeshed from 7030b265d887eeacee07e47aa2cca412b07950c4 to 0abbaf725bf8439af222272e14326037fa5d4b2b.

Upstream comparison.

Deferred datetime migration

Retain stdlib/datetime.pyi from the pre-PR baseline rather than importing the generic datetime migration from python/typeshed#11844:

  • The generic stub inferred datetime.combine(day, aware_time) as datetime[None], even though omitting tzinfo preserves the time's timezone. Explicit tzinfo=None clears it.
  • The generic constructor and factories returned base datetime instances statically, rejecting valid subclass-only methods.

Typeshed corrected the omitted-argument overload in python/typeshed#16811 (1084116c1a11dd8486242239bc914707e3e9fb2f), but its current stub still does not preserve subclass identity. Defer the migration as requested in review rather than carrying a speculative generic-stub redesign. The retained file matches the pre-PR Git blob exactly.

Failure classification

  • A (upstream stub issues): both review findings reproduced; addressed by deferring the generic datetime migration.
  • B (Pyright bug) / C (test fragility): no analyzer or formatting fixes required.
  • D (environment): the initial update needed local dependencies installed. Follow-up focused tests use explicit Jest selectors because positional arguments after the package script's ignore-pattern option can be treated as exclusions.

Pyright fixes

No analyzer changes. All other bundled typeshed updates remain in place.

Test updates

  • Restore the original OverloadCall1 expectation (datetime); the generic migration is no longer included.
  • Add Datetime1 to cover subclass constructors (positional and keyword timezones), now, related factories, replace, astimezone, and combine.
  • Cover omitted, explicit None (keyword and positional), and explicit timezone forms of combine, plus naive-time controls. Preserve conservative tzinfo | None inference rather than falsely promising None.
  • Check the exact locations and diagnostic rules for two invalid timezone arguments.

Precision report

Preserve the pre-PR datetime contract: constructors and factories retain subclass identity, and timezone inference remains conservative. This intentionally defers the new timezone-specific generic precision until the upstream migration also preserves subclasses. No existing reveal expectations differ from the pre-PR baseline.

Validation

  • New Datetime1 regression fails on reviewed HEAD 0e651aa0294a33179c87dc00706ff339f8f83901 (37 errors versus the two intended invalid-argument diagnostics).
  • Focused Datetime1 and OverloadCall1 tests pass after restoring the stub.
  • CPython 3.14.7: subclass identity, omitted/explicit-None timezone behavior, and invalid timezone runtime checks passed.
  • Full suite (pnpm --dir packages/pyright-internal test --maxWorkers=4): 99 suites passed, 1 skipped; 3,731 tests passed, 12 skipped; no failures. Jest reported a worker-teardown warning; the command exited successfully.
  • pnpm run check: passed (syncpack, ESLint, Prettier).
  • pnpm run typecheck: passed.
  • git diff --check: passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Typeshed made datetime generic over tzinfo in python/typeshed#11844 (6e76a91ed3fc9a2c41b46ac6c3ae1673d0a3c2a1). The existing unparameterized annotation now displays as datetime[Any].

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rchiodo

Rich Chiodo (rchiodo) commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

🔒 Automated review in progress — Rich Chiodo (@rchiodo) is auto-reviewing this PR.

@rchiodo

Rich Chiodo (rchiodo) commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Reviewed commit: 6fa60591952243eca100a0045e8c06ee8d003891

Result: 🔴 could-not-verify

Verification details

Verification: Automated verification is best effort. The PR author remains responsible for testing.

Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "8268d270df1e6699119100ae60c83c03cf5a3ca9a2e21def4f5e65cc1705682e": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found

Test runs: none recorded.

@rchiodo Rich Chiodo (rchiodo) added the review-auto:changes-requested Automated review: posted blocking findings to address. label Nov 9, 2026
Category A: python/typeshed#11844 (6e76a91ed3fc9a2c41b46ac6c3ae1673d0a3c2a1) loses datetime subclass identity and incorrectly infers an omitted combine timezone as None. python/typeshed#16811 fixes combine, but subclass preservation remains unresolved.

Retain the exact pre-PR datetime stub and original OverloadCall1 reveal rather than carrying an incomplete generic migration. Add focused regression coverage for constructors, factories, combine timezone forms, and invalid arguments. Full suite: 3731 tests passed; lint and typecheck passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@rchiodo Rich Chiodo (rchiodo) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via Review Center.

@rchiodo Rich Chiodo (rchiodo) added review-auto:approved Automated review: no blocking findings (approval posted). and removed review-auto:changes-requested Automated review: posted blocking findings to address. labels Nov 16, 2026
@bschnurr
Bill Schnurr (bschnurr) merged commit 3fa4803 into microsoft:main Nov 16, 2026
13 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-auto:approved Automated review: no blocking findings (approval posted).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants