Skip to content

cmake: Python 3.14 support is broken #4929

@Mizux

Description

@Mizux

The following tests FAILED:
196 - python_linear_solver_model_builder_test (Failed)
204 - python_sat_cp_model_test (Failed)

python_linear_solver_model_builder_test

trace:

196/541 Test #196: python_linear_solver_model_builder_test ....................................***Failed   20.23 sec
============================= test session starts ==============================
platform linux -- Python 3.14.0, pytest-9.0.1, pluggy-1.6.0
rootdir: /home/runner/work/or-tools/or-tools
collected 10413 items

../../../ortools/linear_solver/python/model_builder_test.py ............ [  0%]
........................................................................ [  0%]
[...]
........................................................................ [ 99%]
..............F..................                                        [100%]

=================================== FAILURES ===================================
_____________ ModelBuilderExamplesTest.testInPlaceSumModifications _____________

self = <model_builder_test.ModelBuilderExamplesTest testMethod=testInPlaceSumModifications>

    def testInPlaceSumModifications(self) -> None:
        model = mb.Model()
        x = [model.new_int_var(0, 10, f"x{i}") for i in range(5)]
        y = [model.new_int_var(0, 10, f"y{i}") for i in range(5)]
        e1 = sum(x)
        self.assertIsInstance(e1, mbh.SumArray)
        self.assertEqual(e1.offset, 0)
        self.assertEqual(e1.num_exprs, 5)
        e1_str = str(e1)
        _ = e1 + y[0]
        _ = sum(y) + e1
>       self.assertEqual(e1_str, str(e1))
E       AssertionError: 
E       - (x0 + x1 + x2 + x3 + x4)
E       + (x0 + x1 + x2 + x3 + x4 + y0)
E       ?                        +++++

../../../ortools/linear_solver/python/model_builder_test.py:2314: AssertionError
=========================== short test summary info ============================
FAILED ../../../ortools/linear_solver/python/model_builder_test.py::ModelBuilderExamplesTest::testInPlaceSumModifications - AssertionError: 
- (x0 + x1 + x2 + x3 + x4)
+ (x0 + x1 + x2 + x3 + x4 + y0)
?                        +++++
======================= 1 failed, 10412 passed in 18.89s =======================

python_sat_cp_model_test

204/541 Test #204: python_sat_cp_model_test ...................................................***Failed    7.12 sec
============================= test session starts ==============================
platform linux -- Python 3.14.0, pytest-9.0.1, pluggy-1.6.0
rootdir: /home/runner/work/or-tools/or-tools
collected 145 items

../../../ortools/sat/python/cp_model_test.py ........................... [ 18%]
......................F................................................. [ 68%]
..............................................                           [100%]

=================================== FAILURES ===================================
_________________ CpModelTest.test_in_place_sum_modifications __________________

self = <cp_model_test.CpModelTest testMethod=test_in_place_sum_modifications>

    def test_in_place_sum_modifications(self) -> None:
        model = cp_model.CpModel()
        x = [model.new_int_var(0, 10, f"x{i}") for i in range(5)]
        y = [model.new_int_var(0, 10, f"y{i}") for i in range(5)]
        e1 = sum(x)
        self.assertIsInstance(e1, cmh.SumArray)
        self.assertEqual(e1.int_offset, 0)
        self.assertEqual(e1.double_offset, 0)
        self.assertEqual(e1.num_exprs, 5)
        e1_str = str(e1)
        _ = e1 + y[0]
        _ = sum(y) + e1
>       self.assertEqual(e1_str, str(e1))
E       AssertionError: 
E       - (x0 + x1 + x2 + x3 + x4)
E       + (x0 + x1 + x2 + x3 + x4 + y0)
E       ?                        +++++

../../../ortools/sat/python/cp_model_test.py:2597: AssertionError
=============================== warnings summary ===============================
ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/ortools/sat/python/cp_model_test.py:1807: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    self.assertFalse(cp_model.object_is_a_true_literal(~True))

ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/build/python/venv/lib/python3.14/site-packages/ortools/sat/python/cp_model.py:209: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    return literal_as_int == 1 or literal_as_int == ~False

ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/ortools/sat/python/cp_model_test.py:1808: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    self.assertFalse(cp_model.object_is_a_false_literal(~False))

ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/build/python/venv/lib/python3.14/site-packages/ortools/sat/python/cp_model.py:225: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    return literal_as_int == 0 or literal_as_int == ~True

ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/ortools/sat/python/cp_model_test.py:1809: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    self.assertTrue(cp_model.object_is_a_true_literal(~False))

ortools/sat/python/cp_model_test.py::CpModelTest::test_is_literal_true_false
  /home/runner/work/or-tools/or-tools/ortools/sat/python/cp_model_test.py:1810: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    self.assertTrue(cp_model.object_is_a_false_literal(~True))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED ../../../ortools/sat/python/cp_model_test.py::CpModelTest::test_in_place_sum_modifications - AssertionError: 
- (x0 + x1 + x2 + x3 + x4)
+ (x0 + x1 + x2 + x3 + x4 + y0)
?                        +++++
================== 1 failed, 144 passed, 8 warnings in 6.72s ===================

ref: https://github.com/google/or-tools/actions/runs/19665926910/job/56322778787

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions