Broken usage of pybind11 "keep_alive" annotation
Maintainers usually reply within 1 day
@Mizux is already working on this.
Since May 13, 2026.
- #5145 by @KasimVali2207 — closed without merging
Assessment
This issue has not been assessed yet.
Description
What version of OR-Tools and what language are you using?
Version: main/v9.15
Language: Python
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
n/a
What operating system (Linux, Windows, ...) and version?
What did you do?
Compile it
What did you expect to see
no errors
What did you see instead?
[ 762s] 2870 | .def_property_readonly(
[ 762s] | ~~~~~~~~~~~~~~~~~~~~~~^
[ 762s] 2871 | "tails",
[ 762s] | ~~~~~~~~
[ 762s] 2872 | [](operations_research::sat::CircuitConstraintProto* self) { return self->mutable_tails(); },
[ 762s] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 762s] 2873 | py::return_value_policy::reference, py::keep_alive<0, 1>())
[ 762s] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 762s] /usr/include/pybind11/pybind11.h:2659:25: error: static assertion failed: def_property family does not currently support keep_alive. Use a py::cpp_function instead.
While this error message is specific to current pybind11 versions, the actual error is inside the or-tools code, and the generated code is also wrong with the bundled pybind11.
For details, see https://github.com/pybind/pybind11/pull/5533
- Dominant language
- C++
- Stars
- 14.5k
- Forks
- 2.6k
- Avg merge
- 9h 43m
- Merged PRs (30d)
- 53
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/or-tools
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Maintainers usually reply within 1 day
-
CP-SAT: TimeTableEdgeFinding can report false INFEASIBLE for large cumulative scheduling modelsPossibly taken @lperron claimed this today. OpenBug Solver: CP-SAT Solver
google/or-tools#5672 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Python (v10.0-rc.1): Model.restore_assignment() and Assignment.objective() take ownership of C++-owned objects (segfault)Possibly taken @Mizux claimed this today. OpenLang: Python Solver: Routing & CP Solver
google/or-tools#5670 · 1 assignee ·
Maintainers usually reply within 1 day
-
[CP-SAT] Duplicate timer registration in StartDirectSolver when UserTimer aliases WallTimerPossibly taken @lperron claimed this 1 day ago. OpenSolver: CP-SAT Solver
Difficulty 3/5 Half a day Newbie friendliness 85/100
google/or-tools#5659 · 5 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ionut-mihalache/aqua#31 · 1 comment ·
-
LWG
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
needs-kind
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
villagesql/villagesql-server#1702 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/vcpkg-tool#2191 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
harfbuzz/harfbuzz#6966 · 1 comment ·
Maintainers usually reply within 1 day