Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Calling pyplot.show() with TkAgg backend on x86 machine raises OverflowError. #12567

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone
@Shooter23

Description

@Shooter23

Bug report

Bug summary

Callingpyplot.show() with TkAgg backend on x86 machine raisesOverflowError.

The format provided toPyArg_ParseTuple inmpl_tk_blit() in file _tkagg.cpp ("ns(iin)(iiii)(iiii):blit") causes the third element in the third argument toblit() (dataptr[2]) to convert to aPy_ssize_t. A 32-bitPy_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 indataptr (see PDB output below).

Changingiin in the format toiik (dataptr[2] tounsigned long) fixes this problem for me but it may cause problems under other conditions or architectures.

Code for reproduction

frommatplotlibimportpyplotaspltx= [1,2,3,4]y= [1,4,9,16]plt.plot(x,y)plt.show()

Actual outcome

Exception in Tkinter callbackTraceback (most recent call last):  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 1702, in __call__    return self.func(*args)  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 267, in resize    self.draw()  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/backend_tkagg.py", line 10, in draw    _backend_tk.blit(self._tkphoto, self.renderer._renderer, (0, 1, 2, 3))  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 91, in blit    photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)OverflowError: Python int too large to convert to C ssize_tException in Tkinter callbackTraceback (most recent call last):  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 1702, in __call__    return self.func(*args)  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 746, in callit    func(*args)  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 346, in idle_draw    self.draw()  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/backend_tkagg.py", line 10, in draw    _backend_tk.blit(self._tkphoto, self.renderer._renderer, (0, 1, 2, 3))  File "/usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 91, in blit    photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)OverflowError: Python int too large to convert to C ssize_t

Arguments to blit() from PDB:

> /usr/local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py(91)blit()-> photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)(Pdb) p photoimage.tk.interpaddr()170396608(Pdb) p str(photoimage)'pyimage10'(Pdb) p dataptr(480, 640, 2990080008)(Pdb) p offsets(0, 1, 2, 3)(Pdb) p bboxptr(0, 640, 0, 480)

Expected outcome

A graph mapping [1, 2, 3, 4] to [1, 4, 9, 16].

Matplotlib version

  • Operating system: Slackware Linux 14.2, kernel 4.4.157
  • Matplotlib version: 3.0.0 (via pip)
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.7.0 (from source, compiled with gcc)
  • Jupyter version (if applicable):
  • Other libraries: numpy 1.15.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp