Skip to content

Pasting a function definition does not work in 3.13 REPL with Windows Terminal #124096

Closed
@japageth

Description

@japageth

Bug report

Bug description:

I use Python downloaded from python.org without using a graphical environment such as IPython. Instead, I use the Windows Terminal with the REPL built into python.exe. In 3.12.6, I can paste a function definition copied from a text editor directly into the REPL and everything works fine. In 3.13.rc2 this does not work; the indentation is all messed up and I get an IndentationError.

def letter_colors(word, guess):
    '''Compute letter colors for Wordle guesses.  B=black Y=yellow G=green'''
    if (n := len(word)) != len(guess):
        raise ValueError('Word and guess must be the same length.')
    result = ['G' if wl == gl else 'B' for (wl, gl) in zip(word, guess)]
    unused = [w for (w, r) in zip(word, result) if r == 'B']
    for i, c in enumerate(guess):
        if result[i] != 'G' and c in unused:
            result[i] = 'Y'
            unused.remove(c)
    return ''.join(result)

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixesOS-windowsstdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions