Skip to content

Conversation

davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented Sep 27, 2025

Closes #5393
Closes #5394

This PR adds CastError as a new error type, leaving DowncastError as-is but deprecated.

Across the codebase I swap all DowncastError for CastError, and same for DowncastIntoError -> CastIntoError.

Copy link

codspeed-hq bot commented Sep 27, 2025

CodSpeed Performance Report

Merging #5468 will improve performances by 12.35%

Comparing davidhewitt:cast-error (4d64fbb) with main (d9e2c50)

Summary

⚡ 1 improvement
✅ 97 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
extract_str_extract_fail 2 µs 1.7 µs +12.35%

@davidhewitt
Copy link
Member Author

Note to self: add migration guide for this and .downcast() deprecation at the same time.

Copy link
Contributor

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@davidhewitt davidhewitt enabled auto-merge October 9, 2025 19:53
@davidhewitt davidhewitt added this pull request to the merge queue Oct 9, 2025
Merged via the queue into PyO3:main with commit 254b29f Oct 9, 2025
43 checks passed
@davidhewitt davidhewitt deleted the cast-error branch October 9, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose a way for downstream to create a (Down)CastError from a Borrowed rename DowncastError into CastError
2 participants