Skip to content

Conversation

@soehms
Copy link
Member

@soehms soehms commented Oct 9, 2025

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • 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.

This PR fixes the bug identified at #40213 (comment). In detail:

  • The keyword is passed in recursive calls.
  • An additional check is added before the warning in recursive calls is raised to avoid unnecessary warnings.

This PR also fixes some optional doctests in src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py that were broken due to changes to polynomial formatting.

⌛ Dependencies

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Documentation preview for this PR (built with commit 3c445f3; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@soehms soehms marked this pull request as ready for review October 9, 2025 16:25
@user202729
Copy link
Contributor

if it defaults to None but is set to True whenever it's None, isn't it simpler to default it to True as before?

@soehms
Copy link
Member Author

soehms commented Oct 11, 2025

if it defaults to None but is set to True whenever it's None, isn't it simpler to default it to True as before?

Yes, you're right! I changed that again (it must have been a relic from a previous attempt). Thanks for watching.

@user202729
Copy link
Contributor

not sure if the following can happen and what's the intended behavior. Let's say you have

def f(warning=True):
	g(warning=warning)
	h(warning=warning)

def g(warning=True):
	if some_condition:
		warn(...)
		warning=False

def h(warning=True):
	if some_condition:
		warn(...)
		warning=False

and both some_condition is True, then the warning=False set in g will not be propagated to h, raising two warnings.
(although having extra warnings doesn't really cause any harm, plus the warning message may be different anyway)

@soehms
Copy link
Member Author

soehms commented Oct 15, 2025

not sure if the following can happen and what's the intended behavior. Let's say you have

def f(warning=True):
	g(warning=warning)
	h(warning=warning)

def g(warning=True):
	if some_condition:
		warn(...)
		warning=False

def h(warning=True):
	if some_condition:
		warn(...)
		warning=False

and both some_condition is True, then the warning=False set in g will not be propagated to h, raising two warnings. (although having extra warnings doesn't really cause any harm, plus the warning message may be different anyway)

I understand your point, but I think it doesn't apply in our cases:

  1. Your f is the __init__ of SplittingAlgebra. Then g is its class call, and h = f (recursively). Since the latter is applied to a polynomial of degree one, the warning doesn't occur there.
  2. Your f is solve_with_extension, and g and h are both create_roots. Here, g and h are in different conditional branches.

@cxzhong cxzhong requested review from dimpase and fchapoton October 25, 2025 05:37
vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 1, 2025
sagemathgh-41016: Fix missing warning in SplittingAlgebra
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 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.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

This PR fixes the bug identified at
sagemath#40213 (comment). In
detail:

* The keyword is passed in recursive calls.
* An additional check is added before the warning in recursive calls is
raised to avoid unnecessary warnings.

This PR also fixes some optional doctests in
`src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py` that were
broken due to changes to polynomial formatting.



### ⌛ 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#41016
Reported by: Sebastian Oehms
Reviewer(s): Chenxin Zhong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants