Skip to content

ExpressionTreeWalker fails on some functions #19464

@rwst

Description

@rwst

In some tickets (eg #15024, #16813) this doctest from symbolic/expression_conversions.py

            sage: foo = random_expr(20, nvars=2)
            sage: foo
            sage: s = ExpressionTreeWalker(foo)
            sage: bool(s() == foo)

fails because the set of functions returned by random_expr contains one of floor/ceil which currently don't accept the hold keyword:

sage: floor(x,hold=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-fc5809e0a430> in <module>()
----> 1 floor(x,hold=True)

TypeError: __call__() got an unexpected keyword argument 'hold'

This would affect any use of the walker or its subclasses on floor expressions.

The reason is that both functions handle their calls themselves (instead of relying on superclass functionality) because at the time it was deemed necessary to provide a keyword named maximum_bits.

Component: symbolics

Author: Ralf Stephan

Branch/Commit: u/rws/expressiontreewalker_fails_on_some_functions @ d2afc44

Issue created by migration from https://trac.sagemath.org/ticket/19464

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions