-
Notifications
You must be signed in to change notification settings - Fork 740
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
make GILOnceCell::get_or_try_init_type_ref
public
#4542
base: main
Are you sure you want to change the base?
Conversation
1e65734
to
5b16662
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change
PyModule::import
suggestion toPython::import
instead
Why? I don't have a strong opinion either way, but slightly prefer PyModule::import
.
src/sync.rs
Outdated
/// # }); | ||
/// ``` | ||
/// | ||
pub fn get_or_try_init_type_ref<'py>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use a better name. Maybe just "import"? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but then maybe it should be implemented for GILOnceCell<Py<T>> where T: PyTypeInfo
instead of GILOnceCell<Py<PyType>>
? Otherwise, I would call it import_type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be fine with that. I think you want T: PyTypeCheck
rather than T: PyTypeInfo
, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, done in 79568f6!
Since |
I prefer |
From a documentation perspective I would prefer that people visit Also, using "constructor" syntax also makes it clear that when they use it, they're getting a module (rather than something arbitrary like |
245dae4
to
79568f6
Compare
@davidhewitt @mejrs Fair enough, I reverted the guide back to |
Resolves #4516.
GILOnceCell::get_or_try_init_type_ref
toGILOnceCell::import
and make it public API, adding an example for it.GILOnceCell::import
.Python::eval_bound
(which is deprecated) toPython::eval
.Python::run_bound
(which is deprecated) toPython::run
, also adding missing link.