Title: Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. · Issue #12567 · matplotlib/matplotlib · GitHub
Open Graph Title: Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. · Issue #12567 · matplotlib/matplotlib
X Title: Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. · Issue #12567 · matplotlib/matplotlib
Description: Bug report Bug summary Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. The format provided to PyArg_ParseTuple in mpl_tk_blit() in file _tkagg.cpp ("ns(iin)(iiii)(iiii):blit") causes the third element in the...
Open Graph Description: Bug report Bug summary Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. The format provided to PyArg_ParseTuple in mpl_tk_blit() in file _tkagg.cpp ("ns(iin)(iiii)(iiii...
X Description: Bug report Bug summary Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. The format provided to PyArg_ParseTuple in mpl_tk_blit() in file _tkagg.cpp ("ns(iin)(iiii)...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12567
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError.","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nCalling `pyplot.show()` with TkAgg backend on x86 machine raises `OverflowError`.\r\n\r\nThe format provided to `PyArg_ParseTuple` in `mpl_tk_blit()` in file _tkagg.cpp (`\"ns(iin)(iiii)(iiii):blit\"`) causes the third element in the third argument to `blit()` (`dataptr[2]`) to convert to a `Py_ssize_t`. A 32-bit `Py_ssize_t` will not accommodate a value greater than or equal to 2^31. I consistently see values outside this range for the third element in `dataptr` (see PDB output below).\r\n\r\nChanging `iin` in the format to `iik` (`dataptr[2]` to `unsigned long`) fixes this problem for me but it may cause problems under other conditions or architectures.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nfrom matplotlib import pyplot as plt\r\n\r\nx = [1, 2, 3, 4]\r\ny = [1, 4, 9, 16]\r\n\r\nplt.plot(x, y)\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.7/tkinter/__init__.py\", line 1702, in __call__\r\n return self.func(*args)\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py\", line 267, in resize\r\n self.draw()\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/backend_tkagg.py\", line 10, in draw\r\n _backend_tk.blit(self._tkphoto, self.renderer._renderer, (0, 1, 2, 3))\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py\", line 91, in blit\r\n photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)\r\nOverflowError: Python int too large to convert to C ssize_t\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.7/tkinter/__init__.py\", line 1702, in __call__\r\n return self.func(*args)\r\n File \"/usr/local/lib/python3.7/tkinter/__init__.py\", line 746, in callit\r\n func(*args)\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py\", line 346, in idle_draw\r\n self.draw()\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/backend_tkagg.py\", line 10, in draw\r\n _backend_tk.blit(self._tkphoto, self.renderer._renderer, (0, 1, 2, 3))\r\n File \"/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py\", line 91, in blit\r\n photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)\r\nOverflowError: Python int too large to convert to C ssize_t\r\n```\r\n\r\nArguments to blit() from PDB:\r\n```\r\n\u003e /usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py(91)blit()\r\n-\u003e photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)\r\n(Pdb) p photoimage.tk.interpaddr()\r\n170396608\r\n(Pdb) p str(photoimage)\r\n'pyimage10'\r\n(Pdb) p dataptr\r\n(480, 640, 2990080008)\r\n(Pdb) p offsets\r\n(0, 1, 2, 3)\r\n(Pdb) p bboxptr\r\n(0, 640, 0, 480)\r\n```\r\n\r\n**Expected outcome**\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\nA graph mapping [1, 2, 3, 4] to [1, 4, 9, 16].\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Slackware Linux 14.2, kernel 4.4.157\r\n * Matplotlib version: 3.0.0 (via pip)\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.7.0 (from source, compiled with gcc)\r\n * Jupyter version (if applicable):\r\n * Other libraries: numpy 1.15.2\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/Shooter23","@type":"Person","name":"Shooter23"},"datePublished":"2018-10-19T14:58:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/12567/matplotlib/issues/12567"}
| 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:b78aefc3-e5a3-b42c-1479-d83dc4f6407b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D984:35558F:13E03BD:1CCE3E6:6A54C4A8 |
| html-safe-nonce | 2a753ca9765b99ab83954c07ed89e5b4c355c7324248f0ea24e1028044ae2d3d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTg0OjM1NTU4RjoxM0UwM0JEOjFDQ0UzRTY6NkE1NEM0QTgiLCJ2aXNpdG9yX2lkIjoiMzY2Njg4MDY0MzQ0NTYwNTU0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3364c1ce25fc42c2f1b6279453eee874931d71f5f18b7340a1f5d76258b36e89 |
| hovercard-subject-tag | issue:371995160 |
| 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/12567/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0223effa72ca8889c952c06471a4ab36bb910065339335e32129a017f131d77a/matplotlib/matplotlib/issues/12567 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0223effa72ca8889c952c06471a4ab36bb910065339335e32129a017f131d77a/matplotlib/matplotlib/issues/12567 |
| og:image:alt | Bug report Bug summary Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. The format provided to PyArg_ParseTuple in mpl_tk_blit() in file _tkagg.cpp ("ns(iin)(iiii)(iiii... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Shooter23 |
| 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 | 69f9664dd5e7a82ba8ab1b4cb7f5a2f09333ab38 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width