Fix func_persist: do not use the (now removed) inspect.formatargspec, but instead use inspect.signature. #36488
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 252 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #36488"
general
weight: 0.35
balejk
Fix func_persist: do not use inspect.formatargspec (gone as of Python 3.11)
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1"
-->
<!-- Describe your changes here in detail -->
The method
inspect.formatargspechas been deprecated since Python 3.5, now removed as of 3.11.func_persiststill uses it, so we replace it withinspect.signature.Another option would be to replace it with
sageinspect.sage_formatargspec. I think that func_persist should only be used with Python functions, not Cython, andinspect.signatureis nicer for Python functions. If the function is defined asdef test(n: int) -> int:, For example, theninspect.signaturewill return(n: int) -> intwhilesageinspect.sage_formatargspecwill just return(n).This should fix #36302.
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it appropriately. -->
:memo: Checklist
<!-- Put an
xin all the boxes that apply. --><!-- If your change requires a documentation PR, please link it appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
<!-- Feel free to remove irrelevant items. -->
:hourglass: Dependencies
<!-- List all open PRs that this PR logically depends on
-->
<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->