Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refcount bug introduced with PR #4916. #4927

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Nov 8, 2023

Description

See https://github.com/pybind/pybind11/pull/4916/files#r1387035547.

Error message (Google toolchain):

.third_party/python_runtime/v3_10/Modules/gcmodule.c:115: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small

Same error with more context:

==================== Test output for //third_party/pybind11/tests:test_virtual_functions:
============================= test session starts ==============================
platform linux -- Python 3.10.13, pytest-7.2.0, pluggy-0.9.0
C++ Info: Clang google3-trunk (c4ba84d6555148fb7469fd44412a49d9d66eb4cf) C++20 __pybind11_internals_v5_clang_libcpp_cxxabi1002_sh_def__ PYBIND11_SIMPLE_GIL_MANAGEMENT=False
rootdir: /build/work/8b40e68d58b1b0798db67cef36d5d620f31e/google3/runfiles/google3/third_party/pybind11/tests, configfile: pytest.ini
collected 10 items

test_virtual_functions.py ### ExampleVirt @ 0x25baffda9e80 destroyed
### ExampleVirt @ 0x25baffda9ec0 destroyed
### ExampleVirt @ 0x25baffda9f00 destroyed
...### NonCopyable @ 0x25baffc01528 created 4 9
### NonCopyable @ 0x7ffc5d532eb0 created via move constructor
### NonCopyable @ 0x25baffc01528 destroyed
### NonCopyable @ 0x7ffc5d532eb0 destroyed
### Movable @ 0x25baffc003c8 created 4 5
### Movable @ 0x7ffc5d532eb4 created via copy constructor
### Movable @ 0x7ffc5d532eb4 destroyed
### Movable @ 0x25baffc01528 created 7 7
### Movable @ 0x7ffc5d532eb4 created via move constructor
### Movable @ 0x25baffc01528 destroyed
### Movable @ 0x7ffc5d532eb4 destroyed
### NonCopyable @ 0x25baffc01528 created 9 9
### Movable @ 0x25baffc003c8 destroyed
### NonCopyable @ 0x25baffc01528 destroyed
.....1st lock acquired
2nd lock acquired
1st lock acquired
2nd lock acquired
.third_party/python_runtime/v3_10/Modules/gcmodule.c:115: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x7ff66bd099c0
object refcount : 1
object type     : 0x556a6075a170
object type name: dict
object repr     : {'nodeid': 'test_virtual_functions.py::test_dispatch_issue', 'location': ('test_virtual_functions.py', 235, 'test_dispatch_issue'), 'keywords': {'test_dispatch_issue': 1, 'test_virtual_functions.py': 1, '__init__.py': 1, 'tests': 1}, 'outcome': 'passed', 'longrepr': None, 'when': 'call', 'user_properties': [], 'sections': [], 'duration': 0.0004472718574106693}

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: initialized

Suggested changelog entry:

@rwgk rwgk marked this pull request as ready for review November 8, 2023 19:15
@rwgk
Copy link
Collaborator Author

rwgk commented Nov 8, 2023

I'll merge this straightaway.

@rwgk rwgk merged commit 2c35fde into pybind:master Nov 8, 2023
81 checks passed
@rwgk rwgk deleted the bug_fix_pr4916 branch November 8, 2023 19:16
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Nov 8, 2023
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant