Chameleon failures with Zope starting with version 4.5.0
On the Zope side we are currently stuck at Chameleon 4.4.4 because several unit tests fail, starting with Chameleon 4.5.0. The generated Python code is also quite different. I have done some digging at https://github.com/zopefoundation/Zope/pull/1252.
First of all, some generated Python code fails with syntax errors as described at https://github.com/zopefoundation/Zope/pull/1252#issuecomment-2673884409. I do not know if the IndentationError is a red herring, but it seems odd to have these multiple import statements from chameleon.tales import DEFAULT_MARKER as _DEFAULT_MARKER. That feels like an issue with the Chameleon code generator. If I remove the duplicated imports in the generated Python file the SyntaxError is gone.
After removing the duplicated imports another difference causes a traceback, see https://github.com/zopefoundation/Zope/pull/1252#issuecomment-2673888183. Chameleon uses a different expression engine all of a sudden, instead of using an instance of Products.PageTemplates.expression.BoboAwareZopeTraverse it calls the function Products.PageTemplates.engine._compile_zt_expr, which then calls the underlying expression class with bad initialization arguments.
Does any of this ring a bell?
P.S.: Just to clarify, in the testing scenario all other related packages like z3c.pt, zope.tal, zope.tales are the same versions. The only thing I am changing is the Chameleon version pin.