Skip to content

Fix Mapping and MutableMapping annotations to use mapping schema instead of dict schema - #10020

Merged
sydney-runkle merged 2 commits into
mainfrom
fix-mapping
Aug 1, 2024
Merged

sydney-runkle merged 2 commits into
mainfrom
fix-mapping

Conversation

@sydney-runkle

Copy link
Copy Markdown
Contributor

Fix #9549

@github-actions github-actions Bot added the relnotes-fix Used for bugfixes. label Aug 1, 2024
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 1, 2024 •

Copy link
Copy Markdown

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1915046
Status: ✅  Deploy successful!
Preview URL: https://06f8108c.pydantic-docs.pages.dev
Branch Preview URL: https://fix-mapping.pydantic-docs.pages.dev

View logs

@codspeed

codspeed Bot commented Aug 1, 2024 •

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #10020 will not alter performance

Comparing fix-mapping (1915046) with main (41f2d48)

Summary

✅ 17 untouched benchmarks

@github-actions

github-actions Bot commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  __init__.py
  pydantic/_internal
  _generate_schema.py
Project Total  

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

@sydney-runkle
sydney-runkle requested a review from adriangb August 1, 2024 19:53
@dmontagu

dmontagu commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

As in #10021 I'm a bit nervous that this could cause a breaking change for someone that might currently be using these types as field annotations, since it will change their behavior. But I guess it's probably worth the improvement.

@sydney-runkle sydney-runkle changed the title Fix mapping schema build issue Fix Mapping and MutableMapping schemas to handle subclasses Aug 1, 2024
@sydney-runkle

sydney-runkle commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor Author

Agreed, I think this is worth the improvement for now. I would categorize this as a bug fix honestly, given the incorrect placement of Mapping in the dict types list.

@sydney-runkle

Copy link
Copy Markdown
Contributor Author

I think we can handle our subclass behavior in a separate PR.

@sydney-runkle sydney-runkle changed the title Fix Mapping and MutableMapping schemas to handle subclasses Fix Mapping and MutableMapping annotations to use mapping schema instead of dict schema Aug 1, 2024
@sydney-runkle sydney-runkle added the relnotes-change Used for changes to existing functionality which don't have a better categorization. label Aug 1, 2024
@sydney-runkle
sydney-runkle merged commit 1e41385 into main Aug 1, 2024
@sydney-runkle
sydney-runkle deleted the fix-mapping branch August 1, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-change Used for changes to existing functionality which don't have a better categorization. relnotes-fix Used for bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeAdapter for collections.abc.MutableMapping fails when validate_python called on a collections.UserDict in strict mode

2 participants