Skip to content

[MNT]: validate linewidth #30323

@story645

Description

@story645

Summary

I accidentally set linewidth as '2' instead of 2 and the resulting error message is of no help:

 [/usr/local/lib/python3.11/dist-packages/matplotlib/backends/backend_agg.py](https://localhost:8080/#) in draw_path(self, gc, path, transform, rgbFace)
    128         else:
    129             try:
--> 130                 self._renderer.draw_path(gc, path, transform, rgbFace)
    131             except OverflowError:
    132                 cant_chunk = ''

RuntimeError: Unable to cast Python instance of type <class 'tuple'> to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)

Proposed fix

Other parameters like color get validated real time, so if it's not too expensive I think validating that linewidth is a number could save some debugging frustration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions