Commit Graph

3 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
a8bc5f7904 ruff automatic fixes: from __future__ import annotations
```
ruff.....................................................................Failed
- hook id: ruff
- files were modified by this hook

Fixed 44 errors:
- tests/test_class_sh_basic.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_disowning.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_disowning_mi.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_factory_constructors.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_inheritance.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_mi_thunks.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_module_local.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_property.py:
    1 × I002 (missing-required-import)
- tests/test_class_sh_property_non_owning.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_shared_ptr_copy_move.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_trampoline_basic.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_trampoline_self_life_support.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_trampoline_shared_from_this.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_trampoline_unique_ptr.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_unique_ptr_custom_deleter.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_unique_ptr_member.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_class_sh_virtual_py_cpp_mix.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_classh_mock.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_descr_src_loc.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_exc_namespace_visibility.py:
    1 × I002 (missing-required-import)
- tests/test_type_caster_odr_guard_1.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)
- tests/test_type_caster_odr_guard_2.py:
    1 × I001 (unsorted-imports)
    1 × I002 (missing-required-import)

Found 44 errors (44 fixed, 0 remaining).
```
2024-06-21 23:00:13 -07:00
Ralf W. Grosse-Kunstleve
d2ac3f5c70
[smart_holder] Change throw_if_uninitialized_or_disowned_holder() to also show C++ type name. (#4977)
* Change `throw_if_uninitialized_or_disowned_holder()` to also show C++ type name.

* Fix pre-commit errors.
2023-12-15 19:29:22 -08:00
Ralf W. Grosse-Kunstleve
4766065e5c
[smart_holder] test_class_sh_mi_thunks (started from PR #4374) (#4380)
* Content of PR #4374 applied on top of smart_holder branch.

* More tests, with USE_SH switch. [ci skip]

* Use `std::dynamic_pointer_cast<Base0>` [ci skip]

* All tests pass when using `m.make_derived_as_base0_raw_ptr()`, with `USE_SH` defined or not defined. [ci skip]

* WIP

* Debug LOOOK & one-line bug fix:

```diff
-        auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(src);
+        auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(std::shared_ptr<void>(src, const_cast<void *>(st.first)));
```

* Remove all print LOOOK and clang-format the fix.

* Resolve clang-tidy errors.

* Systematic test matrix.

* Bug fix in `smart_holder_type_caster<std::unique_ptr<T, D>>::cast()`

* Rename: test_mi_debug -> test_class_sh_mi_thunks

* Add `test_ptrdiff_derived_base0()`

* Miscellaneous polishing (naming, comments). No functional changes.

* Improve test_class_sh_mi_thunks.py implementation. No change in test coverage.

* Resolve clang-tidy error.
2022-12-12 19:55:16 -08:00