From 19e32a06212e76144a6596a8013836d3026e85d5 Mon Sep 17 00:00:00 2001 From: cuishuang Date: Sun, 24 Apr 2022 22:06:32 +0800 Subject: [PATCH] fix some typos Signed-off-by: cuishuang --- CHANGELOG.md | 6 +++--- Cargo.toml | 2 +- guide/src/class.md | 2 +- guide/src/class/numeric.md | 2 +- guide/src/conversions/traits.md | 2 +- guide/src/faq.md | 2 +- pyo3-macros/src/lib.rs | 2 +- src/class/mapping.rs | 2 +- src/class/sequence.rs | 2 +- src/gil.rs | 4 ++-- src/marker.rs | 2 +- src/pyclass_init.rs | 2 +- src/type_object.rs | 6 +++--- src/types/datetime.rs | 2 +- tests/test_default_impls.rs | 4 ++-- tests/test_methods.rs | 2 +- 16 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fdd474d..1a706725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/Cargo.toml b/Cargo.toml index d6a20774..95401ea3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/guide/src/class.md b/guide/src/class.md index e5245be9..d5a0c12c 100644 --- a/guide/src/class.md +++ b/guide/src/class.md @@ -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::*; diff --git a/guide/src/class/numeric.md b/guide/src/class/numeric.md index bb4ef1f4..df3c908f 100644 --- a/guide/src/class/numeric.md +++ b/guide/src/class/numeric.md @@ -124,7 +124,7 @@ impl Number { } ``` -### Unary arithmethic operations +### Unary arithmetic operations ```rust # use pyo3::prelude::*; diff --git a/guide/src/conversions/traits.md b/guide/src/conversions/traits.md index 2705413d..1bfcc56f 100644 --- a/guide/src/conversions/traits.md +++ b/guide/src/conversions/traits.md @@ -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, diff --git a/guide/src/faq.md b/guide/src/faq.md index 6ef7fd67..d5773abc 100644 --- a/guide/src/faq.md +++ b/guide/src/faq.md @@ -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. diff --git a/pyo3-macros/src/lib.rs b/pyo3-macros/src/lib.rs index 3577b9c2..84160af2 100644 --- a/pyo3-macros/src/lib.rs +++ b/pyo3-macros/src/lib.rs @@ -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 diff --git a/src/class/mapping.rs b/src/class/mapping.rs index 413f9719..533f5178 100644 --- a/src/class/mapping.rs +++ b/src/class/mapping.rs @@ -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; diff --git a/src/class/sequence.rs b/src/class/sequence.rs index b1b29ea0..8e486ef4 100644 --- a/src/class/sequence.rs +++ b/src/class/sequence.rs @@ -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; diff --git a/src/gil.rs b/src/gil.rs index 8d406008..1aa84d3c 100644 --- a/src/gil.rs +++ b/src/gil.rs @@ -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." diff --git a/src/marker.rs b/src/marker.rs index 209fe33b..fdfef078 100644 --- a/src/marker.rs +++ b/src/marker.rs @@ -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 diff --git a/src/pyclass_init.rs b/src/pyclass_init.rs index 2214bd0f..273e6b3f 100644 --- a/src/pyclass_init.rs +++ b/src/pyclass_init.rs @@ -82,7 +82,7 @@ impl PyObjectInit for PyNativeTypeInitializer { /// 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 /// diff --git a/src/type_object.rs b/src/type_object.rs index f2743d14..5f800e8e 100644 --- a/src/type_object.rs +++ b/src/type_object.rs @@ -13,7 +13,7 @@ use parking_lot::{const_mutex, Mutex}; use std::thread::{self, ThreadId}; /// `T: PyLayout` 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: PySizedLayout` 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: PyLayout + 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); } } } diff --git a/src/types/datetime.rs b/src/types/datetime.rs index 90782774..67cdf22c 100644 --- a/src/types/datetime.rs +++ b/src/types/datetime.rs @@ -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 diff --git a/tests/test_default_impls.rs b/tests/test_default_impls.rs index a764c1f4..25224aa5 100644 --- a/tests/test_default_impls.rs +++ b/tests/test_default_impls.rs @@ -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'"); }) } diff --git a/tests/test_methods.rs b/tests/test_methods.rs index 6b1b3bf1..75b960cd 100644 --- a/tests/test_methods.rs +++ b/tests/test_methods.rs @@ -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 {}