Skip to content

The REPL corrupts and redacts pasted tab-indented code. #159478

Closed as duplicate

Description

@beedell-roke

Bug report

What My Environment Is

NAME: python3
VERSION: 3.14.8
RELEASE: 1.fc44
ARCH: x86_64
INSTALLTIME: '2026-10-09T11:34:23Z'
SIZE: 29352
SIGPGP: null
SOURCERPM: python3.14-3.14.8-1.fc44.src.rpm
BUILDTIME: '2026-10-01T23:42:52Z'
BUILDHOST: buildhw-x86-17.rdu3.fedoraproject.org
PACKAGER: Fedora Project
VENDOR: Fedora Project

What The Problem Is

As I first noticed at discuss.python.org/t/108891, when I invoke python3, whether in konsole or warp-terminal (irrespective of whether first invoked in another shell, like powershell, or bash), if the terminal emulator's window is short, the first few lines, of code that I paste into it, are redacted from the pasted output:

Python 3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
























... properties = {}
... for name in tags:
...     value = header[
...             getattr(
...                     rpm,
...                     f"RPMTAG_{name}"
...             )
...     ]
...     if name in (
...             "INSTALLTIME",
...             "BUILDTIME"
...     ):
...             value = (
...                     datetime.fromtimestamp(
...                             value,
...                             timezone.utc
...                     )
...                     .isoformat(timespec="seconds")
...                     .replace(
...                             "+00:00",
...                             "Z"
...                     )
...             )
...     properties[name] = value
... print(
...     yaml.safe_dump(
...             properties,
...             sort_keys=False,
...             default_flow_style=False,
...     )
... )
... 
NAME: signal-desktop
VERSION: 8.26.0
RELEASE: 1.fc44
ARCH: x86_64
INSTALLTIME: '2026-09-03T23:39:58Z'
SIZE: 430169042
SIGPGP: !!binary |
  wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
  cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
  hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
  Tgc=
SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
BUILDTIME: '2026-09-03T20:44:19Z'
BUILDHOST: 262b08a52583
PACKAGER: junefish <june@fyralabs.com>
VENDOR: Terra

>>>
Details Image

Otherwise, the indentation is corrupted:

Python 3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> #!/usr/bin/env python3
... import rpm, yaml
... from datetime import datetime, timezone
... from shutil import which
... package = which("signal-desktop")
... header = next(
...     rpm.TransactionSet().dbMatch(
   ...          "basenames",
          ...           package
                  ...   )
                   ... )
                   ... tags = (
                   ...  "NAME",
                   ...  "VERSION",
                   ...  "RELEASE",
                   ...  "ARCH",
                   ...  "INSTALLTIME",
                   ...  "SIZE",
                   ...  "SIGPGP",
                   ...  "SOURCERPM",
                   ...  "BUILDTIME",
                   ...  "BUILDHOST",
                   ...  "PACKAGER",
                   ...  "VENDOR",
                   ... )
                   ... properties = {}
                   ... for name in tags:
                   ...  value = header[
                   ...          getattr(
                          ...                   rpm,
                                         ...                    f"RPMTAG_{name}"
                                                         ...            )
                                                                  ...   ]
                                                                   ...  if name in (
                                                                   ...          "INSTALLTIME",
                                                                          ...           "BUILDTIME"
                                                                                  ...   ):
                                                                                   ...          value = (
                                                                                          ...                   datetime.fromtimestamp(
                                                                                                         ...                            value,
                                                                                                                                ...                             timezone.utc
                                                                                                                                                        ...                     )
                                                                                                                                                                         ...                    .isoformat(timespec="seconds")
                                                                                                                                                                                         ...                    .replace(
                                                                                                                                                                                                         ...                            "+00:00",
                                                                                                                                                                                                                                ...                             "Z"
                                                                                                                                                                                                                                                        ...                     )
                                                                                                                                                                                                                                                                         ...            )
                                                                                                                                                                                                                                                                                  ...   properties[name] = value
                                                                                                                                                                                                                                                                                   ... print(
                                                                                                                                                                                                                                                                                   ...  yaml.safe_dump(
                                                                                                                                                                                                                                                                                   ...          properties,
                                                                                                                                                                                                                                                                                          ...           sort_keys=False,
                                                                                                                                                                                                                                                                                                  ...           default_flow_style=False,
...     )
   ... )
   ... 
NAME: signal-desktop
VERSION: 8.26.0
RELEASE: 1.fc44
ARCH: x86_64
INSTALLTIME: '2026-09-03T23:39:58Z'
SIZE: 430169042
SIGPGP: !!binary |
  wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
  cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
  hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
  Tgc=
SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
BUILDTIME: '2026-09-03T20:44:19Z'
BUILDHOST: 262b08a52583
PACKAGER: junefish <june@fyralabs.com>
VENDOR: Terra

>>>
Details Image

