[BUG]: 5 tests fail on FreeBSD
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Domínio
- operating-systems, testing-qa
Direção de pesquisa
Reproduza as falhas no FreeBSD, começando por tests/test_smart_ptr.py, tests/test_buffers.py, tests/test_methods_and_attributes.py, tests/test_sequences_and_iterators.py e tests/test_exceptions.py. Leia as assertions de ConstructorStats que falharam e o teste de exceção entre módulos; em seguida, compare o comportamento com o de uma plataforma compatível. O trabalho estará concluído quando as cinco falhas relatadas passarem no FreeBSD sem causar regressões nos testes ao redor.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
3.0.1
Problem description
============================================================================== FAILURES ===============================================================================
___________________________________________________________________________ test_smart_ptr ____________________________________________________________________________
capture = <conftest.Capture object at 0x9ccf81aa3d0>
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_smart_ptr(capture):
# Object1
for i, o in enumerate(
[m.make_object_1(), m.make_object_2(), m.MyObject1(3)], start=1
):
assert o.getRefCount() == 1
with capture:
m.print_object_1(o)
m.print_object_2(o)
m.print_object_3(o)
m.print_object_4(o)
assert capture == f"MyObject1[{i}]\n" * 4
for i, o in enumerate(
[m.make_myobject1_1(), m.make_myobject1_2(), m.MyObject1(6), 7], start=4
):
print(o)
with capture:
if not isinstance(o, int):
m.print_object_1(o)
m.print_object_2(o)
m.print_object_3(o)
m.print_object_4(o)
m.print_myobject1_1(o)
m.print_myobject1_2(o)
m.print_myobject1_3(o)
m.print_myobject1_4(o)
times = 4 if isinstance(o, int) else 8
assert capture == f"MyObject1[{i}]\n" * times
cstats = ConstructorStats.get(m.MyObject1)
assert cstats.alive() == 0
expected_values = [f"MyObject1[{i}]" for i in range(1, 7)] + ["MyObject1[7]"] * 4
> assert cstats.values() == expected_values
E AssertionError: assert ['MyObject1[0...ect1[5]', ...] == ['MyObject1[1...ect1[6]', ...]
E
E At index 0 diff: 'MyObject1[0]' != 'MyObject1[1]'
E Left contains one more item: 'MyObject1[7]'
E Use -v to get more diff
capture = <conftest.Capture object at 0x9ccf81aa3d0>
cstats = <pybind11_tests.ConstructorStats object at 0x9ccf82ef8b0>
expected_values = ['MyObject1[1]', 'MyObject1[2]', 'MyObject1[3]', 'MyObject1[4]', 'MyObject1[5]', 'MyObject1[6]', ...]
i = 7
o = 7
times = 4
../../pybind11-3.0.1/tests/test_smart_ptr.py:46: AssertionError
------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------
### (anonymous namespace)::MyObject1 @ 0x9ccf83b87d0 destroyed
### Object @ 0x9ccf83b87d0 destroyed
### ref<(anonymous namespace)::MyObject1> @ 0x9ccf7eb98c8 destroyed
### (anonymous namespace)::MyObject1 @ 0x9ccb5e1c3c0 destroyed
### Object @ 0x9ccb5e1c3c0 destroyed
### ref<(anonymous namespace)::MyObject1> @ 0x9ccf931f7c8 destroyed
### (anonymous namespace)::MyObject1 @ 0x9ccf83b84c0 destroyed
### Object @ 0x9ccf83b84c0 destroyed
### ref<(anonymous namespace)::MyObject1> @ 0x9ccf82ef8c8 destroyed
___________________________________________________________________________ test_to_python ____________________________________________________________________________
@pytest.mark.xfail(
env.PYPY, reason="PyPy 7.3.7 doesn't clear this anymore", strict=False
)
def test_to_python():
mat = m.Matrix(5, 4)
assert memoryview(mat).shape == (5, 4)
assert mat[2, 3] == 0
mat[2, 3] = 4.0
mat[3, 2] = 7.0
assert mat[2, 3] == 4
assert mat[3, 2] == 7
assert struct.unpack_from("f", mat, (3 * 4 + 2) * 4) == (7,)
assert struct.unpack_from("f", mat, (2 * 4 + 3) * 4) == (4,)
mat2 = np.array(mat, copy=False)
assert mat2.shape == (5, 4)
assert abs(mat2).sum() == 11
assert mat2[2, 3] == 4
assert mat2[3, 2] == 7
mat2[2, 3] = 5
assert mat2[2, 3] == 5
if env.GRAALPY:
pytest.skip("ConstructorStats is incompatible with GraalPy.")
cstats = ConstructorStats.get(m.Matrix)
assert cstats.alive() == 1
del mat
pytest.gc_collect()
assert cstats.alive() == 1
del mat2 # holds a mat reference
pytest.gc_collect()
assert cstats.alive() == 0
> assert cstats.values() == ["5x4 matrix"]
E AssertionError: assert ['5x4 matrix'... '5x4 matrix'] == ['5x4 matrix']
E
E Left contains 5 more items, first extra item: '4x5 matrix'
E Use -v to get more diff
cstats = <pybind11_tests.ConstructorStats object at 0x9ccf8ab3df0>
../../pybind11-3.0.1/tests/test_buffers.py:133: AssertionError
------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------
### test_submodule_buffers(module_&)::Matrix @ 0x9ccf87dcb20 created 5x4 matrix
### test_submodule_buffers(module_&)::Matrix @ 0x9ccf87dcb20 destroyed 5x4 matrix
_____________________________________________________________________ test_methods_and_attributes _____________________________________________________________________
def test_methods_and_attributes():
instance1 = m.ExampleMandA()
instance2 = m.ExampleMandA(32)
instance1.add1(instance2)
instance1.add2(instance2)
instance1.add3(instance2)
instance1.add4(instance2)
instance1.add5(instance2)
instance1.add6(32)
instance1.add7(32)
instance1.add8(32)
instance1.add9(32)
instance1.add10(32)
assert str(instance1) == "ExampleMandA[value=320]"
assert str(instance2) == "ExampleMandA[value=32]"
assert str(instance1.self1()) == "ExampleMandA[value=320]"
assert str(instance1.self2()) == "ExampleMandA[value=320]"
assert str(instance1.self3()) == "ExampleMandA[value=320]"
assert str(instance1.self4()) == "ExampleMandA[value=320]"
assert str(instance1.self5()) == "ExampleMandA[value=320]"
assert instance1.internal1() == 320
assert instance1.internal2() == 320
assert instance1.internal3() == 320
assert instance1.internal4() == 320
assert instance1.internal5() == 320
assert instance1.overloaded() == "()"
assert instance1.overloaded(0) == "(int)"
assert instance1.overloaded(1, 1.0) == "(int, float)"
assert instance1.overloaded(2.0, 2) == "(float, int)"
assert instance1.overloaded(3, 3) == "(int, int)"
assert instance1.overloaded(4.0, 4.0) == "(float, float)"
assert instance1.overloaded_const(-3) == "(int) const"
assert instance1.overloaded_const(5, 5.0) == "(int, float) const"
assert instance1.overloaded_const(6.0, 6) == "(float, int) const"
assert instance1.overloaded_const(7, 7) == "(int, int) const"
assert instance1.overloaded_const(8.0, 8.0) == "(float, float) const"
assert instance1.overloaded_float(1, 1) == "(float, float)"
assert instance1.overloaded_float(1, 1.0) == "(float, float)"
assert instance1.overloaded_float(1.0, 1) == "(float, float)"
assert instance1.overloaded_float(1.0, 1.0) == "(float, float)"
assert instance1.value == 320
instance1.value = 100
assert str(instance1) == "ExampleMandA[value=100]"
if env.GRAALPY:
pytest.skip("ConstructorStats is incompatible with GraalPy.")
cstats = ConstructorStats.get(m.ExampleMandA)
assert cstats.alive() == 2
del instance1, instance2
assert cstats.alive() == 0
> assert cstats.values() == ["32"]
E AssertionError: assert ['123', '-100...', '-7', '32'] == ['32']
E
E At index 0 diff: '123' != '32'
E Left contains 5 more items, first extra item: '-100'
E Use -v to get more diff
cstats = <pybind11_tests.ConstructorStats object at 0x9ccf7f329f0>
../../pybind11-3.0.1/tests/test_methods_and_attributes.py:85: AssertionError
------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------
### ExampleMandA @ 0x9ccf853c238 created via default constructor
### ExampleMandA @ 0x9ccf853c1e0 created 32
### ExampleMandA @ 0x4c0d1e00 created via copy constructor
### ExampleMandA @ 0x4c0d1e04 created via move constructor
### ExampleMandA @ 0x4c0d1e04 destroyed
### ExampleMandA @ 0x4c0d1e00 destroyed
### ExampleMandA @ 0x4c0d1e4c created via copy constructor
### ExampleMandA @ 0x9ccf853c098 created via move constructor
### ExampleMandA @ 0x4c0d1e4c destroyed
### ExampleMandA @ 0x9ccf853c098 destroyed
### ExampleMandA @ 0x9ccf853c238 destroyed
### ExampleMandA @ 0x9ccf853c1e0 destroyed
____________________________________________________________________________ test_sequence ____________________________________________________________________________
def test_sequence():
cstats = ConstructorStats.get(m.Sequence)
s = m.Sequence(5)
if not env.GRAALPY:
> assert cstats.values() == ["of size", "5"]
E AssertionError: assert ['of size', '...of size', '5'] == ['of size', '5']
E
E Left contains 2 more items, first extra item: 'of size'
E Use -v to get more diff
cstats = <pybind11_tests.ConstructorStats object at 0x9ccf9296330>
s = <pybind11_tests.sequences_and_iterators.Sequence object at 0x9ccf92948b0>
../../pybind11-3.0.1/tests/test_sequences_and_iterators.py:125: AssertionError
------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------
### test_submodule_sequences_and_iterators(module_&)::Sequence @ 0x9ccf83b8a50 created of size 5
_______________________________________________________________ test_cross_module_exception_translator ________________________________________________________________
@pytest.mark.xfail(
"(env.MACOS and env.PYPY) or env.ANDROID",
raises=RuntimeError,
reason="See Issue #2847, PR #2999, PR #4324",
strict=not env.PYPY, # PR 5569
)
def test_cross_module_exception_translator():
with pytest.raises(KeyError):
# translator registered in cross_module_tests
> m.throw_should_be_translated_to_key_error()
E RuntimeError
../../pybind11-3.0.1/tests/test_exceptions.py:87: RuntimeError
=============================================================================== XPASSES ===============================================================================
======================================================================= short test summary info =======================================================================
SKIPPED [1] ../../pybind11-3.0.1/tests/test_pytypes.py:1088: C++20 non-type template args feature not available.
SKIPPED [3] ../../pybind11-3.0.1/tests/test_pytypes.py:1116: <ranges> not available.
SKIPPED [1] ../../pybind11-3.0.1/tests/test_pytypes.py:425: Not defined: PYBIND11_HANDLE_REF_DEBUG
SKIPPED [3] ../../pybind11-3.0.1/tests/test_pytypes.py:1103: <ranges> not available.
SKIPPED [1] ../../pybind11-3.0.1/tests/test_pytypes.py:1044: C++20 non-type template args feature not available.
SKIPPED [3] ../../pybind11-3.0.1/tests/test_pytypes.py:1128: <ranges> not available.
SKIPPED [1] ../../pybind11-3.0.1/tests/test_native_enum.py:183: NDEBUG disables cast safety check
SKIPPED [1] ../../pybind11-3.0.1/tests/test_scoped_critical_section.py:15: no <barrier>
SKIPPED [1] ../../pybind11-3.0.1/tests/test_scoped_critical_section.py:21: no <barrier>
SKIPPED [1] ../../pybind11-3.0.1/tests/test_scoped_critical_section.py:27: no <barrier>
SKIPPED [1] ../../pybind11-3.0.1/tests/test_stl.py:168: no <experimental/optional>
SKIPPED [2] ../../pybind11-3.0.1/tests/test_multiple_interpreters.py:76: Test requires the interpreters stdlib module
SKIPPED [1] ../../pybind11-3.0.1/tests/test_multiple_interpreters.py:127: Requires 3.14.0b3+
XFAIL ../../pybind11-3.0.1/tests/test_unnamed_namespace_a.py::test_have_both_class_any_struct - Known issues: https://github.com/pybind/pybind11/pull/4319
XFAIL ../../pybind11-3.0.1/tests/test_unnamed_namespace_a.py::test_have_class_any_struct[None] - Known issues: https://github.com/pybind/pybind11/pull/4319
XPASS ../../pybind11-3.0.1/tests/test_unnamed_namespace_a.py::test_have_class_any_struct[unnamed_namespace_a_any_struct] - Known issues: https://github.com/pybind/pybind11/pull/4319
FAILED ../../pybind11-3.0.1/tests/test_smart_ptr.py::test_smart_ptr - AssertionError: assert ['MyObject1[0...ect1[5]', ...] == ['MyObject1[1...ect1[6]', ...]
FAILED ../../pybind11-3.0.1/tests/test_buffers.py::test_to_python - AssertionError: assert ['5x4 matrix'... '5x4 matrix'] == ['5x4 matrix']
FAILED ../../pybind11-3.0.1/tests/test_methods_and_attributes.py::test_methods_and_attributes - AssertionError: assert ['123', '-100...', '-7', '32'] == ['32']
FAILED ../../pybind11-3.0.1/tests/test_sequences_and_iterators.py::test_sequence - AssertionError: assert ['of size', '...of size', '5'] == ['of size', '5']
FAILED ../../pybind11-3.0.1/tests/test_exceptions.py::test_cross_module_exception_translator - RuntimeError
================================================== 5 failed, 1253 passed, 20 skipped, 2 xfailed, 1 xpassed in 53.99s ==================================================
Python-3.11
FreeBSD 14.3
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
- Linguagem predominante
- C++
- Estrelas
- 18k
- Forks
- 2.3k
- Merge médio
- 5d 7h
- PRs com merge (30d)
- 53
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de pybind/pybind11
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 3 dias
-
triage
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
pybind/pybind11#5604 · 1 comentário ·
Mantenedores costumam responder em até 3 dias
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 3 dias
-
docs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 60/100
pybind/pybind11#747 · 2 comentários ·
Mantenedores costumam responder em até 3 dias
-
array_t::at() returns a misaligned reference when the stride is not a multiple of alignof(T)Talvez já em andamento @henryiii assumiu hoje. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 3 dias
Todas as issues de pybind/pybind11
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
patrick-hudson/put.gd-desktop#2044 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
uxlfoundation/oneDNN#6604 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
[Bug]: RoundToNearest truncates in plugins compiled with spcomp 1.13Talvez já em andamento @fmu1337 assumiu hoje. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
alliedmodders/sourcemod#2627 ·
Mantenedores costumam responder em até 1 dia