From 00b0365ca3d28e31661b4d4825a3ef1957f6d1a9 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 6 Jul 2021 14:31:18 -0700 Subject: [PATCH] codespell fixes and adding .codespell-ignorelines --- .codespell-ignorelines | 13 +++++++++++++ .pre-commit-config.yaml | 3 ++- include/pybind11/detail/smart_holder_poc.h | 2 +- include/pybind11/detail/smart_holder_type_casters.h | 2 +- tests/test_class_sh_trampoline_shared_from_this.py | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .codespell-ignorelines diff --git a/.codespell-ignorelines b/.codespell-ignorelines new file mode 100644 index 000000000..eaea1f128 --- /dev/null +++ b/.codespell-ignorelines @@ -0,0 +1,13 @@ + assert m.atyp_valu().get_mtxt() == "Valu" +atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; } + indestructible_int(int v) : valu{v} {} + int valu; + movable_int(int v) : valu{v} {} + (m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"), + other.valu = 91; + REQUIRE(hld.as_raw_ptr_unowned()->valu == 19); + REQUIRE(orig.valu == 91); + REQUIRE(othr.valu == 19); + valu = other.valu; + with pytest.raises(ValueError) as excinfo: + with pytest.raises(ValueError) as exc_info: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 23233405b..54b7e47a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -92,7 +92,8 @@ repos: entry: codespell language: python types: [text] - args: ["-q", "3", "--skip", "*.supp", "-L", "nd,ot,thist,readded"] + args: ["-q", "3", "--skip", "*.supp", "-L", "nd,ot,thist,readded", + "--exclude-file", ".codespell-ignorelines"] # The original pybind11 checks for a few C++ style items - repo: local diff --git a/include/pybind11/detail/smart_holder_poc.h b/include/pybind11/detail/smart_holder_poc.h index ee507a14f..a0c8f8dbb 100644 --- a/include/pybind11/detail/smart_holder_poc.h +++ b/include/pybind11/detail/smart_holder_poc.h @@ -32,7 +32,7 @@ Details: * If created from a raw pointer, or a `unique_ptr` without a custom deleter, `vptr` always uses a custom deleter, to support `unique_ptr`-like disowning. - The custom deleters could be extended to included life-time managment for + The custom deleters could be extended to included life-time management for external objects (e.g. `PyObject`). * If created from an external `shared_ptr`, or a `unique_ptr` with a custom diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index acc9efe76..0dc5e4cc2 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -278,7 +278,7 @@ struct smart_holder_type_caster_class_hooks : smart_holder_type_caster_base_tag } // Adopting existing approach used by type_caster_base, although it leads to somewhat fuzzy - // ownership semantics: if we deteced via shared_from_this that a shared_ptr exists already, it + // ownership semantics: if we detected via shared_from_this that a shared_ptr exists already, it // is reused, irrespective of the return_value_policy in effect. // "SomeBaseOfWrappedType" is needed because std::enable_shared_from_this is not necessarily a // direct base of WrappedType. diff --git a/tests/test_class_sh_trampoline_shared_from_this.py b/tests/test_class_sh_trampoline_shared_from_this.py index b4a62275b..fa18baa89 100644 --- a/tests/test_class_sh_trampoline_shared_from_this.py +++ b/tests/test_class_sh_trampoline_shared_from_this.py @@ -95,7 +95,7 @@ def test_release_and_stash_leak(): def test_release_and_stash_via_shared_from_this(): - # Exercises that the smart_holder vptr is invisible to the shared_from_this mechnism. + # Exercises that the smart_holder vptr is invisible to the shared_from_this mechanism. obj = PySft("PySft") stash1 = m.SftSharedPtrStash(1) with pytest.raises(RuntimeError) as exc_info: