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

add import_exception_bound! macro #4027

Merged
merged 2 commits into from
Mar 31, 2024
Merged

Conversation

davidhewitt
Copy link
Member

For #3989

The idea here is that this macro implements only the traits needed to use an imported exception inside a Bound (and not as a GIL Ref). This should help with coverage.

cc @alex - want to give this a try?

@alex
Copy link
Contributor

alex commented Mar 30, 2024

I think there's a syntax error or something somewhere:

   Compiling cryptography-rust v0.1.0 (/Users/alex_gaynor/projects/cryptography/src/rust)
error: expected one of `!` or `[`, found `module`
   --> src/exceptions.rs:26:1
    |
26  | pyo3::import_exception_bound!(cryptography.exceptions, AlreadyUpdated);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `!` or `[`
    |
   ::: /Users/alex_gaynor/.cargo/git/checkouts/pyo3-8f6c8fc902a366fa/33371a4/src/types/mod.rs:233:34
    |
233 |     ($name:ty, $typeobject:expr, $module:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
    |                                  ------------ while parsing argument for this `expr` macro fragment
    |
    = note: this error originates in the macro `pyo3::import_exception_bound` (in Nightly builds, run with -Z macro-backtrace for more info)

@davidhewitt
Copy link
Member Author

Ugh, sorry, force-pushed and actually moved some tests over to it now 🤦

@alex
Copy link
Contributor

alex commented Mar 30, 2024

Ok, local check looks good, pushing to CI for coverage.

@alex
Copy link
Contributor

alex commented Mar 30, 2024

Yeah, looks green pyca/cryptography#10671

@davidhewitt
Copy link
Member Author

Great!

@davidhewitt davidhewitt marked this pull request as ready for review March 31, 2024 19:36
Copy link

codspeed-hq bot commented Mar 31, 2024

CodSpeed Performance Report

Merging #4027 will improve performances by 24.29%

Comparing davidhewitt:import-exception (5ce07c3) with main (22e8dd1)

Summary

⚡ 1 improvements
✅ 71 untouched benchmarks

Benchmarks breakdown

Benchmark main davidhewitt:import-exception Change
drop_many_objects 68.6 µs 55.2 µs +24.29%

@davidhewitt davidhewitt added this pull request to the merge queue Mar 31, 2024
Merged via the queue into PyO3:main with commit 336b1c9 Mar 31, 2024
42 of 43 checks passed
@davidhewitt davidhewitt deleted the import-exception branch March 31, 2024 20:28
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.

2 participants