Skip to content

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

Merged
adamreichold merged 1 commit into
mainfrom
dont-elide-lifetimes
Sep 11, 2023
Merged

Do not elide lifetimes and try to be disciplined about naming the GIL lifetime 'py.#390
adamreichold merged 1 commit into
mainfrom
dont-elide-lifetimes

Conversation

@adamreichold

Copy link
Copy Markdown
Member

No description provided.

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

@mejrs mejrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks :)


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

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread README.md Outdated
@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