Even worse, albeit potentially tangential, attempting to go back a command mangles the output further:

Image

However, it executes correctly, regardless.

The original, problematic code is:

#!/usr/bin/env python3
import rpm, yaml
from datetime import datetime, timezone
from shutil import which
package = which("signal-desktop")
header = next(
	rpm.TransactionSet().dbMatch(
		"basenames",
		package
	)
)
tags = (
	"NAME",
	"VERSION",
	"RELEASE",
	"ARCH",
	"INSTALLTIME",
	"SIZE",
	"SIGPGP",
	"SOURCERPM",
	"BUILDTIME",
	"BUILDHOST",
	"PACKAGER",
	"VENDOR",
)
properties = {}
for name in tags:
	value = header[
		getattr(
			rpm,
			f"RPMTAG_{name}"
		)
	]
	if name in (
		"INSTALLTIME",
		"BUILDTIME"
	):
		value = (
			datetime.fromtimestamp(
				value,
				timezone.utc
			)
			.isoformat(timespec="seconds")
			.replace(
				"+00:00",
				"Z"
			)
		)
	properties[name] = value
print(
	yaml.safe_dump(
		properties,
		sort_keys=False,
		default_flow_style=False,
	)
)

However, if one converts its indentative tabs into spaces:

Details
#!/usr/bin/env python3
import rpm, yaml
from datetime import datetime, timezone
from shutil import which
package = which("signal-desktop")
header = next(
  rpm.TransactionSet().dbMatch(
    "basenames",
    package
  )
)
tags = (
  "NAME",
  "VERSION",
  "RELEASE",
  "ARCH",
  "INSTALLTIME",
  "SIZE",
  "SIGPGP",
  "SOURCERPM",
  "BUILDTIME",
  "BUILDHOST",
  "PACKAGER",
  "VENDOR",
)
properties = {}
for name in tags:
  value = header[
    getattr(
      rpm,
      f"RPMTAG_{name}"
    )
  ]
  if name in (
    "INSTALLTIME",
    "BUILDTIME"
  ):
    value = (
      datetime.fromtimestamp(
        value,
        timezone.utc
      )
      .isoformat(timespec="seconds")
      .replace(
        "+00:00",
        "Z"
      )
    )
  properties[name] = value
print(
  yaml.safe_dump(
    properties,
    sort_keys=False,
    default_flow_style=False,
  )
)

…the code renders as expected:

Image

Triage

/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+interpreter+tab returned no relevant, pre-existent issues:

Image

CPython versions tested on:

3.14 3.15

Operating systems tested on:

Linux

Activity

  1. beedell-roke commented on Oct 15, 2026

    @beedell-roke
    Author

    python3.15-0:3.15.0~rc2-1.fc44.x86_64 fares little better, if at all:

    PowerShell 7.6.3-0-ga1994c19a0badf524d714cacffe7986c5c8613c6
    PS /home/beedell.roke_julian_lockhart> python3.15
    Python 3.15.0rc2 (3.15.0~rc2-1.fc44.x86_64, Sep  3 2026, 00:00:00) [GCC 16.2.1 20260819 (Red Hat 16.2.1-2)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ... ^I"VENDOR",
    ... )
    ... properties = {}
    ... for name in tags:
    ... ^Ivalue = header[
    ... ^I^Igetattr(
    ... ^I^I^Irpm,
    ... ^I^I^If"RPMTAG_{name}"
    ... ^I^I)
    ... ^I]
    ... ^Iif name in (
    ... ^I^I"INSTALLTIME",
    ... ^I^I"BUILDTIME"
    ... ^I):
    ... ^I^Ivalue = (
    ... ^I^I^Idatetime.fromtimestamp(
    ... ^I^I^I^Ivalue,
    ... ^I^I^I^Itimezone.utc
    ... ^I^I^I)
    ... ^I^I^I.isoformat(timespec="seconds")
    ... ^I^I^I.replace(
    ... ^I^I^I^I"+00:00",
    ... ^I^I^I^I"Z"
    ... ^I^I^I)
    ... ^I^I)
    ... ^Iproperties[name] = value
    ... print(
    ... ^Iyaml.safe_dump(
    ... ^I^Iproperties,
    ... ^I^Isort_keys=False,
    ... ^I^Idefault_flow_style=False,
    ... ^I)
    ... )
    ...

    My Environment

    NAME: python3.15
    VERSION: 3.15.0~rc2
    RELEASE: 1.fc44
    ARCH: x86_64
    INSTALLTIME: '2026-10-15T16:34:06Z'
    SIZE: 29358
    SIGPGP: null
    SOURCERPM: python3.15-3.15.0~rc2-1.fc44.src.rpm
    BUILDTIME: '2026-09-03T19:41:11Z'
    BUILDHOST: buildhw-x86-10.rdu3.fedoraproject.org
    PACKAGER: Fedora Project
    VENDOR: Fedora Project
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

    topic-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