Skip to content

Conversation

oxmb
Copy link

@oxmb oxmb commented Aug 15, 2025

Fix log_warning function call with missing arguments

Fix for #1493

Summary

  • Fixed TypeError in sphinx_needs/warnings.py:80 where log_warning was called with only 2 arguments instead of the required 4 positional arguments
  • This was causing crashes when processing invalid warning filters in Sphinx 8.x environments
  • The fix ensures proper compatibility with the updated log_warning function signature

Root Cause

The log_warning function signature in sphinx_needs/logging.py expects 4 positional arguments:

  1. logger (SphinxLoggerAdapter)
  2. message (str)
  3. subtype (WarningSubTypes)
  4. location (str | tuple | Node | None)

However, the call on line 80 of warnings.py was only passing 2 arguments:

log_warning(logger, f"Unknown needs warnings filter {warning_filter}!")

Fix Applied

Updated the problematic call to include the missing required arguments:

log_warning(logger, f"Unknown needs warnings filter {warning_filter}!", "warnings", None)

Tests

  • All existing warning-related tests pass (pytest tests/ -k "warning")

@oxmb oxmb force-pushed the fix-process-warnings branch 2 times, most recently from 834a426 to 08bbdb1 Compare August 15, 2025 08:59
@oxmb oxmb changed the title 🐛 fix log_warning function call with missing arguments fix log_warning function call with missing arguments Aug 15, 2025
Fixed TypeError in warnings.py where log_warning was called with only 2
arguments instead of the required 4 positional arguments (logger,
message, subtype, location). This was causing crashes when processing
invalid warning filters in Sphinx 8.x.

The fix ensures compatibility with the updated log_warning function
signature introduced for Sphinx 8.x compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant