Bug 2247091

Summary: ptpython errors on startup
Product: [Fedora] Fedora Reporter: Seirdy <fedora>
Component: ptpythonAssignee: Carl George 🤠 <carl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 39CC: carl, code, python-packagers-sig
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: ptpython-3.0.23-1.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-10 01:45:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Seirdy 2023-10-30 16:05:54 UTC
ptpython on Fedora 39 fails to start, with the following error:

```
 Traceback (most recent call last):
  File "/usr/bin/ptpython", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/usr/lib/python3.12/site-packages/ptpython/entry_points/run_ptpython.py", line 206, in run
    embed(
  File "/usr/lib/python3.12/site-packages/ptpython/repl.py", line 713, in embed
    repl = PythonRepl(
           ^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ptpython/repl.py", line 78, in __init__
    super().__init__(*a, **kw)
  File "/usr/lib/python3.12/site-packages/ptpython/python_input.py", line 375, in __init__
    self.ptpython_layout = PtPythonLayout(
                           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ptpython/layout.py", line 665, in __init__
    signature_toolbar(python_input),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ptpython/layout.py", line 298, in signature_toolbar
    HasSignature(python_input) &
  File "/usr/lib/python3.12/site-packages/prompt_toolkit/filters/base.py", line 40, in __and__
    if other in self._and_cache:
                ^^^^^^^^^^^^^^^
AttributeError: 'HasSignature' object has no attribute '_and_cache'
```

Reproducible: Always

Steps to Reproduce:
1. Launch `/usr/bin/ptpython`



Appears to have been fixed in https://github.com/prompt-toolkit/ptpython/commit/1b7652d3f2fd35ea96789df60063516503811e68.

`@music:fedora.im` on Matrix claims that upgrading the package to 3.0.23 should fix the issue.

Comment 1 Ben Beasley 2023-10-30 16:14:29 UTC
I just did a quick experiment to check my claim, which was based on reading source code.

$ mock -r fedora-39-x86_64 --clean
$ mock -r fedora-39-x86_64 -i ptpython
$ mock -r fedora-39-x86_64 --chroot 'ptpython'
(same traceback reported above)

In a checkout of the rawhide branch from dist-git:
$ fedpkg --release f39 mockbuild
$ mock -r fedora-39-x86_64 --clean
$ mock -r fedora-39-x86_64 -i results_ptpython/3.0.23/1.fc39/ptpython3-3.0.23-1.fc39.noarch.rpm
$ mock -r fedora-39-x86_64 --chroot 'ptpython'
Warning: Input is not a terminal (fd=0).
$ mock -r fedora-39-x86_64 --shell
# ptpython
(expected interactive session)

So it looks like updating to 3.0.23 should indeed be a fix.

Comment 2 Fedora Update System 2023-11-01 20:05:50 UTC
FEDORA-2023-399d0c5963 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-399d0c5963

Comment 3 Fedora Update System 2023-11-02 01:49:02 UTC
FEDORA-2023-399d0c5963 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-399d0c5963`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-399d0c5963

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2023-11-10 01:45:25 UTC
FEDORA-2023-399d0c5963 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.