Skip to content

Conversation

@mmcky
Copy link
Member

@mmcky mmcky commented Nov 16, 2025

Problem

Fixes a error that occurs during LaTeX/PDF builds when the class is not present in inline node classes.

Error discovered in: QuantEcon/continuous_time_mcs CI build

Root Cause

In UpdateReferencesToEnumerated.run(), the code unconditionally attempts to remove the 'std-ref' class from inline node classes:

classes.remove('std-ref')  # ❌ Fails if 'std-ref' not in list

During certain build scenarios (particularly LaTeX/PDF output), the 'std-ref' class may not be present in the classes list, causing the build to fail.

Solution

Add a conditional check before removing the class:

if 'std-ref' in classes:
    classes.remove('std-ref')  # ✅ Only remove if present

This makes the code more defensive and compatible with different Sphinx build scenarios.

Testing

  • ✅ All 116 tests pass
  • ✅ No regressions introduced
  • ✅ Compatible with Python 3.10-3.13 and Sphinx 6-8

Impact

  • Low risk: Simple defensive check
  • High value: Fixes blocking error in production builds
  • No breaking changes: Maintains all existing behavior

Fixes ValueError when building LaTeX/PDF output where 'std-ref' class
may not be present in inline node classes. This was causing builds to
fail with 'ValueError: list.remove(x): x not in list'.

The fix adds a conditional check before attempting to remove the class,
making the code more defensive and compatible with different Sphinx
build scenarios.

Fixes issue discovered in QuantEcon/continuous_time_mcs CI build:
https://github.com/QuantEcon/continuous_time_mcs/actions/runs/19413054039/job/55537214078
@mmcky mmcky merged commit c434ee8 into main Nov 17, 2025
14 checks passed
@mmcky mmcky deleted the fix/std-ref-class-removal branch November 17, 2025 02:59
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.

2 participants