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

Appearance settings

Commit af4830e

Browse filesBrowse files
authored
Merge pull request #10486 from mattip/issue10479
BUG: sscanf did not parse arguments in _tkagg.cpp
2 parents 656ef67 + 816ffba commit af4830e
Copy full SHA for af4830e

File tree

Expand file treeCollapse file tree

3 files changed

+8
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-6
lines changed

‎lib/matplotlib/backends/tkagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/tkagg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def blit(photoimage, aggimage, bbox=None, colormode=1):
1919
else:
2020
bboxptr = 0
2121
data = np.asarray(aggimage)
22-
dataptr = (data.ctypes.data, data.shape[0], data.shape[1])
22+
dataptr = (data.shape[0], data.shape[1], data.ctypes.data)
2323
try:
2424
tk.call(
2525
"PyAggImagePhoto", photoimage,

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def _get_testable_interactive_backends():
4141
from matplotlib import pyplot as plt
4242
4343
fig = plt.figure()
44+
ax = fig.add_subplot(111)
45+
ax.plot([1,2,3], [1,3,1])
4446
fig.canvas.mpl_connect("draw_event", lambda event: sys.exit())
4547
plt.show()
4648
"""

‎src/_tkagg.cpp

Copy file name to clipboardExpand all lines: src/_tkagg.cpp
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#include "_tkmini.h"
2020

2121
#if defined(_MSC_VER)
22-
# define IMG_FORMAT "%Iu %d %d"
22+
# define IMG_FORMAT "%d %d %Iu"
2323
#else
24-
# define IMG_FORMAT "%zu %d %d"
24+
# define IMG_FORMAT "%d %d %zu"
2525
#endif
2626
#define BBOX_FORMAT "%f %f %f %f"
2727

@@ -73,10 +73,10 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
7373
TCL_APPEND_RESULT(interp, "destination photo must exist", (char *)NULL);
7474
return TCL_ERROR;
7575
}
76-
/* get buffer from str which is "ptr height width" */
77-
if (sscanf(argv[2], IMG_FORMAT, &pdata, &hdata, &wdata) != 3) {
76+
/* get buffer from str which is "height width ptr" */
77+
if (sscanf(argv[2], IMG_FORMAT, &hdata, &wdata, &pdata) != 3) {
7878
TCL_APPEND_RESULT(interp,
79-
"error reading data, expected ptr height width",
79+
"error reading data, expected height width ptr",
8080
(char *)NULL);
8181
return TCL_ERROR;
8282
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.