Skip to content

py/repl: Skip private variables when printing tab completion options. #17108

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/cmdline/repl_autocomplete_underscore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Test REPL autocompletion for underscore attributes in frozen modules

try:
import asyncio
except ImportError:
print("SKIP")
raise SystemExit

# Simulate typing 'asyncio.' and pressing tab
# The tab character after `asyncio.` below triggers the completion
asyncio. t
26 changes: 26 additions & 0 deletions tests/cmdline/repl_autocomplete_underscore.py.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
MicroPython v1.25.0-preview.532.g8c012467d7 on 2025-04-10; linux [GCC 14.2.1] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> # Test REPL autocompletion for underscore attributes in frozen modules
>>>
>>> try:
...  import asyncio
... except ImportError:
... print("SKIP")
... raise SystemExit
...
>>> # Simulate typing 'asyncio.' and pressing tab
>>> # The tab character after `asyncio.` below triggers the completion
>>> asyncio.
CancelledError Task TaskQueue __dict__
__file__ __path__ cur_task lock
select sleep sleep_ms sys
ticks_add ticks_diff IOQueue Lock
Loop SingletonGenerator StreamReader
StreamWriter TimeoutError __version__ core
create_task current_task funcs gather
get_event_loop new_event_loop open_connection
run run_until_complete start_server
stream ticks wait_for wait_for_ms
>>> asyncio.ticks
<function>
>>>
Loading