Repository navigation
Description
Original report at SourceForge, opened Wed Oct 6 06:04:18 2010
The tkagg backend doesn't natively support the 64-bits version of windows (not ia64 but amd64 architecture).
This is due the fact that long unsigned and __int64 are not the same types on this host.
The attached patch, based on the available commented source in src/_tkagg.cpp allows for a correct handling of Windows 64-bits platform.
SourceForge Comments
On Tue Oct 19 14:38:50 2010, cjgohlke wrote:
There are two things to do:
-
verify that the new scanf format "%zu" does work on all non msvc compilers used to build matplotlib, especially older gcc versions and operating systems. I do not have the means to do this.
-
create a test case that fails without the patch on 64 bit Windows. I have been using mpl on win-amd64 for a year and never ran into this issue (Win 7, 8 GB RAM). From the documentation available, using size_t and "%Iu" is the correct way when using msvc. I verified that mpl still works on win32 and win-amd64 with this change.
Maybe a patch that only changes the scanf format specifier when compiled on Windows is better at this point, even though less straightforward.
On Tue Oct 19 12:21:08 2010, oeloio wrote:
if no one else have, i 'll try your patch next month.
thanks for your help
On Tue Oct 19 11:04:06 2010, mdboom wrote:
I don't have access to a 64-bit Windows installation to test with. Do any of the other developers? Any way you could get a third-party to verify that this fix works?
On Thu Oct 7 14:25:23 2010, cjgohlke wrote:
Regarding my patch: it is probably better to check for _MSC_VER instead of _WIN32:
-#if defined(_WIN32)
+#if defined(_MSC_VER)
On Thu Oct 7 02:55:09 2010, oeloio wrote:
forget what i said, i was thinking about soth. else.
let me know what you chose to implement.
On Thu Oct 7 02:50:40 2010, cjgohlke wrote:
Never heard of ptr_type and its scanf format. I got the length specifiers for size_t from Wikipedia http://en.wikipedia.org/wiki/Printf. However MSDN does not seem to know about 'I' (capital i) http://msdn.microsoft.com/en-us/library/xdb9w69d%28v=VS.90%29.aspx.
On Thu Oct 7 01:53:50 2010, oeloio wrote:
Thanks for your answer.
Then, should we not be directly using a ptr_type if we choose to adjust the sscanf format ?
On Wed Oct 6 22:29:41 2010, cjgohlke wrote:
This should be fixed. How about using size_t to store the pointers and adjusting the sscanf format?
Index: src/_tkagg.cpp
--- src/_tkagg.cpp (revision 8732)
+++ src/_tkagg.cpp (working copy)
@@ -32,8 +32,12 @@
#endif
}
+#if defined(_WIN32)
+# define SIZE_T_FORMAT "%Iu"
+#else
+# define SIZE_T_FORMAT "%zu"
+#endif
typedef struct
{
PyObject_HEAD
@@ -51,7 +55,7 @@
// vars for blitting
PyObject* bboxo;
- unsigned long aggl, bboxl;
- size_t aggl, bboxl;
bool has_bbox;
agg::int8u destbuffer;
double l, b, r, t;
@@ -81,7 +85,7 @@
return TCL_ERROR;
}
/ get array (or object that can be converted to array) pointer */ - if (sscanf(argv[2], "%lu", &aggl) != 1)
- if (sscanf(argv[2], SIZE_T_FORMAT, &aggl) != 1)
{
Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
return TCL_ERROR;
@@ -107,7 +111,7 @@
}
/* check for bbox/blitting */
- if (sscanf(argv[4], "%lu", &bboxl) != 1)
- if (sscanf(argv[4], SIZE_T_FORMAT, &bboxl) != 1)
{
Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
return TCL_ERROR;
SourceForge History
- On Sat Oct 9 20:07:44 2010, by efiring: assigned_to: 100
- On Wed Oct 6 06:04:19 2010, by oeloio: File Added: 389037: patch_wx64_tkagg.diff
Activity
dmcdougall commentedon Sep 23, 2012
Closing: commit 13384a1 claims to have resolved this.
@cgohlke Let me know if I'm wrong and I will re-open this.