GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Warning on autocomplete messes up the terminal · Issue #119205 · python/cpython

Warning on autocomplete messes up the terminal #119205

New issue
Copy link
New issue
Copy link
Closed
Closed
Warning on autocomplete messes up the terminal#119205
Copy link
Labels
3.13only security fixesonly security fixestopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@JelleZijlstra
JelleZijlstra
opened on May 20, 2024
Issue body actions

Bug report

Bug description:

  1. Open ./python.exe
  2. import sys; code = sys._getframe(1).f_code
  3. Type code.co_ and hit tab
  4. This:
Screenshot 2024-05-20 at 6 52 31 AM

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

  • gh-119205: Fix autocompletion bug in new repl #119229
  • [3.13] gh-119205: Fix autocompletion bug in new repl (GH-119229) #119407

Activity

  1. JelleZijlstra
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.13only security fixesonly security fixes
    topic-replRelated to the interactive shellRelated to the interactive shell
    on May 20, 2024
  2. eugenetriguba commented on May 20, 2024

    @eugenetriguba
    eugenetriguba
    on May 20, 2024
    Contributor
    More actions

    @JelleZijlstra Are you handling this or do you mind if I take a look into this? 🙂

  3. JelleZijlstra commented on May 20, 2024

    @JelleZijlstra
    JelleZijlstra
    on May 20, 2024
    MemberAuthor
    More actions

    I'm not, feel free to take a look!

    Reacted by Eugene Triguba
  4. eugenetriguba commented on May 20, 2024

    @eugenetriguba
    eugenetriguba
    on May 20, 2024
    Contributor
    More actions

    fwiw, this looks to be an issue with any output:

    >>> import tarfile
    >>> t = tarfile.TarInfo()
    >>> t.tarfile.T<string>:1: DeprecationWarning: The undocumented "tarfile" attribute of TarInfo objects is deprecated and will be removed in Python 3.16
    

    I ran into a similar issue when bringing up pdb:

     % ./python.exe
    Python 3.14.0a0 (heads/main:16b46ebd2b, May 20 2024, 08:24:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> os.> /Users/eugene/src/cpython/Lib/rlcompleter.py(76)complete()
                                                                       -> breakpoint()
                                                                                      (Pdb) l
    
  5. jima80525 commented on May 20, 2024

    @jima80525
    jima80525
    on May 20, 2024
    More actions

    Just found that this happens on mac, but not ubuntu. New repl doesn't have a windows version with autocomplete.

  6. koxudaxi commented on May 20, 2024

    @koxudaxi
    koxudaxi
    on May 20, 2024
    Contributor
    More actions

    mac uses /usr/lib/libedit.3.dylib for readline
    But, ubuntu uses libreadline.so.8 of GNU.

    dyld_info Modules/readline.cpython-314d-darwin.so 
    Modules/readline.cpython-314d-darwin.so [arm64]:
        -platform:
            platform     minOS      sdk
               macOS     14.4      14.4   
        -segments:
            load-offset   segment section        sect-size  seg-size perm
            0x00000000    __TEXT                                32KB r.x
            0x00004110             __text             9476
            0x00006614             __stubs             948
            0x000069C8             __stub_helper       972
            0x00006D94             __cstring          1194
            0x00007240             __const            3296
            0x00007F20             __unwind_info       224
            0x00008000    __DATA_CONST                          16KB rw.
            0x00008000             __got               224
            0x0000C000    __DATA                                16KB rw.
            0x0000C000             __la_symbol_ptr     632
            0x0000C278             __data              984
            0x0000C650             __bss                32
        -dependents:
            attributes     load path
                           /usr/lib/libedit.3.dylib
                           /usr/lib/libSystem.B.dylib
    
  7. koxudaxi commented on May 20, 2024

    @koxudaxi
    koxudaxi
    on May 20, 2024
    Contributor
    More actions

    I re-build with GNU readline lib. But, The bug reproduce :(

    brew install readline
    export LDFLAGS="-L/opt/homebrew/opt/readline/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/readline/include"
    ./configure --with-pydebug --with-readline=readline
    ...
    
    dyld_info Modules/readline.cpython-314d-darwin.so 
    Modules/readline.cpython-314d-darwin.so [arm64]:
        -platform:
            platform     minOS      sdk
               macOS     14.4      14.4   
        -segments:
            load-offset   segment section        sect-size  seg-size perm
            0x00000000    __TEXT                                32KB r.x
            0x00003E10             __text             9928
            0x000064D8             __stubs            1008
            0x000068C8             __stub_helper      1032
            0x00006CD0             __cstring          1214
            0x00007190             __const            3456
            0x00007F10             __unwind_info       232
            0x00008000    __DATA_CONST                          16KB rw.
            0x00008000             __got               240
            0x0000C000    __DATA                                16KB rw.
            0x0000C000             __la_symbol_ptr     672
            0x0000C2A0             __data             1016
            0x0000C698             __bss                40
        -dependents:
            attributes     load path
                           /opt/homebrew/opt/readline/lib/libreadline.8.dylib
                           /usr/lib/libSystem.B.dylib
    
  8. eugenetriguba commented on May 20, 2024

    @eugenetriguba
    eugenetriguba
    on May 20, 2024
    Contributor
    More actions

    I tried this with pypy and wasn't able to get this output with the latest version:

    ~ % pypy
    Python 3.10.14 (75b3de9d9035, Apr 21 2024, 10:55:50)
    [PyPy 7.3.16 with GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>>> import sys; code = sys._getframe(1).f_code
    code.co_argcount         code.co_filename         code.co_kwonlyargcount   code.co_name             code.co_stacksize
    code.co_cellvars         code.co_firstlineno      code.co_lines()          code.co_names            code.co_varnames
    code.co_code             code.co_flags            code.co_linetable        code.co_nlocals
    code.co_consts           code.co_freevars         code.co_lnotab           code.co_posonlyargcount
    >>>> code.co_
    

    But I'm not sure pypy has that deprecation warning in this codepath so I'll check that.

  9. koxudaxi
    added 2 commits that reference this issue on May 20, 2024

    pythongh-119205: Fix autocompletion bug in new repl

    8a0241f

    pythongh-119205: Add unittest

    f9ee809
  10. danielhollas commented on May 20, 2024

    @danielhollas
    danielhollas
    on May 20, 2024
    Contributor
    More actions

    Hmm, it seems that similar behaviour exists on the old terminal as well though.

    EDIT: Similar issue for the old REPL
    #113978

  11. koxudaxi
    added 3 commits that reference this issue on May 20, 2024

    pythongh-119205: revert unnecessary changes

    241e634

    pythongh-119205: revert unnecessary changes

    e5f1575

    pythongh-119205: Improve unittest

    b2f1b02
  12. koxudaxi commented on May 20, 2024

    @koxudaxi
    koxudaxi
    on May 20, 2024
    Contributor
    More actions

    @danielhollas
    Thank you for sharing the issue.
    I think it's the same root cause.

    We should think about the direction of the solution.

  13. koxudaxi
    added a commit that references this issue on May 20, 2024

    pythongh-119205: Improve suppression warning

    6509c29
  14. eugenetriguba commented on May 21, 2024

    @eugenetriguba
    eugenetriguba
    on May 21, 2024
    Contributor
    More actions

    @koxudaxi Would this also resolve this issue? https://github.com/python/cpython/pull/113979/files

  15. koxudaxi commented on May 21, 2024

    @koxudaxi
    koxudaxi
    on May 21, 2024
    Contributor
    More actions

    @eugenetriguba
    I think so. We confirmed that the problem will only happen with MacOS.
    But, the solution works for all environments.
    Should I close my PR as a duplicate?

  16. ambv commented on May 21, 2024

    @ambv
    ambv
    on May 21, 2024
    Contributor
    More actions

    @koxudaxi, sign the CLA and I think we will still take your PR as it includes a test.

    Reacted by Eugene Triguba
  17. ambv
    added a commit that references this issue on May 21, 2024

    gh-119205: Fix autocompletion bug in new repl (#119229)

    506b1a3
  18. miss-islington
    added a commit that references this issue on May 22, 2024

    pythongh-119205: Fix autocompletion bug in new repl (pythonGH-119229)

    9dd2ae8
  19. lysnikolaou
    added a commit that references this issue on May 22, 2024

    [3.13] gh-119205: Fix autocompletion bug in new repl (GH-119229) (#11…

    eafd633
  20. lysnikolaou commented on May 22, 2024

    @lysnikolaou
    lysnikolaou
    on May 22, 2024
    Member
    More actions

    Thanks all for the input and @koxudaxi for the PR.

    Reacted by Koudai Aono
  21. lysnikolaou
    closed this as completedon May 22, 2024
  22. estyxx
    added a commit that references this issue on Jul 17, 2024

    pythongh-119205: Fix autocompletion bug in new repl (python#119229)

    7728f85
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

    3.13only security fixesonly security fixestopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.