Change Python::run to return PyResult<()>
This commit is contained in:
parent
c4c75bbf81
commit
803f18e61d
|
@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
* Add `marshal` module. [#460](https://github.com/PyO3/pyo3/pull/460)
|
||||
|
||||
### Changed
|
||||
|
||||
* `Python::run` returns `PyResult<()>` instead of `PyResult<&PyAny>`.
|
||||
* Methods decorated with `#[getter]` and `#[setter]` can now omit wrapping the
|
||||
result type in `PyResult` if they don't raise exceptions.
|
||||
|
||||
|
|
|
@ -108,8 +108,11 @@ impl<'p> Python<'p> {
|
|||
code: &str,
|
||||
globals: Option<&PyDict>,
|
||||
locals: Option<&PyDict>,
|
||||
) -> PyResult<&'p PyAny> {
|
||||
self.run_code(code, ffi::Py_file_input, globals, locals)
|
||||
) -> PyResult<()> {
|
||||
let res = self.run_code(code, ffi::Py_file_input, globals, locals);
|
||||
res.map(|obj| {
|
||||
debug_assert!(crate::ObjectProtocol::is_none(obj));
|
||||
})
|
||||
}
|
||||
|
||||
/// Runs code in the given context.
|
||||
|
|
Loading…
Reference in a new issue