Skip to content
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

Crash on non-Windows if Python runs from a non-ASCII directory #47047

Closed
pitrou opened this issue May 9, 2008 · 3 comments
Closed

Crash on non-Windows if Python runs from a non-ASCII directory #47047

pitrou opened this issue May 9, 2008 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@pitrou
Copy link
Member

pitrou commented May 9, 2008

BPO 2798
Nosy @amauryfa, @pitrou, @tiran
Files
  • getargs.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-05-12.13:21:04.866>
    created_at = <Date 2008-05-09.10:04:58.661>
    labels = ['interpreter-core', 'type-crash']
    title = 'Crash on non-Windows if Python runs from a non-ASCII directory'
    updated_at = <Date 2008-05-12.13:21:04.797>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2008-05-12.13:21:04.797>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-05-12.13:21:04.866>
    closer = 'amaury.forgeotdarc'
    components = ['Interpreter Core']
    creation = <Date 2008-05-09.10:04:58.661>
    creator = 'pitrou'
    dependencies = []
    files = ['10231']
    hgrepos = []
    issue_num = 2798
    keywords = ['patch']
    message_count = 3.0
    messages = ['66461', '66557', '66720']
    nosy_count = 4.0
    nosy_names = ['amaury.forgeotdarc', 'pitrou', 'christian.heimes', 'rbp']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue2798'
    versions = ['Python 3.0']

    @pitrou
    Copy link
    Member Author

    pitrou commented May 9, 2008

    (Note: I'm splitting this from bpo-1342 because the fix is much simpler in
    the non-Windows case)

    py3k does not accept running from a path with non-ascii characters.

    $ pwd
    /home/antoine/py3k/héhé
    $ ./python
    Fatal Python error: Py_Initialize: can't initialize sys standard streams
    Traceback (most recent call last):
      File "/home/antoine/py3k/pristine/Lib/encodings/__init__.py", line 32,
    in <module>
    TypeError: zipimporter() argument 1 must be string without null bytes,
    not str
    Abandon

    The following patch solves the problem by fixing a bug in getargs.c
    where the "no null bytes" check for non-ASCII strings was wrong.

    There is still a failing test, test_xmlrpc, apparently because xmlrpc
    wants to output its path in an HTTP header using the "ascii" encoding...
    I'd say this is an xmlrpc issue and not an issue with the patch.

    @pitrou pitrou added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels May 9, 2008
    @rbp
    Copy link
    Mannequin

    rbp mannequin commented May 10, 2008

    The patch works for me, and I agree the test_xmlrpc is an xmlrpc issue.

    Perhaps unrelated to this issue, but I think it makes this whole unicode
    getargs situation fragile: I could not understand why the 'z' case (on
    the switch where this patch applies, starting on line 879 on the patched
    file) does a PyString_Check(arg) and a PyUnicode_Check(arg), while the
    corresponding section on case 's' (line 813) only does PyUnicode_Check(arg).

    Is this really an inconsistency? Maybe this should go into an issue to
    cleanup this switch, according to the comment at its beginning:

    /* XXX WAAAAH!  's', 'y', 'z', 'u', 'Z', 'e', 'w', 't' codes all
       need to be cleaned up! \*/
    

    @amauryfa
    Copy link
    Member

    Committed as r63161, with tests.
    Thanks!

    Now let's work on the Windows case...

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants