Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sagemathgh-39621: Fix documentation diff for cython()
    
As discussed in
sagemath#38946 (comment) ,
this hides an irrelevant entry in documentation diff.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39621
Reported by: user202729
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Mar 9, 2025
2 parents be50a79 + 3c8eb0d commit f922dfc
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit f922dfc

Please sign in to comment.