-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PyType::full_name which is tp_name and has an abi3 fallback.
- Loading branch information
1 parent
ff50285
commit 1e26957
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added `PyType::full_name` which in contrast to `PyType::name` includes the module name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
use pyo3::prelude::*; | ||
use std::borrow::Cow; | ||
|
||
#[pyfunction] | ||
fn issue_219() { | ||
// issue 219: acquiring GIL inside #[pyfunction] deadlocks. | ||
Python::with_gil(|_| {}); | ||
} | ||
|
||
#[pyfunction] | ||
fn get_type_full_name(obj: &PyAny) -> PyResult<Cow<'_, str>> { | ||
obj.get_type().full_name() | ||
} | ||
|
||
#[pymodule] | ||
pub fn misc(_py: Python<'_>, m: &PyModule) -> PyResult<()> { | ||
m.add_function(wrap_pyfunction!(issue_219, m)?)?; | ||
m.add_function(wrap_pyfunction!(get_type_full_name, m)?)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters