Bug 2347496

Summary: ipython needs update to >=8.29.0 to be able to print regex in Py3.13
Product: [Fedora] Fedora Reporter: Alicia Boya García <ntrrgc>
Component: ipythonAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 41CC: epel-packagers-sig, lbalhar, mhroncok, michel, mrunge, orion, python-packagers-sig
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: All   
OS: Linux   
URL: https://github.com/ipython/ipython/pull/14559
Whiteboard:
Fixed In Version: ipython-8.26.0-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-27 01:59:00 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 Alicia Boya García 2025-02-25 10:00:12 UTC
re.TEMPLATE was removed in Python 3.13: https://github.com/python/cpython/issues/92728

Unfortunately, IPython only stopped relying on it very recently: commit f7a09f5f5fe52740825acf5a72a427922eb48dbe (Oct 24 2024).

The oldest IPython version with the fix is 8.29.0, but Fedora is shipping 8.26.0.

The bug causes an exception to be thrown when the IPython repr() of a regular expression is generated.

pip install ipython==8.29.0 works around this issue.

Reproducible: Always

Steps to Reproduce:
1. Launch ipython.
2. import re
3. re.compile('foo')
Actual Results:  
File /usr/lib/python3.13/site-packages/IPython/lib/pretty.py:729, in _ReFlags._repr_pretty_(self, p, cycle)
    726 done_one = False
    727 for flag in ('TEMPLATE', 'IGNORECASE', 'LOCALE', 'MULTILINE', 'DOTALL',
    728     'UNICODE', 'VERBOSE', 'DEBUG'):
--> 729     if self.value & getattr(re, flag):
    730         if done_one:
    731             p.text('|')

AttributeError: module 're' has no attribute 'TEMPLATE'

Expected Results:  
Out[2]: re.compile(r'foo', re.UNICODE)

Comment 1 Miro Hrončok 2025-02-25 10:25:54 UTC
I can reproduce this.

Comment 2 Fedora Update System 2025-02-25 12:00:28 UTC
FEDORA-2025-dc0074871f (ipython-8.26.0-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-dc0074871f

Comment 3 Fedora Update System 2025-02-26 02:34:03 UTC
FEDORA-2025-dc0074871f has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-dc0074871f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-dc0074871f

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

Comment 4 Fedora Update System 2025-02-27 01:59:00 UTC
FEDORA-2025-dc0074871f (ipython-8.26.0-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.