Skip to content

Commit

Permalink
Bump up PyO3 to 0.22.2 (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlickerSoul authored Aug 4, 2024
1 parent 8523610 commit a81a7c6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy3.8'
- 'pypy3.9'
- 'pypy3.10'
Expand All @@ -45,6 +46,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: install rust
uses: actions-rs/toolchain@v1
Expand Down
82 changes: 14 additions & 68 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rust-version = "1.63"
[dependencies]
crossbeam-channel = "0.5.12"
notify = "6.1.1"
pyo3 = {version = "0.21.2", features = ["extension-module", "generate-import-lib"]}
pyo3 = { version = "0.22.2", features = ["extension-module", "generate-import-lib"] }

[lib]
name = "_rust_notify"
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ impl RustNotify {
if matches!(slf.borrow().watcher, WatcherEnum::None) {
return Err(PyRuntimeError::new_err("RustNotify watcher closed"));
}
let stop_event_is_set: Option<&PyAny> = match stop_event.is_none(py) {
let stop_event_is_set: Option<Bound<PyAny>> = match stop_event.is_none(py) {
true => None,
false => {
let event: &PyAny = stop_event.extract(py)?;
let func: &PyAny = event.getattr("is_set")?.extract()?;
let func = stop_event.getattr(py, "is_set")?.into_bound(py);
if !func.is_callable() {
return Err(PyTypeError::new_err("'stop_event.is_set' must be callable"));
}

Some(func)
}
};
Expand All @@ -288,7 +288,7 @@ impl RustNotify {
return wf_error!(error.clone());
}

if let Some(is_set) = stop_event_is_set {
if let Some(is_set) = stop_event_is_set.as_ref() {
if is_set.call0()?.is_truthy()? {
if slf.borrow().debug {
eprintln!("stop event set, stopping...");
Expand Down

0 comments on commit a81a7c6

Please sign in to comment.