-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use correct type for Tk addresses. #7634
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
Conversation
It does some silly things with pointers, and it's not even used.
CPython has used a long for this address since before 2010 (it is difficult to read the merge from SVN back then), and has been a long-from-void* since 2013 (3.3.3 and 2.7.6). Fixes matplotlib#7633.
Raising at the c level is typically a critical bug (as it is extra hard for users to debug/patch around) which is why i moved this to 2.0 mile stone |
attn @matthew-brett |
It works! I built (and got version 2.0.0rc1+79.ga91559b -- I hope that means I applied the pull request right :-) and now in the venv my matplotlib programs are displaying graphs. Thanks! |
Also related https://bugs.python.org/issue18909 (@QuLogic linked to the resulting patch). My understanding of what is going wrong here (sorry for transcribing some way to picky details):
static PyObject *
Tkapp_InterpAddr(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":interpaddr"))
return NULL;
return PyLong_FromVoidPtr(Tkapp_Interp(self));
} Prior to this (back to when it was added in 1998) this was implemented as (in python/cpython@83e9f84 ) static PyObject *
Tkapp_InterpAddr(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":interpaddr"))
return NULL;
return PyInt_FromLong((long)Tkapp_Interp(self));
} The change is due to a
So, in conclusion, I am convinced that this works in principle and the OP reports that it works in practice so merging. |
Based on the issue, the limit may have been assumed to be 31 bits, so if Python/kernel's got some address fuzzing going on (ASLR, maybe), it could produce a 32-bit address that wouldn't fit. I'm not entirely sure about that. |
CPython has used a long for this address since before 2010 (it is difficult to read the merge from SVN back then), and has been a long-from-void* since 2013 (3.3.3 and 2.7.6).
Fixes #7633.
Also, remove the buggy and unused
_pyobj_addr
which really is not very portable.I don't have a 32-bit system to actually verify this, but based on the upstream bug report maybe 64-bit Windows could fall prey to this as well. @akkana, please try out this branch if possible.