Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove needless uses of PyString::intern #1088

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Nov 21, 2023

Change Summary

While working on #1085 I noticed that we have some calls to PyString::intern in the validator build step. This isn't great; it's plain and simple a memory leak because:

  • These strings are already held onto by the validators, no need to intern them
  • Interning them means they will outlive the validators if they're destroyed

It's only a very minor issue, as validator build normally happens only on startup, but still worth cleaning up.

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @dmontagu

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #1088 (5dc764e) into main (be9c21c) will decrease coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1088      +/-   ##
==========================================
- Coverage   89.62%   89.62%   -0.01%     
==========================================
  Files         106      106              
  Lines       16366    16363       -3     
  Branches       35       35              
==========================================
- Hits        14668    14665       -3     
  Misses       1691     1691              
  Partials        7        7              
Files Coverage Δ
src/lookup_key.rs 92.69% <100.00%> (ø)
src/serializers/type_serializers/dataclass.rs 91.89% <100.00%> (ø)
src/validators/arguments.rs 99.57% <100.00%> (ø)
src/validators/dataclass.rs 97.72% <100.00%> (ø)
src/validators/model.rs 97.83% <100.00%> (ø)
src/validators/model_fields.rs 98.25% <100.00%> (ø)
src/validators/typed_dict.rs 96.93% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be9c21c...5dc764e. Read the comment docs.

Copy link

codspeed-hq bot commented Nov 21, 2023

CodSpeed Performance Report

Merging #1088 will not alter performance

Comparing dh/remove-spurious-interns (5dc764e) with main (3d3f406)

Summary

✅ 140 untouched benchmarks

@davidhewitt
Copy link
Contributor Author

please review

@davidhewitt davidhewitt merged commit a7739ec into main Nov 21, 2023
30 checks passed
@davidhewitt davidhewitt deleted the dh/remove-spurious-interns branch November 21, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants