Title: [MNT]: validate linewidth · Issue #30323 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: validate linewidth · Issue #30323 · matplotlib/matplotlib
X Title: [MNT]: validate linewidth · Issue #30323 · matplotlib/matplotlib
Description: 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, t...
Open Graph Description: 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://localhos...
X Description: 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://...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30323
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: validate linewidth","articleBody":"### Summary\n\nI accidentally set linewidth as ``'2'`` instead of 2 and the resulting error message is of no help:\n\n```python-traceback\n [/usr/local/lib/python3.11/dist-packages/matplotlib/backends/backend_agg.py](https://localhost:8080/#) in draw_path(self, gc, path, transform, rgbFace)\n 128 else:\n 129 try:\n--\u003e 130 self._renderer.draw_path(gc, path, transform, rgbFace)\n 131 except OverflowError:\n 132 cant_chunk = ''\n\nRuntimeError: Unable to cast Python instance of type \u003cclass 'tuple'\u003e to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)\n```\n\n### Proposed fix\n\nOther 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. ","author":{"url":"https://github.com/story645","@type":"Person","name":"story645"},"datePublished":"2025-07-17T01:35:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/30323/matplotlib/issues/30323"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe0a814d-cea4-badf-87bf-80af6e11e131 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC5C:25E4BD:9C91FB:D44019:6A520162 |
| html-safe-nonce | 39382b175c50a1ee8f76895067eddef70b94487aef5b2270ac3bc69eceb3d6dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzVDOjI1RTRCRDo5QzkxRkI6RDQ0MDE5OjZBNTIwMTYyIiwidmlzaXRvcl9pZCI6IjcyMTM3MzgxNjYzMjIzMzIwMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d0020223cb5815312c5feb275839326c8d68b366a4bf0394560f8a6a6adfba32 |
| hovercard-subject-tag | issue:3237795902 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/30323/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3abbb8814a8ca5394ce005c562c0951af798a76f9f7740c83c1463573038851d/matplotlib/matplotlib/issues/30323 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3abbb8814a8ca5394ce005c562c0951af798a76f9f7740c83c1463573038851d/matplotlib/matplotlib/issues/30323 |
| og:image:alt | 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://localhos... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | story645 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width