Skip to content

Do not elide lifetimes and try to be disciplined about naming the GIL lifetime 'py. #390

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

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

adamreichold
Copy link
Member

No description provided.

@adamreichold adamreichold self-assigned this Sep 8, 2023
@adamreichold adamreichold requested a review from mejrs September 8, 2023 18:18
Copy link
Member

@mejrs mejrs left a comment

Choose a reason for hiding this comment

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

Thanks :)

@@ -3,9 +3,9 @@ use numpy::{IntoPyArray, PyArray2, PyReadonlyArray2};
use pyo3::{exceptions::PyRuntimeError, pymodule, types::PyModule, PyResult, Python};

#[pymodule]
fn rust_linalg(_py: Python, m: &PyModule) -> PyResult<()> {
fn rust_linalg<'py>(_py: Python<'py>, m: &'py PyModule) -> PyResult<()> {
Copy link
Member

Choose a reason for hiding this comment

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

Can these (and others) be anonymous? i.e. fn rust_linalg(_py: Python<'_>, m: &'_PyModule) -> PyResult<()> {?

Copy link
Member Author

Choose a reason for hiding this comment

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

They can, but I decidedly tried to keep the GIL lifetime named 'py instead of keeping it anonymous where that would be possible. I think if we do add these for documentation, we should go all the way.

@adamreichold adamreichold merged commit c16fbb1 into main Sep 11, 2023
@adamreichold adamreichold deleted the dont-elide-lifetimes branch September 11, 2023 12:15
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