Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #23162: Give a warning when using citation.get_systems() without…
… Cython profiling `sage.misc.citation.get_systems()` is implemented by using `cProfile` to look at which modules implement the functions called when executing the code. The problem is that this is totally unreliable when Cython is compiled without profiling support (which is the default). This doctest {{{ sage: from sage.misc.citation import get_systems sage: get_systems('((x+1)^2).expand()') ['ginac'] }}} only works because `Expression.expand()` is called by Python instead of Cython. If that call would be inside some other Cython code, then Python's profiler would not detect it: {{{ sage: cython('def callexpand(x): return x.expand()') sage: from sage.misc.citation import get_systems sage: get_systems('callexpand(((x+1)^2))') [] }}} There is a problem because #22747 will "break" profiling even further as even the top-level call of `Expression.expand()` would not be detected as something to be entered in the profiler. So here I propose simply to give a warning whenever `get_systems()` is used when profiling was not enabled. URL: https://trac.sagemath.org/23162 Reported by: jdemeyer Ticket author(s): Jeroen Demeyer Reviewer(s): Sébastien Labbé
- Loading branch information