Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: sscanf did not parse arguments in _tkagg.cpp #10486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/tkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def blit(photoimage, aggimage, bbox=None, colormode=1):
else:
bboxptr = 0
data = np.asarray(aggimage)
dataptr = (data.ctypes.data, data.shape[0], data.shape[1])
dataptr = (data.shape[0], data.shape[1], data.ctypes.data)
try:
tk.call(
"PyAggImagePhoto", photoimage,
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def _get_testable_interactive_backends():
from matplotlib import pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3], [1,3,1])
fig.canvas.mpl_connect("draw_event", lambda event: sys.exit())
plt.show()
"""
Expand Down
10 changes: 5 additions & 5 deletions src/_tkagg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "_tkmini.h"

#if defined(_MSC_VER)
# define IMG_FORMAT "%Iu %d %d"
# define IMG_FORMAT "%d %d %Iu"
#else
# define IMG_FORMAT "%zu %d %d"
# define IMG_FORMAT "%d %d %zu"
#endif
#define BBOX_FORMAT "%f %f %f %f"

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