You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been significant changes to the visual C runtime with Visual Studio 2015, and this means that there is no longer a single msvcrt DLL, so the way pyreadline loads msvcrt here breaks in Python 3.5.
I just spoke to Steve Dower (@zooba) about this - he suggested that pyreadline could use the Python msvcrt module instead, and he'd get any functions pyreadline needs added to that. It looks like pyreadline currently uses strncpy, _strdup and memcpy.
Looking a little closer, it doesn't seem like adding those functions to msvcrt fixes the entire problem. strdup isn't required for 3.5 and strncpy could be replaced by windll.kernel32.lstrcpynA. memcpy could also be done using lstrcpynA, since it is just copying a string.
Also, Python 3.4 now requires use of PyMem_RawAlloc here instead of PyMem_Alloc, but after I changed it I was getting memory corruption, so something else probably needs work too.
There's a big patch for msvcrtmodule in progress right now, but if the methods need to be added there I'm happy to do it once that other patch lands. Just let me know if the workarounds are insufficient.
For the record, we have a plan to move IPython away from readline entirely (ipython/ipython#8489). That probably won't be done before Python 3.5 is out, but when it is done, it should get round this.
My suggested workarounds are for the developers (or if you want to modify the sources yourself): "strncpy could be replaced by windll.kernel32.lstrcpynA. memcpy could also be done using lstrcpynA, since it is just copying a string."
It's not too ambitious - 3.5 is in beta and it needs testing against all of these cases so we can find these issues before we declare everything ready.
Activity
zooba commentedon Apr 16, 2015
Looking a little closer, it doesn't seem like adding those functions to msvcrt fixes the entire problem.
strdupisn't required for 3.5 and strncpy could be replaced bywindll.kernel32.lstrcpynA. memcpy could also be done using lstrcpynA, since it is just copying a string.Also, Python 3.4 now requires use of
PyMem_RawAllochere instead ofPyMem_Alloc, but after I changed it I was getting memory corruption, so something else probably needs work too.There's a big patch for msvcrtmodule in progress right now, but if the methods need to be added there I'm happy to do it once that other patch lands. Just let me know if the workarounds are insufficient.
jfietz commentedon Jun 9, 2015
I am running into the same problem. Which workaround were you talking about?
takluyver commentedon Jun 9, 2015
For the record, we have a plan to move IPython away from readline entirely (ipython/ipython#8489). That probably won't be done before Python 3.5 is out, but when it is done, it should get round this.
jfietz commentedon Jun 9, 2015
For posterity: seems like continuing to use Python3.4 solves the problem. Too ambitious about using the newest version.
zooba commentedon Jun 9, 2015
My suggested workarounds are for the developers (or if you want to modify the sources yourself): "strncpy could be replaced by
windll.kernel32.lstrcpynA. memcpy could also be done using lstrcpynA, since it is just copying a string."It's not too ambitious - 3.5 is in beta and it needs testing against all of these cases so we can find these issues before we declare everything ready.