Skip to content

Commit

Permalink
refactor: directly call signal handler
Browse files Browse the repository at this point in the history
Not super-imporant I don't think, but it feels better to use `call1` instead of
`run_bound` on some Python code.
  • Loading branch information
gadomski committed Oct 18, 2024
1 parent 77a0d38 commit da3f60a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ impl From<pythonize::PythonizeError> for Error {
fn main(py: Python<'_>) {
use clap::Parser;

// https://github.com/PyO3/pyo3/issues/3218
py.run_bound(
"import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)",
None,
None,
)
.unwrap();

let signal = py.import_bound("signal").unwrap();
signal
.getattr("signal")
.unwrap()
.call1((
signal.getattr("SIGINT").unwrap(),
signal.getattr("SIG_DFL").unwrap(),
))
.unwrap();
let args: Vec<_> = std::env::args().skip(1).collect();
::cql2_cli::Cli::parse_from(args).run()
}
Expand Down

0 comments on commit da3f60a

Please sign in to comment.