Skip to content

Use python strings for field names - #12631

Merged
davidhewitt merged 2 commits into
mainfrom
dh/py-backed-field-names
Dec 17, 2025
Merged

davidhewitt merged 2 commits into
mainfrom
dh/py-backed-field-names

Conversation

@davidhewitt

@davidhewitt davidhewitt commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Change Summary

Similar to #12571

The idea is again that field names are typically being stored at the moment as both Python Py and Rust String.

By replacing these with PyO3's PyBackedStr we avoid needing to copy data into new Rust strings, while still being able to access the data as &str when needed.

Related issue number

This is yet another step on the way to making #12550 apply as a reasonable diff.

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
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@github-actions github-actions Bot added the relnotes-fix Used for bugfixes. label Dec 16, 2025
@codspeed

codspeed Bot commented Dec 16, 2025 •

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #12631 will improve performances by 6.74%

Comparing dh/py-backed-field-names (3758050) with main (a728bac)

Summary

⚡ 1 improvement
✅ 210 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
⚡ test_arguments 25.8 µs 24.2 µs +6.74%

@github-actions

github-actions Bot commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 16, 2025 •

Copy link
Copy Markdown

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3758050
Status: ✅  Deploy successful!
Preview URL: https://f4afec07.pydantic-docs.pages.dev
Branch Preview URL: https://dh-py-backed-field-names.pydantic-docs.pages.dev

View logs

@davidhewitt davidhewitt added relnotes-performance Used for performance improvements. and removed relnotes-fix Used for bugfixes. labels Dec 16, 2025
@davidhewitt
davidhewitt force-pushed the dh/py-backed-field-names branch from 0f5c6f8 to 3758050 Compare December 16, 2025 13:10
@davidhewitt
davidhewitt marked this pull request as ready for review December 16, 2025 14:36
@davidhewitt
davidhewitt requested a review from Viicos December 16, 2025 14:36
@davidhewitt
davidhewitt merged commit 1502098 into main Dec 17, 2025
69 checks passed
@davidhewitt
davidhewitt deleted the dh/py-backed-field-names branch December 17, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-performance Used for performance improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants