-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove monkey patching of inspect.isfunction in sage.__init__ #32479
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:8
Setting to "needs review" so that the patchbot runs |
This comment has been minimized.
This comment has been minimized.
Author: Matthias Koeppe, ... |
comment:9
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:14
There are a few uses of
|
comment:15
I would also like to get rid of these uses of
Help on this would be welcome |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed author from Matthias Koeppe, ... to Matthias Koeppe |
comment:18
Well, comment:14, comment:15 are refinements that can be done in follow-up tickets. Ready for review |
This comment has been minimized.
This comment has been minimized.
comment:20
What's an example of a cython function that isn't |
comment:21
Replying to @orlitzky:
In other words, what goes wrong if you change the plot/sagedoc code to use |
comment:22
Note that
... so Regarding |
comment:23
(All Cython functions are |
comment:24
Ok, let's just merge the easy part then (I don't really want to look at plots either). This bit in try:
vars = func.arguments()
except AttributeError:
try:
vars = func.variables()
except AttributeError:
vars = sage_getargspec(func)[0] Mismatched parentheses in docstring: """
Think twice before using this function (or any function from the
``inspect`` or ``sage.misc.sageinspect`` modules. Most uses of
``isfunction`` in ordinary library code can be replaced by ``callable``.
""" You could also use Sphinx cross-module references there. Finally, """
Verify that ipywidgets can correctly determine signatures of Cython
functions::
sage: from ipywidgets.widgets.interaction import signature
sage: from sage.dynamics.complex_dynamics.mandel_julia_helper import fast_mandelbrot_plot
sage: signature(fast_mandelbrot_plot) # random
<IPython.utils._signatures.Signature object at 0x7f3ec8274e10>
""" I think that should go under a new |
comment:25
Replying to @orlitzky:
I haven't timed this particular one in Cython but at least in plain Python |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Michael Orlitzky |
comment:27
Ok then. |
comment:28
Thanks for reviewing! |
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
|
comment:30
Merged #31420 to remove the trivial merge conflict in |
Dependencies: #31420 |
Changed branch from u/mkoeppe/remove_monkey_patching_of_inspect_isfunction_in_sage___init__ to |
"Monkey-patch
inspect.isfunction()
to support Cython functions."Introduced in 2018 (8.3.beta2) in #25373 (for #24994).
However, this change has been rejected by upstream (https://bugs.python.org/issue30071, https://www.python.org/dev/peps/pep-0575/, https://www.python.org/dev/peps/pep-0580/).
In this ticket:
we remove the monkey-patching
replace unnecessary uses of
inspect
in ordinary Sage library code by other solutionsreplace remaining uses of
inspect.isfunction
by the new name of our monkey-patched variant:sage.misc.sageinspect.is_function_or_cython_function
(To be checked whether https://www.python.org/dev/peps/pep-0590, superseding some of the above rejected PEPs, offers help; see also the informational PEP https://www.python.org/dev/peps/pep-0579/)
Related:
sphinx.util.inspect.Signature
, notsphinx.ext.autodoc.inspector.formatargspec
sage_getargspec
mishandles keyword-only argumentsDepends on #31420
CC: @fchapoton @kwankyu @jhpalmieri @orlitzky
Component: refactoring
Author: Matthias Koeppe
Branch/Commit:
2ba4c43
Reviewer: Michael Orlitzky
Issue created by migration from https://trac.sagemath.org/ticket/32479
The text was updated successfully, but these errors were encountered: