Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
Summary
Matplotlib may be vulnerable to ABI and memory alignment issues caused by C23 default behaviors in GCC 15.1. Silent adoption of padding behavior changes — particularly in union or struct definitions used in NumPy or Pandas C extensions — may lead to unpredictable runtime behavior.
This issue was originally identified in NumPy, Cython andMeson. As Matplotlib includes Meson and relies on NumPy for internal memory layout, it is downstream vulnerable.
These compiled pieces are sensitive to pointer alignment, ABI expectations, or padding behaviors — especially across environments.
##Reproducible Example
Please see section below
Possibly related to:
Bug: interpolation_stage="data" removes too many pixels in the vicinity of nans in upsampled, interpolated images
Bug: memory baking figure is not freed when figure is closed
Missing type hints for matplotlib.dates.DateFormatter
MNT: Python 3.14.0a7 test failures
While these examples originate from different baselines, they exhibit a common theme: ABI drift between independently compiled modules. This behavior may also be present in earlier releases where build procedures lacked explicit compilation flags across Python packages.
Report for more context:
Report
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotasplt# Create a matrix with a single NaN valuematrix=np.ones((5,5))matrix[2,2]=np.nanfig,axs=plt.subplots(1,2,figsize=(10,5),layout="constrained")# Interpolation at data stageaxs[0].imshow(matrix,interpolation="bilinear",interpolation_stage="data")axs[0].set_title("Stage: data (NaN overspill?)")# Interpolation at RGBA stageaxs[1].imshow(matrix,interpolation="bilinear",interpolation_stage="rgba")axs[1].set_title("Stage: rgba (Expected NaN spread)")plt.suptitle("NaN Propagation Comparison by Interpolation Stage")plt.show()
Actual outcome
Interpolating at the data stage causes NaN values to overspill far beyond their origin, resulting in unexpected blank areas in plots. By contrast, the same data interpolated at the rgba stage shows localized NaN effects, which aligns with user expectation.
This may reflect memory interpretation differences in how NaNs are detected in interpolated image data, potentially tied to buffer access order or build settings.
Expected outcome
NaNs should propagate locally during bilinear interpolation. The presence of a single NaN should not render large swaths of the image as undefined when interpolating at the data stage.
Additional information
Matplotlib version: e.g., 3.10.3
Backend: Agg or default interactive backend
Python version: 3.13.X
NumPy version: 2.2.5 (2.2.6 was just recently released)
Operating system
No response
Matplotlib Version
3.10.3
Matplotlib Backend
No response
Python version
3.13.3
Jupyter version
No response
Installation
None