8000 Refactor generics handling to avoid TypeVar.default dependency by rawathemant246 · Pull Request #11297 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Conversation

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
@rawathemant246
Copy link
@rawathemant246 rawathemant246 commented Jan 17, 2025

Change Summary

This PR refactors the generics handling logic to avoid dependency on the TypeVar.default attribute, which caused compatibility issues with type-checkers and older versions of Python. It also updates the corresponding tests to ensure correct functionality and resolves issues related to the check_parameters_count method and optional TypeVars.

Related issue number

Fixes #11270

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog.
  • Unit tests for the changes exist.
  • Tests pass on CI.
  • Documentation reflects the changes where applicable (e.g., updated docstrings for the affected methods).
  • My PR is ready to review, please review.

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Jan 17, 2025
@codspeed-hq
Copy link
codspeed-hq bot commented Jan 17, 2025

CodSpeed Performance Report

Merging #11297 will not alter performance

Comparing rawathemant246:fix/generic-test-failure (41be980) with main (4358800)

Summary

✅ 45 untouched benchmarks

@github-actions
Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  main.py
  pydantic/_internal
  _generics.py 419, 422-427
Project Total  

This report was generated by python-coverage-comment-action

@Viicos Viicos self-requested a review January 22, 2025 16:59
@Viicos
Copy link
Member
Viicos commented Jan 23, 2025

Thanks for the pull request. However, this isn't quite right (a type variable bound is different from a type variable default). I opened #11332.

@Viicos Viicos removed their request for review January 23, 2025 17:15
@Viicos Viicos closed this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-fix Used for bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic type defaults (pep-696) throws an exception when used in type annotations.

2 participants

0