Skip to content

Commit ee5694f

Browse files
committed
py/repl: Skip private variables when printing tab completion options.
Any '_' variables/functions in frozen modules are currently printed. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent ef8282c commit ee5694f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Test REPL autocompletion for underscore attributes in frozen modules
2+
3+
try:
4+
import asyncio
5+
except ImportError:
6+
print("SKIP")
7+
raise SystemExit
8+
9+
# Simulate typing 'asyncio.' and pressing tab
10+
# The tab character after `asyncio.` below triggers the completion
11+
asyncio. t
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
MicroPython v1.25.0-preview.532.g8c012467d7 on 2025-04-10; linux [GCC 14.2.1] version
2+
Use Ctrl-D to exit, Ctrl-E for paste mode
3+
>>> # Test REPL autocompletion for underscore attributes in frozen modules
4+
>>>
5+
>>> try:
6+
...  import asyncio
7+
... except ImportError:
8+
... print("SKIP")
9+
... raise SystemExit
10+
...
11+
>>> # Simulate typing 'asyncio.' and pressing tab
12+
>>> # The tab character after `asyncio.` below triggers the completion
13+
>>> asyncio.
14+
CancelledError Task TaskQueue __dict__
15+
__file__ __path__ cur_task lock
16+
select sleep sleep_ms sys
17+
ticks_add ticks_diff IOQueue Lock
18+
Loop SingletonGenerator StreamReader
19+
StreamWriter TimeoutError __version__ core
20+
create_task current_task funcs gather
21+
get_event_loop new_event_loop open_connection
22+
run run_until_complete start_server
23+
stream ticks wait_for wait_for_ms
24+
>>> asyncio.ticks
25+
<function>
26+
>>>

0 commit comments

Comments
 (0)