Fix broken links

https://pyo3.github.io/PyO3 -> https://pyo3.github.io/pyo3
in the documentation.
This commit is contained in:
Vlad Shcherbina 2018-02-14 17:20:35 +03:00
parent 473b1f8b30
commit f8d914cac8
3 changed files with 12 additions and 12 deletions

View File

@ -100,8 +100,8 @@ TODO
[ToPyObject]: https://pyo3.github.io/pyo3/pyo3/trait.ToPyObject.html [ToPyObject]: https://pyo3.github.io/pyo3/pyo3/trait.ToPyObject.html
[IntoPyObject]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyObject.html [IntoPyObject]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyObject.html
[PyObject]: https://pyo3.github.io/PyO3/pyo3/struct.PyObject.html [PyObject]: https://pyo3.github.io/pyo3/pyo3/struct.PyObject.html
[IntoPyTuple]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyTuple.html [IntoPyTuple]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyTuple.html
[PyTuple]: https://pyo3.github.io/PyO3/pyo3/struct.PyTuple.html [PyTuple]: https://pyo3.github.io/pyo3/pyo3/struct.PyTuple.html
[ObjectProtocol]: https://pyo3.github.io/pyo3/pyo3/trait.ObjectProtocol.html [ObjectProtocol]: https://pyo3.github.io/pyo3/pyo3/trait.ObjectProtocol.html
[IntoPyDictPointer]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyDictPointer.html [IntoPyDictPointer]: https://pyo3.github.io/pyo3/pyo3/trait.IntoPyDictPointer.html

View File

