Skip to content
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

Fix documentation diff for cython() #39621

Merged
merged 2 commits into from
Mar 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/sage/misc/cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _webbrowser_open_file(path):

def cython(filename, verbose=0, compile_message=False,
use_cache=False, create_local_c_file=False, annotate=True, view_annotate=False,
view_annotate_callback=_webbrowser_open_file, sage_namespace=True, create_local_so_file=False):
view_annotate_callback=None, sage_namespace=True, create_local_so_file=False):
r"""
Compile a Cython file. This converts a Cython file to a C (or C++ file),
and then compiles that. The .c file and the .so file are
Expand Down Expand Up @@ -124,7 +124,8 @@ def cython(filename, verbose=0, compile_message=False,
- ``view_annotate_callback`` -- function; a function that takes a string
being the path to the html file. This can be overridden to change
what to do with the annotated html file. Have no effect unless
``view_annotate`` is ``True``.
``view_annotate`` is ``True``. By default, the html file is opened in a
web browser.

- ``sage_namespace`` -- boolean (default: ``True``); if ``True``, import
``sage.all``
Expand Down Expand Up @@ -271,6 +272,9 @@ def cython(filename, verbose=0, compile_message=False,
sage: len(collected_paths)
1
"""
if view_annotate_callback is None:
# needed because of https://github.com/sagemath/sage/pull/38946#issuecomment-2656329774
view_annotate_callback = _webbrowser_open_file
if not filename.endswith('pyx'):
print("Warning: file (={}) should have extension .pyx".format(filename), file=sys.stderr)

Expand Down
Loading