fix some typos

Signed-off-by: cuishuang <imcusg@gmail.com>
This commit is contained in:
cuishuang 2022-04-24 22:06:32 +08:00
parent c6249f0214
commit 19e32a0621
16 changed files with 22 additions and 22 deletions

View File

@ -404,7 +404,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Remove FFI definition `PyCFunction_ClearFreeList` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425)
- `PYO3_CROSS_LIB_DIR` enviroment variable no long required when compiling for x86-64 Python from macOS arm64 and reverse. [#1428](https://github.com/PyO3/pyo3/pull/1428)
- `PYO3_CROSS_LIB_DIR` environment variable no long required when compiling for x86-64 Python from macOS arm64 and reverse. [#1428](https://github.com/PyO3/pyo3/pull/1428)
- Fix FFI definition `_PyEval_RequestCodeExtraIndex`, which took an argument of the wrong type. [#1429](https://github.com/PyO3/pyo3/pull/1429)
- Fix FFI definition `PyIndex_Check` missing with the `abi3` feature. [#1436](https://github.com/PyO3/pyo3/pull/1436)
- Fix incorrect `TypeError` raised when keyword-only argument passed along with a positional argument in `*args`. [#1440](https://github.com/PyO3/pyo3/pull/1440)
@ -413,7 +413,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- No longer include `__doc__` in `__all__` generated for `#[pymodule]`. [#1509](https://github.com/PyO3/pyo3/pull/1509)
- Always use cross-compiling configuration if any of the `PYO3_CROSS` family of environment variables are set. [#1514](https://github.com/PyO3/pyo3/pull/1514)
- Support `EnvironmentError`, `IOError`, and `WindowsError` on PyPy. [#1533](https://github.com/PyO3/pyo3/pull/1533)
- Fix unneccessary rebuilds when cycling between `cargo check` and `cargo clippy` in a Python virtualenv. [#1557](https://github.com/PyO3/pyo3/pull/1557)
- Fix unnecessary rebuilds when cycling between `cargo check` and `cargo clippy` in a Python virtualenv. [#1557](https://github.com/PyO3/pyo3/pull/1557)
- Fix segfault when dereferencing `ffi::PyDateTimeAPI` without the GIL. [#1563](https://github.com/PyO3/pyo3/pull/1563)
- Fix memory leak in `FromPyObject` implementations for `u128` and `i128`. [#1638](https://github.com/PyO3/pyo3/pull/1638)
- Fix `#[pyclass(extends=PyDict)]` leaking the dict contents on drop. [#1657](https://github.com/PyO3/pyo3/pull/1657)
@ -997,7 +997,7 @@ Yanked
### Changed
- Removes the types from the root module and the prelude. They now live in `pyo3::types` instead.
- All exceptions are consturcted with `py_err` instead of `new`, as they return `PyErr` and not `Self`.
- All exceptions are constructed with `py_err` instead of `new`, as they return `PyErr` and not `Self`.
- `as_mut` and friends take and `&mut self` instead of `&self`
- `ObjectProtocol::call` now takes an `Option<&PyDict>` for the kwargs instead of an `IntoPyDictPointer`.
- `IntoPyDictPointer` was replace by `IntoPyDict` which doesn't convert `PyDict` itself anymore and returns a `PyDict` instead of `*mut PyObject`.

View File

@ -18,7 +18,7 @@ cfg-if = "1.0"
libc = "0.2.62"
parking_lot = ">= 0.11, < 0.13"
# ffi bindings to the python interpreter, split into a seperate crate so they can be used independently
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.16.4" }
# support crates for macros feature

View File

@ -880,7 +880,7 @@ Python::with_gil(|py| {
})
```
All methods defined by PyO3 can be overriden. For example here's how you override `__repr__`:
All methods defined by PyO3 can be overridden. For example here's how you override `__repr__`:
```rust
# use pyo3::prelude::*;

View File

@ -124,7 +124,7 @@ impl Number {
}
```
### Unary arithmethic operations
### Unary arithmetic operations
```rust
# use pyo3::prelude::*;

View File

@ -215,7 +215,7 @@ struct RustyTransparentStruct {
#### Deriving [`FromPyObject`] for enums
The `FromPyObject` derivation for enums generates code that tries to extract the variants in the
order of the fields. As soon as a variant can be extracted succesfully, that variant is returned.
order of the fields. As soon as a variant can be extracted successfully, that variant is returned.
This makes it possible to extract Python union types like `str | int`.
The same customizations and restrictions described for struct derivations apply to enum variants,

View File

@ -8,7 +8,7 @@
2. The initialization code calls some Python API which temporarily releases the GIL e.g. `Python::import`.
3. Another thread (thread B) acquires the Python GIL and attempts to access the same `lazy_static` value.
4. Thread B is blocked, because it waits for `lazy_static`'s initialization to lock to release.
5. Thread A is blocked, because it waits to re-aquire the GIL which thread B still holds.
5. Thread A is blocked, because it waits to re-acquire the GIL which thread B still holds.
6. Deadlock.
PyO3 provides a struct [`GILOnceCell`] which works equivalently to `OnceCell` but relies solely on the Python GIL for thread safety. This means it can be used in place of `lazy_static` or `once_cell` where you are experiencing the deadlock described above. See the documentation for [`GILOnceCell`] for an example how to use it.

View File

@ -58,7 +58,7 @@ pub fn pymodule(args: TokenStream, input: TokenStream) -> TokenStream {
/// A proc macro used to implement Python's [dunder methods][1].
///
/// This atribute is required on blocks implementing [`PyObjectProtocol`][2],
/// This attribute is required on blocks implementing [`PyObjectProtocol`][2],
/// [`PyNumberProtocol`][3], [`PyGCProtocol`][4] and [`PyIterProtocol`][5].
///
/// [1]: https://docs.python.org/3/reference/datamodel.html#special-method-names

View File

@ -41,7 +41,7 @@ pub trait PyMappingProtocol<'p>: PyClass {
}
// The following are a bunch of marker traits used to detect
// the existance of a slotted method.
// the existence of a slotted method.
pub trait PyMappingLenProtocol<'p>: PyMappingProtocol<'p> {
type Result: IntoPyCallbackOutput<usize>;

View File

@ -78,7 +78,7 @@ pub trait PySequenceProtocol<'p>: PyClass + Sized {
}
// The following are a bunch of marker traits used to detect
// the existance of a slotted method.
// the existence of a slotted method.
pub trait PySequenceLenProtocol<'p>: PySequenceProtocol<'p> {
type Result: IntoPyCallbackOutput<usize>;

View File

@ -174,7 +174,7 @@ impl GILGuard {
/// `GILGuard` will also contain a `GILPool`.
pub(crate) fn acquire() -> GILGuard {
// Maybe auto-initialize the GIL:
// - If auto-initialize feature set and supported, try to initalize the interpreter.
// - If auto-initialize feature set and supported, try to initialize the interpreter.
// - If the auto-initialize feature is set but unsupported, emit hard errors only when the
// extension-module feature is not activated - extension modules don't care about
// auto-initialize so this avoids breaking existing builds.
@ -199,7 +199,7 @@ impl GILGuard {
assert_ne!(
ffi::Py_IsInitialized(),
0,
"The Python interpreter is not initalized and the `auto-initialize` \
"The Python interpreter is not initialized and the `auto-initialize` \
feature is not enabled.\n\n\
Consider calling `pyo3::prepare_freethreaded_python()` before attempting \
to use Python APIs."

View File

@ -798,7 +798,7 @@ impl<'py> Python<'py> {
///
/// This function calls [`PyErr_CheckSignals()`][1] which in turn may call signal handlers.
/// As Python's [`signal`][2] API allows users to define custom signal handlers, calling this
/// function allows arbitary Python code inside signal handlers to run.
/// function allows arbitrary Python code inside signal handlers to run.
///
/// [1]: https://docs.python.org/3/c-api/exceptions.html?highlight=pyerr_checksignals#c.PyErr_CheckSignals
/// [2]: https://docs.python.org/3/library/signal.html

View File

@ -82,7 +82,7 @@ impl<T: PyTypeInfo> PyObjectInit<T> for PyNativeTypeInitializer<T> {
/// Initializer for our `#[pyclass]` system.
///
/// You can use this type to initalize complicatedly nested `#[pyclass]`.
/// You can use this type to initialize complicatedly nested `#[pyclass]`.
///
/// # Examples
///

View File

@ -13,7 +13,7 @@ use parking_lot::{const_mutex, Mutex};
use std::thread::{self, ThreadId};
/// `T: PyLayout<U>` represents that `T` is a concrete representation of `U` in the Python heap.
/// E.g., `PyCell` is a concrete representaion of all `pyclass`es, and `ffi::PyObject`
/// E.g., `PyCell` is a concrete representation of all `pyclass`es, and `ffi::PyObject`
/// is of `PyAny`.
///
/// This trait is intended to be used internally.
@ -25,7 +25,7 @@ pub unsafe trait PyLayout<T> {}
/// `T: PySizedLayout<U>` represents that `T` is not a instance of
/// [`PyVarObject`](https://docs.python.org/3.8/c-api/structures.html?highlight=pyvarobject#c.PyVarObject).
/// In addition, that `T` is a concrete representaion of `U`.
/// In addition, that `T` is a concrete representation of `U`.
pub trait PySizedLayout<T>: PyLayout<T> + Sized {}
/// Python type information.
@ -179,7 +179,7 @@ impl LazyStaticType {
if let Err(err) = result {
err.clone_ref(py).print(py);
panic!("An error occured while initializing `{}.__dict__`", name);
panic!("An error occurred while initializing `{}.__dict__`", name);
}
}
}

View File

@ -41,7 +41,7 @@ fn ensure_datetime_api(_py: Python<'_>) -> &'static PyDateTime_CAPI {
// These are bindings around the C API typecheck macros, all of them return
// `1` if True and `0` if False. In all type check macros, the argument (`op`)
// must not be `NULL`. The implementations here all call ensure_datetime_api
// to ensure that the PyDateTimeAPI is initalized before use
// to ensure that the PyDateTimeAPI is initialized before use
//
//
// # Safety

View File

@ -30,7 +30,7 @@ enum OverrideSlot {
#[pymethods]
impl OverrideSlot {
fn __repr__(&self) -> &str {
"overriden"
"overridden"
}
}
@ -38,6 +38,6 @@ impl OverrideSlot {
fn test_override_slot() {
Python::with_gil(|py| {
let test_object = Py::new(py, OverrideSlot::Var).unwrap();
py_assert!(py, test_object, "repr(test_object) == 'overriden'");
py_assert!(py, test_object, "repr(test_object) == 'overridden'");
})
}

View File

@ -962,7 +962,7 @@ pymethods!(
// Regression test for issue 1506 - incorrect macro hygiene.
// By applying the `#[pymethods]` attribute inside a macro_rules! macro, this separates the macro
// call scope from the scope of the impl block. For this to work our macros must be careful to not
// cheat hygeine!
// cheat hygiene!
#[pyclass]
struct Issue1506 {}