@ -34,7 +34,7 @@ let gil = Python::acquire_gil();
## Raise an exception ## Raise an exception
To raise an exception, first you need to obtain an exception type and construct a new [`PyErr`](https://pyo3.github.io/PyO3/pyo3/struct.PyErr.html), then call [`PyErr::restore()`](https://pyo3.github.io/PyO3/pyo3/struct.PyErr.html#method.restore) method to write the exception back to the Python interpreter's global state. To raise an exception, first you need to obtain an exception type and construct a new [`PyErr`](https://pyo3.github.io/pyo3/pyo3/struct.PyErr.html), then call [`PyErr::restore()`](https://pyo3.github.io/pyo3/pyo3/struct.PyErr.html#method.restore) method to write the exception back to the Python interpreter's global state.
```rust ```rust
extern crate pyo3; extern crate pyo3;
@ -50,7 +50,7 @@ fn main() {
} }
``` ```
If you already have a Python exception instance, you can simply call [`PyErr::from_instance()`](https://pyo3.github.io/PyO3/pyo3/struct.PyErr.html#method.from_instance). If you already have a Python exception instance, you can simply call [`PyErr::from_instance()`](https://pyo3.github.io/pyo3/pyo3/struct.PyErr.html#method.from_instance).
```rust ```rust
PyErr::from_instance(py, err).restore(py); PyErr::from_instance(py, err).restore(py);
@ -76,7 +76,7 @@ fn my_func(arg: PyObject) -> PyResult<()> {
## Check exception type ## Check exception type
Python has an [`isinstance`](https://docs.python.org/3/library/functions.html#isinstance) method to check object type, Python has an [`isinstance`](https://docs.python.org/3/library/functions.html#isinstance) method to check object type,
in `PyO3` there is a [`Python::is_instance()`](https://pyo3.github.io/PyO3/pyo3/struct.Python.html#method.is_instance) method which does the same thing. in `PyO3` there is a [`Python::is_instance()`](https://pyo3.github.io/pyo3/pyo3/struct.Python.html#method.is_instance) method which does the same thing.
```rust ```rust
extern crate pyo3; extern crate pyo3;
@ -93,7 +93,7 @@ fn main() {
} }
``` ```
[`Python::is_instance()`](https://pyo3.github.io/PyO3/pyo3/struct.Python.html#method.is_instance) calls the underlaying [`PyType::is_instance`](https://pyo3.github.io/PyO3/pyo3/struct.PyType.html#method.is_instance) method to do the actual work. [`Python::is_instance()`](https://pyo3.github.io/pyo3/pyo3/struct.Python.html#method.is_instance) calls the underlaying [`PyType::is_instance`](https://pyo3.github.io/pyo3/pyo3/struct.PyType.html#method.is_instance) method to do the actual work.
To check the type of an exception, you can simply do: To check the type of an exception, you can simply do:
@ -103,10 +103,10 @@ let ret = py.is_instance::<exc::TypeError>(&err.instance(py)).expect("Error call
## Handle Rust Error ## Handle Rust Error
The vast majority of operations in this library will return [`PyResult<T>`](https://pyo3.github.io/PyO3/pyo3/type.PyResult.html). The vast majority of operations in this library will return [`PyResult<T>`](https://pyo3.github.io/pyo3/pyo3/type.PyResult.html).
This is an alias for the type `Result<T, PyErr>`. This is an alias for the type `Result<T, PyErr>`.
A [`PyErr`](https://pyo3.github.io/PyO3/pyo3/struct.PyErr.html) represents a Python exception. A [`PyErr`](https://pyo3.github.io/pyo3/pyo3/struct.PyErr.html) represents a Python exception.
Errors within the `PyO3` library are also exposed as Python exceptions. Errors within the `PyO3` library are also exposed as Python exceptions.
PyO3 library handles python exception in two stages. During first stage `PyErr` instance get PyO3 library handles python exception in two stages. During first stage `PyErr` instance get
@ -116,7 +116,7 @@ exception instance get crated and set to python interpreter.
In simple case, for custom errors support implementation of `std::convert::From<T>` trait In simple case, for custom errors support implementation of `std::convert::From<T>` trait
for this custom error is enough. `PyErr::new` accepts arguments in form for this custom error is enough. `PyErr::new` accepts arguments in form
of `ToPyObject + 'static`. In case if `'static` constraint can not be satisfied or of `ToPyObject + 'static`. In case if `'static` constraint can not be satisfied or
more complex arguments are required [`PyErrArgument`](https://pyo3.github.io/PyO3/pyo3/trait.PyErrArguments.html) more complex arguments are required [`PyErrArgument`](https://pyo3.github.io/pyo3/pyo3/trait.PyErrArguments.html)
trait can be implemented. In that case actual exception arguments creation get delayed trait can be implemented. In that case actual exception arguments creation get delayed
until `Python` object is available. until `Python` object is available.
@ -175,5 +175,5 @@ fn cancel(fut: PyFuture) -> PyResult<()> {
``` ```
[`exc`](https://pyo3.github.io/PyO3/pyo3/exc/index.html) defines exceptions for [`exc`](https://pyo3.github.io/pyo3/pyo3/exc/index.html) defines exceptions for
several standard library modules. several standard library modules.

View File

@ -118,10 +118,10 @@ As a result, this API will **allow mutating Python objects even if they are not
in a mutable Rust variable**. in a mutable Rust variable**.
The Python interpreter uses a global interpreter lock (GIL) to ensure thread-safety. The Python interpreter uses a global interpreter lock (GIL) to ensure thread-safety.
This API uses a zero-sized [`struct Python<'p>`](https://pyo3.github.io/PyO3/pyo3/struct.Python.html) as a token to indicate This API uses a zero-sized [`struct Python<'p>`](https://pyo3.github.io/pyo3/pyo3/struct.Python.html) as a token to indicate
that a function can assume that the GIL is held. that a function can assume that the GIL is held.
You obtain a [`Python`](https://pyo3.github.io/PyO3/pyo3/struct.Python.html) instance You obtain a [`Python`](https://pyo3.github.io/pyo3/pyo3/struct.Python.html) instance
by acquiring the GIL, and have to pass it into some operations that call into the Python runtime. by acquiring the GIL, and have to pass it into some operations that call into the Python runtime.
PyO3 library provides wrappers for python native objects. Ownership of python objects are PyO3 library provides wrappers for python native objects. Ownership of python objects are