Skip to content

Commit 53bc12d

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 f315a37 commit 53bc12d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/repl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static void print_completions(const mp_print_t *print,
218218
for (qstr q = q_first; q <= q_last; ++q) {
219219
size_t d_len;
220220
const char *d_str = (const char *)qstr_data(q, &d_len);
221-
if (s_len <= d_len && strncmp(s_start, d_str, s_len) == 0) {
221+
if (s_len <= d_len && strncmp(s_start, d_str, s_len) == 0 && d_str[0] != '_') {
222222
if (test_qstr(obj, q)) {
223223
int gap = (line_len + WORD_SLOT_LEN - 1) / WORD_SLOT_LEN * WORD_SLOT_LEN - line_len;
224224
if (gap < 2) {

0 commit comments

Comments
 (0)