1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pub use self::support::{create_pypolicy, PyPolicy};
use connect6::BOARD_CAPACITY;
use cpython::*;
mod support;
#[macro_export]
macro_rules! must {
($e:expr, $err:expr) => {
match $e {
Ok(obj) => obj,
Err(e) => panic!("{} : {:?}", $err, e),
}
};
}
#[macro_export]
macro_rules! py_policy {
() => {{
use cpython::{Python, PythonObject};
use $crate::pybind::PyEval;
let gil = Python::acquire_gil();
let py = gil.python();
let obj = $crate::macro_def::create_pypolicy(py)
.unwrap()
.into_object();
Box::new(PyEval::new(obj))
}};
}