mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-24 01:19:23 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
58f2eeca2d
@ -25,14 +25,14 @@ repos:
|
|||||||
|
|
||||||
# Clang format the codebase automatically
|
# Clang format the codebase automatically
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
rev: "v19.1.6"
|
rev: "v19.1.7"
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
types_or: [c++, c, cuda]
|
types_or: [c++, c, cuda]
|
||||||
|
|
||||||
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.6
|
rev: v0.9.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: ["--fix", "--show-fixes"]
|
args: ["--fix", "--show-fixes"]
|
||||||
@ -119,7 +119,7 @@ repos:
|
|||||||
# Use tools/codespell_ignore_lines_from_errors.py
|
# Use tools/codespell_ignore_lines_from_errors.py
|
||||||
# to rebuild .codespell-ignore-lines
|
# to rebuild .codespell-ignore-lines
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: "v2.3.0"
|
rev: "v2.4.1"
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
exclude: ".supp$"
|
exclude: ".supp$"
|
||||||
@ -142,14 +142,14 @@ repos:
|
|||||||
|
|
||||||
# PyLint has native support - not always usable, but works for us
|
# PyLint has native support - not always usable, but works for us
|
||||||
- repo: https://github.com/PyCQA/pylint
|
- repo: https://github.com/PyCQA/pylint
|
||||||
rev: "v3.3.3"
|
rev: "v3.3.4"
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
files: ^pybind11
|
files: ^pybind11
|
||||||
|
|
||||||
# Check schemas on some of our YAML files
|
# Check schemas on some of our YAML files
|
||||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||||
rev: 0.30.0
|
rev: 0.31.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-readthedocs
|
- id: check-readthedocs
|
||||||
- id: check-github-workflows
|
- id: check-github-workflows
|
||||||
|
@ -212,9 +212,9 @@ def pytest_configure():
|
|||||||
|
|
||||||
def pytest_report_header(config):
|
def pytest_report_header(config):
|
||||||
del config # Unused.
|
del config # Unused.
|
||||||
assert (
|
assert pybind11_tests.compiler_info is not None, (
|
||||||
pybind11_tests.compiler_info is not None
|
"Please update pybind11_tests.cpp if this assert fails."
|
||||||
), "Please update pybind11_tests.cpp if this assert fails."
|
)
|
||||||
return (
|
return (
|
||||||
"C++ Info:"
|
"C++ Info:"
|
||||||
f" {pybind11_tests.compiler_info}"
|
f" {pybind11_tests.compiler_info}"
|
||||||
|
@ -244,9 +244,9 @@ def test_eigen_ref_to_python():
|
|||||||
chols = [m.cholesky1, m.cholesky2, m.cholesky3, m.cholesky4]
|
chols = [m.cholesky1, m.cholesky2, m.cholesky3, m.cholesky4]
|
||||||
for i, chol in enumerate(chols, start=1):
|
for i, chol in enumerate(chols, start=1):
|
||||||
mymat = chol(np.array([[1.0, 2, 4], [2, 13, 23], [4, 23, 77]]))
|
mymat = chol(np.array([[1.0, 2, 4], [2, 13, 23], [4, 23, 77]]))
|
||||||
assert np.all(
|
assert np.all(mymat == np.array([[1, 0, 0], [2, 3, 0], [4, 5, 6]])), (
|
||||||
mymat == np.array([[1, 0, 0], [2, 3, 0], [4, 5, 6]])
|
f"cholesky{i}"
|
||||||
), f"cholesky{i}"
|
)
|
||||||
|
|
||||||
|
|
||||||
def assign_both(a1, a2, r, c, v):
|
def assign_both(a1, a2, r, c, v):
|
||||||
|
@ -108,6 +108,10 @@ def test_nested_acquire():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform.startswith("emscripten"), reason="Requires threads")
|
@pytest.mark.skipif(sys.platform.startswith("emscripten"), reason="Requires threads")
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
env.GRAALPY and sys.platform == "darwin",
|
||||||
|
reason="Transiently crashes on GraalPy on OS X",
|
||||||
|
)
|
||||||
def test_multi_acquire_release_cross_module():
|
def test_multi_acquire_release_cross_module():
|
||||||
for bits in range(16 * 8):
|
for bits in range(16 * 8):
|
||||||
internals_ids = m.test_multi_acquire_release_cross_module(bits)
|
internals_ids = m.test_multi_acquire_release_cross_module(bits)
|
||||||
|
@ -52,10 +52,10 @@ def test_from_iterable(pytype, from_iter_func):
|
|||||||
|
|
||||||
def test_iterable(doc):
|
def test_iterable(doc):
|
||||||
assert doc(m.get_iterable) == "get_iterable() -> Iterable"
|
assert doc(m.get_iterable) == "get_iterable() -> Iterable"
|
||||||
lins = [1, 2, 3]
|
lst = [1, 2, 3]
|
||||||
i = m.get_first_item_from_iterable(lins)
|
i = m.get_first_item_from_iterable(lst)
|
||||||
assert i == 1
|
assert i == 1
|
||||||
i = m.get_second_item_from_iterable(lins)
|
i = m.get_second_item_from_iterable(lst)
|
||||||
assert i == 2
|
assert i == 2
|
||||||
|
|
||||||
|
|
||||||
@ -67,13 +67,13 @@ def test_list(capture, doc):
|
|||||||
assert m.list_no_args() == []
|
assert m.list_no_args() == []
|
||||||
assert m.list_ssize_t() == []
|
assert m.list_ssize_t() == []
|
||||||
assert m.list_size_t() == []
|
assert m.list_size_t() == []
|
||||||
lins = [1, 2]
|
lst = [1, 2]
|
||||||
m.list_insert_ssize_t(lins)
|
m.list_insert_ssize_t(lst)
|
||||||
assert lins == [1, 83, 2]
|
assert lst == [1, 83, 2]
|
||||||
m.list_insert_size_t(lins)
|
m.list_insert_size_t(lst)
|
||||||
assert lins == [1, 83, 2, 57]
|
assert lst == [1, 83, 2, 57]
|
||||||
m.list_clear(lins)
|
m.list_clear(lst)
|
||||||
assert lins == []
|
assert lst == []
|
||||||
|
|
||||||
with capture:
|
with capture:
|
||||||
lst = m.get_list()
|
lst = m.get_list()
|
||||||
|
@ -313,9 +313,8 @@ def test_smart_ptr_from_default():
|
|||||||
instance = m.HeldByDefaultHolder()
|
instance = m.HeldByDefaultHolder()
|
||||||
with pytest.raises(RuntimeError) as excinfo:
|
with pytest.raises(RuntimeError) as excinfo:
|
||||||
m.HeldByDefaultHolder.load_shared_ptr(instance)
|
m.HeldByDefaultHolder.load_shared_ptr(instance)
|
||||||
assert (
|
assert "Unable to load a custom holder type from a default-holder instance" in str(
|
||||||
"Unable to load a custom holder type from a "
|
excinfo.value
|
||||||
"default-holder instance" in str(excinfo.value)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user