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

Chinese characters issue with input() function #77873

Open
ValentinZhao mannequin opened this issue May 30, 2018 · 16 comments
Open

Chinese characters issue with input() function #77873

ValentinZhao mannequin opened this issue May 30, 2018 · 16 comments
Labels
OS-mac type-bug An unexpected behavior, bug, or error

Comments

@ValentinZhao
Copy link
Mannequin

ValentinZhao mannequin commented May 30, 2018

BPO 33692
Nosy @vstinner, @zhangyangyu
PRs
  • [3.6] bpo-33692: pythoninfo detect libedit on Python 3.6 #7244
  • [2.7] bpo-33692: pythoninfo detect libedit on Python 2.7 #7246
  • bpo-33692: pythoninfo detect libedit on Python 3.6 #7293
  • bpo-33692: pythoninfo detect libedit on Python 3.6 #7293
  • [3.7] bpo-33692: Update pythoninfo from master #7298
  • [3.6] bpo-33692: Update pythoninfo from master #7301
  • [2.7] bpo-33692: Update pythoninfo from master #7304
  • Files
  • input_test.py: a file makes you input Chinese characters
  • 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 = None
    created_at = <Date 2018-05-30.09:36:41.545>
    labels = ['OS-mac', 'type-bug']
    title = 'Chinese characters issue with input() function'
    updated_at = <Date 2018-06-01.10:29:49.196>
    user = 'https://bugs.python.org/ValentinZhao'

    bugs.python.org fields:

    activity = <Date 2018-06-01.10:29:49.196>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['macOS']
    creation = <Date 2018-05-30.09:36:41.545>
    creator = 'Valentin Zhao'
    dependencies = []
    files = ['47623']
    hgrepos = []
    issue_num = 33692
    keywords = ['patch']
    message_count = 16.0
    messages = ['318160', '318169', '318177', '318179', '318180', '318185', '318189', '318190', '318208', '318235', '318363', '318371', '318372', '318383', '318385', '318390']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'xiang.zhang', 'Valentin Zhao']
    pr_nums = ['7244', '7246', '7293', '7293', '7298', '7301', '7304']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33692'
    versions = ['Python 3.6']

    @ValentinZhao
    Copy link
    Mannequin Author

    ValentinZhao mannequin commented May 30, 2018

    DIRECTLY run(i.e., python xxx/xxx/input_test.py) the file below and input other Chinese characters, then press backspace to delete them. You will find that you cannot delete them all, and even the cursor in the terminal misplaces and overlaps with the characters.

    This issue is only reproduced under Mac OS X, everything is fine with Windows.

    @ValentinZhao ValentinZhao mannequin added topic-2to3 type-bug An unexpected behavior, bug, or error labels May 30, 2018
    @ValentinZhao ValentinZhao mannequin changed the title Chinese characters issue with input() function Chinese characters issue with input() function under Mac OSX May 30, 2018
    @vstinner
    Copy link
    Member

    input() uses readline. On macOS, readline is provided by libedit. It may be a bug in libedit which is an external dependency, and so not maintained by Python.

    @zhangyangyu
    Copy link
    Member

    I could reproduce the behavior that console output doesn't match what Python gets. I agree with Victor this may not be a Python problem. I could also reproduce the behavior with Ruby reading Chinese characters from console.

    @ned-deily
    Copy link
    Member

    FTR:

    On macOS, readline is provided by libedit.

    It *may* be provided by libedit. GNU readline is also commonly used on macOS, although it is not provided by Apple. The easiest way to tell which is in use is to examine the __doc__ attribute of the readline module:

    $ /usr/local/bin/python3.6 -c 'import readline;print(readline.__doc__)'
    Importing this module enables command line editing using libedit readline.
    $ /macports/bin/python3.6 -c 'import readline;print(readline.__doc__)'
    Importing this module enables command line editing using GNU readline.

    https://docs.python.org/3/library/readline.html#module-readline

    @ned-deily
    Copy link
    Member

    Xiang Zhang, was that on macOS? If so, can someone try on one or more Linux systems with a Chinese locale? I see the same behavior on Linux but I'm not sure that I'm testing it properly.

    @zhangyangyu
    Copy link
    Member

    Yes, it's on MacOS. libedit and GNU deadline both have the behavior. I can see the same behavior on Ubuntu, LANG=en_US.UTF-8.

    @ned-deily
    Copy link
    Member

    So it's not a macOS-specific issue: editing the title et al accordingly

    @ned-deily ned-deily changed the title Chinese characters issue with input() function under Mac OSX Chinese characters issue with input() function May 30, 2018
    @vstinner
    Copy link
    Member

    New changeset f7a19c2 by Victor Stinner in branch '3.6':
    bpo-33692: pythoninfo detect libedit on Python 3.6 (GH-7244)
    f7a19c2

    @vstinner
    Copy link
    Member

    New changeset 9994eff by Victor Stinner in branch '2.7':
    bpo-33692: pythoninfo detect libedit on Python 2.7 (bpo-7246)
    9994eff

    @ValentinZhao
    Copy link
    Mannequin Author

    ValentinZhao mannequin commented May 31, 2018

    Hello everyone, do we have a walkaround for this issue now? I barely read your discussion.

    @ValentinZhao
    Copy link
    Mannequin Author

    ValentinZhao mannequin commented Jun 1, 2018

    Hey there! I saw your pull requests to python3.6 and have been merged, so what should we do now? Just update the python to higher a version?

    @vstinner
    Copy link
    Member

    vstinner commented Jun 1, 2018

    Hey there! I saw your pull requests to python3.6 and have been merged, so what should we do now? Just update the python to higher a version?

    Oh. My changes are just to add debug traces in the "python3 -m test.pythoninfo" command which is used on buildbots, Travis CI and AppVeyor to ease debug when a test fails.

    It's not a fix.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 1, 2018

    New changeset ef634b5 by Victor Stinner in branch 'master':
    bpo-33692: pythoninfo detect libedit on Python 3.6 (GH-7293)
    ef634b5

    @vstinner
    Copy link
    Member

    vstinner commented Jun 1, 2018

    New changeset b9afe64 by Victor Stinner in branch '3.6':
    bpo-33692: Update pythoninfo from master (GH-7301)
    b9afe64

    @vstinner
    Copy link
    Member

    vstinner commented Jun 1, 2018

    New changeset 466aae5 by Victor Stinner in branch '3.7':
    bpo-33692: Update pythoninfo from master (GH-7298)
    466aae5

    @vstinner
    Copy link
    Member

    vstinner commented Jun 1, 2018

    New changeset 0f64262 by Victor Stinner in branch '2.7':
    bpo-33692: Update pythoninfo from master (GH-7304)
    0f64262

    @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
    OS-mac type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants