Fix function and method name fields

This commit is contained in:
Murarth 2015-08-02 00:14:35 -07:00
parent 5d16c62cd5
commit 74cdb841c6
2 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,8 @@ macro_rules! py_fn {
ml_doc: 0 as *const $crate::_detail::libc::c_char
};
unsafe {
[ method_def_ $f ].ml_name =
concat!(stringify!($f), "\0").as_ptr() as *const _;
$crate::_detail::py_fn_impl(&mut [ method_def_ $f ])
}
}})

View File

@ -86,12 +86,16 @@ macro_rules! py_method {
}
static mut [ method_def_ $f ]: $crate::_detail::ffi::PyMethodDef = $crate::_detail::ffi::PyMethodDef {
//ml_name: bytes!(stringify!($f), "\0"),
ml_name: b"<rust method>\0" as *const u8 as *const $crate::_detail::libc::c_char,
ml_name: 0 as *const $crate::_detail::libc::c_char,
ml_meth: Some([ wrap_ $f ]),
ml_flags: $crate::_detail::ffi::METH_VARARGS,
ml_doc: 0 as *const $crate::_detail::libc::c_char
};
unsafe { $crate::_detail::py_method_impl(&mut [ method_def_ $f ], $f) }
unsafe {
[ method_def_ $f ].ml_name =
concat!(stringify!($f), "\0").as_ptr() as *const _;
$crate::_detail::py_method_impl(&mut [ method_def_ $f ], $f)
}
}})
}