Skip to content

Conversation

@anhpham1509
Copy link
Contributor

@anhpham1509 anhpham1509 commented Jun 6, 2024

Change Summary

  • Instead of dictionary access, it's safe to use .get for private model attributes with empty dictionary fallback value.
  • This allows compatibility to v1 BaseModel when using pickle with reference to data class as well.

Related issue number

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

Selected Reviewer: @adriangb

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Jun 6, 2024
@codspeed-hq
Copy link

codspeed-hq bot commented Jun 6, 2024

CodSpeed Performance Report

Merging #9584 will not alter performance

Comparing anhpham1509:fix/allow-backward-compatibility-with-v1-basemodel (b640268) with main (93d6015)

Summary

✅ 13 untouched benchmarks

@anhpham1509
Copy link
Contributor Author

please review

Copy link
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you for the fix!

@sydney-runkle sydney-runkle merged commit 8fef562 into pydantic:main Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants