Skip to content

pyclass: support extending Exception types#1591

Merged
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:inherit-exceptions
May 4, 2021
Merged

pyclass: support extending Exception types#1591
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:inherit-exceptions

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

Implements support for #[pyclass(extends=Exception)].

I expected there to be bigger issues around doing this; it turned out to be very easy.

cc @Stranger6667 who was asking about this on Gitter just the other day.

Comment thread tests/test_inheritance.rs
@ravenexp
Copy link
Copy Markdown
Contributor

ravenexp commented May 4, 2021

Does this feature make create_exception!() obsolete?

@davidhewitt davidhewitt force-pushed the inherit-exceptions branch from c27adcf to d81abe8 Compare May 4, 2021 21:00
@davidhewitt
Copy link
Copy Markdown
Member Author

In the long run, yes. But that'll come when we have a full #[pyexception] macro. I'll try to write the implementation still needed on #295 soon.

@davidhewitt davidhewitt merged commit 350e7b2 into PyO3:main May 4, 2021
@davidhewitt davidhewitt deleted the inherit-exceptions branch May 4, 2021 22:04
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.

3 participants