Mentions légales du service

Skip to content

Fix #28: Add `import coccinelle` before running Python code

Thierry Martinez requested to merge tmartine/coccinelle:fix.28 into master

The first commit adds import coccinelle before running the Python code associated to a constraint (run_constraint) or the generator of a fresh identifier (run_fresh_id), and the second commit refactors some code duplication in Python initialization and execution.

Beforehand, import coccinelle was only run in python_code in cocci.ml, which is only evaluated in the initialization script rule.

The first commit adds a test for Python initialization: unfortunately, the test passes the testsuite even without this commit, before other tests run before initpython.cocci already have initialization script rules, which turn the Python interpreter in a state where the test can pass. I don't know how to make the tests "stateless".

Edited by Thierry Martinez

Merge request reports