Skip to content

Use of msvcrt is broken by Python 3.5 #32

Closed

Description

@takluyver

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.

This was initially submitted as ipython/ipython#8316.

Activity

  1. zooba commented on Apr 16, 2015

    @zooba

    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.

  2. jfietz commented on Jun 9, 2015

    @jfietz

    I am running into the same problem. Which workaround were you talking about?

  3. takluyver commented on Jun 9, 2015

    @takluyver
    Author

    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.

  4. jfietz commented on Jun 9, 2015

    @jfietz

    For posterity: seems like continuing to use Python3.4 solves the problem. Too ambitious about using the newest version.

  5. zooba commented on Jun 9, 2015

    @zooba

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions