Repository navigation
Test failures with Python 3.14 alpha 6 #14858
Copy link
Copy link
Labels
Description
We've started building and testing ipython with Python 3.14 alpha 6 and there are some test failures:
_____________ ERROR at teardown of TestAstTransform2.test_run_cell _____________
self = <IPython.core.tests.test_interactiveshell.TestAstTransform2 testMethod=test_run_cell>
def tearDown(self):
> ip.ast_transformers.remove(self.intwrapper)
E ValueError: list.remove(x): x not in list
core/tests/test_interactiveshell.py:850: ValueError
______________ ERROR at teardown of TestAstTransform2.test_timeit ______________
self = <IPython.core.tests.test_interactiveshell.TestAstTransform2 testMethod=test_timeit>
def tearDown(self):
> ip.ast_transformers.remove(self.intwrapper)
E ValueError: list.remove(x): x not in list
core/tests/test_interactiveshell.py:850: ValueError
_________________________ AsyncTest.test_memory_error __________________________
self = <IPython.core.tests.test_async_helpers.AsyncTest testMethod=test_memory_error>
def test_memory_error(self):
"""
The pgen parser in 3.8 or before use to raise MemoryError on too many
nested parens anymore"""
> iprc("(" * 200 + ")" * 200)
core/tests/test_async_helpers.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
core/tests/test_async_helpers.py:23: in iprc
return ip.run_cell(dedent(x)).raise_error()
core/interactiveshell.py:306: in raise_error
raise self.error_before_exec
core/interactiveshell.py:3308: in run_cell_async
code_ast = compiler.ast_parse(cell, filename=cell_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <IPython.core.compilerop.CachingCompiler object at 0x7fa2687d1940>
source = '(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\n'
filename = '<ipython-input-1-ab69bc0f135a>', symbol = 'exec'
def ast_parse(self, source, filename='<unknown>', symbol='exec'):
"""Parse code to an AST with the current compiler flags active.
Arguments are exactly the same as ast.parse (in the standard library),
and are passed to the built-in compile function."""
> return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)
E MemoryError: Parser stack overflowed - Python source too complex to parse
core/compilerop.py:86: MemoryError
----------------------------- Captured stdout call -----------------------------
MemoryError: Parser stack overflowed - Python source too complex to parse
______________________________ test_unicode_range ______________________________
def test_unicode_range():
"""
Test that the ranges we test for unicode names give the same number of
results than testing the full length.
"""
expected_list = _unicode_name_compute([(0, 0x110000)])
test = _unicode_name_compute(_UNICODE_RANGES)
len_exp = len(expected_list)
len_test = len(test)
# do not inline the len() or on error pytest will try to print the 130 000 +
# elements.
message = None
if len_exp != len_test or len_exp > 131808:
size, start, stop, prct = recompute_unicode_ranges()
message = f"""_UNICODE_RANGES likely wrong and need updating. This is
likely due to a new release of Python. We've find that the biggest gap
in unicode characters has reduces in size to be {size} characters
({prct}), from {start}, to {stop}. In completer.py likely update to
_UNICODE_RANGES = [(32, {start}), ({stop}, 0xe01f0)]
And update the assertion below to use
len_exp <= {len_exp}
"""
assert len_exp == len_test, message
# fail if new unicode symbols have been added.
> assert len_exp <= 143668, message
E AssertionError: _UNICODE_RANGES likely wrong and need updating. This is
E likely due to a new release of Python. We've find that the biggest gap
E in unicode characters has reduces in size to be 711762 characters
E (78%), from 0x323b0, to 0xe0001. In completer.py likely update to
E
E _UNICODE_RANGES = [(32, 0x323b0), (0xe0001, 0xe01f0)]
E
E And update the assertion below to use
E
E len_exp <= 148853
E
E assert 148853 <= 143668
core/tests/test_completer.py:129: AssertionError
_______________________ test_interruptible_core_debugger _______________________
self = <IPython.core.debugger.InterruptiblePdb object at 0x7fa2643c5550>
context = 0
def print_stack_trace(self, context=None):
Colors = self.color_scheme_table.active_colors
ColorsNormal = Colors.Normal
if context is None:
context = self.context
try:
context = int(context)
if context <= 0:
> raise ValueError("Context must be a positive integer")
E ValueError: Context must be a positive integer
core/debugger.py:496: ValueError
The above exception was the direct cause of the following exception:
def test_interruptible_core_debugger():
"""The debugger can be interrupted.
The presumption is there is some mechanism that causes a KeyboardInterrupt
(this is implemented in ipykernel). We want to ensure the
KeyboardInterrupt cause debugging to cease.
"""
def raising_input(msg="", called=[0]):
called[0] += 1
assert called[0] == 1, "input() should only be called once!"
raise KeyboardInterrupt()
tracer_orig = sys.gettrace()
try:
with patch.object(builtins, "input", raising_input):
> debugger.InterruptiblePdb().set_trace()
core/tests/test_debugger.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.14/bdb.py:118: in trace_dispatch
return self.dispatch_opcode(frame, arg)
/usr/lib64/python3.14/bdb.py:223: in dispatch_opcode
self.user_opcode(frame)
/usr/lib64/python3.14/pdb.py:460: in user_line
self.interaction(frame, None)
core/debugger.py:466: in interaction
OldPdb.interaction(self, frame, tb_or_exc)
/usr/lib64/python3.14/pdb.py:640: in interaction
self._cmdloop()
core/debugger.py:1119: in _cmdloop
self.cmdloop()
core/debugger.py:1105: in cmdloop
return OldPdb.cmdloop(self, intro=intro)
/usr/lib64/python3.14/cmd.py:149: in cmdloop
stop = self.onecmd(line)
/usr/lib64/python3.14/pdb.py:878: in onecmd
return getattr(self, command)(arg)
/usr/lib64/python3.14/pdb.py:1035: in _pdbcmd_print_frame_status
self.print_stack_trace(0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <IPython.core.debugger.InterruptiblePdb object at 0x7fa2643c5550>
context = 0
def print_stack_trace(self, context=None):
Colors = self.color_scheme_table.active_colors
ColorsNormal = Colors.Normal
if context is None:
context = self.context
try:
context = int(context)
if context <= 0:
raise ValueError("Context must be a positive integer")
except (TypeError, ValueError) as e:
> raise ValueError("Context must be a positive integer") from e
E ValueError: Context must be a positive integer
core/debugger.py:498: ValueError
_______________________________ test_xmode_skip ________________________________
@skip_win32
def test_xmode_skip():
"""that xmode skip frames
Not as a doctest as pytest does not run doctests.
"""
import pexpect
env = os.environ.copy()
env["IPY_TEST_SIMPLE_PROMPT"] = "1"
child = pexpect.spawn(
sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
)
child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
child.expect("IPython")
child.expect("\n")
child.expect_exact("In [1]")
block = dedent(
"""
def f():
__tracebackhide__ = True
g()
def g():
raise ValueError
f()
"""
)
for line in block.splitlines():
child.sendline(line)
child.expect_exact(line)
child.expect_exact("skipping")
block = dedent(
"""
def f():
__tracebackhide__ = True
g()
def g():
from IPython.core.debugger import set_trace
set_trace()
f()
"""
)
for line in block.splitlines():
child.sendline(line)
child.expect_exact(line)
> child.expect("ipdb>")
core/tests/test_debugger.py:301:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:354: in expect
return self.expect_list(compiled_pattern_list,
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:383: in expect_list
return exp.expect_loop(timeout)
/usr/lib/python3.14/site-packages/pexpect/expect.py:181: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x7fa266cd4850>
err = TIMEOUT('Timeout exceeded.')
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x7fa2643c6a50>
E command: /usr/bin/python3
E args: ['/usr/bin/python3', '-m', 'IPython', '--colors=nocolor']
E buffer (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [7]: '
E before (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [7]: '
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 4339
E child_fd: 17
E closed: False
E timeout: 60.0
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile(b'ipdb>')
/usr/lib/python3.14/site-packages/pexpect/expect.py:144: TIMEOUT
____________________________ test_where_erase_value ____________________________
@skip_win32
def test_where_erase_value():
"""Test that `where` does not access f_locals and erase values."""
import pexpect
env = os.environ.copy()
env["IPY_TEST_SIMPLE_PROMPT"] = "1"
child = pexpect.spawn(
sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
)
child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
child.expect("IPython")
child.expect("\n")
child.expect_exact("In [1]")
block = dedent(
"""
def simple_f():
myvar = 1
print(myvar)
1/0
print(myvar)
simple_f() """
)
for line in block.splitlines():
child.sendline(line)
child.expect_exact(line)
child.expect_exact("ZeroDivisionError")
child.expect_exact("In [2]:")
child.sendline("%debug")
##
> child.expect("ipdb>")
core/tests/test_debugger.py:564:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:354: in expect
return self.expect_list(compiled_pattern_list,
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:383: in expect_list
return exp.expect_loop(timeout)
/usr/lib/python3.14/site-packages/pexpect/expect.py:181: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x7fa26521d160>
err = TIMEOUT('Timeout exceeded.')
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x7fa264e19450>
E command: /usr/bin/python3
E args: ['/usr/bin/python3', '-m', 'IPython', '--colors=nocolor']
E buffer (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [3]: '
E before (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [3]: '
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 4341
E child_fd: 18
E closed: False
E timeout: 60.0
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile(b'ipdb>')
/usr/lib/python3.14/site-packages/pexpect/expect.py:144: TIMEOUT
_______________________ TestAstTransform2.test_run_cell ________________________
self = <IPython.core.tests.test_interactiveshell.TestAstTransform2 testMethod=test_run_cell>
def test_run_cell(self):
ip.run_cell("n = 2")
> self.assertEqual(self.calls, [(2,)])
E AssertionError: Lists differ: [] != [(2,)]
E
E Second list contains 1 additional elements.
E First extra element 0:
E (2,)
E
E - []
E + [(2,)]
core/tests/test_interactiveshell.py:855: AssertionError
________________________ TestAstTransform2.test_timeit _________________________
self = <IPython.core.tests.test_interactiveshell.TestAstTransform2 testMethod=test_timeit>
def test_timeit(self):
called = set()
def f(x):
called.add(x)
ip.push({'f':f})
with tt.AssertPrints("std. dev. of"):
ip.run_line_magic("timeit", "-n1 f(1)")
> self.assertEqual(called, {(1,)})
E AssertionError: Items in the first set but not the second:
E 1
E Items in the second set but not the first:
E (1,)
core/tests/test_interactiveshell.py:873: AssertionError
__________________________ test_render_signature_long __________________________
def test_render_signature_long():
from typing import Optional
def long_function(
a_really_long_parameter: int,
and_another_long_one: bool = False,
let_us_make_sure_this_is_looong: Optional[str] = None,
) -> bool: pass
sig = oinspect._render_signature(
signature(long_function),
long_function.__name__,
)
expected = """\
long_function(
a_really_long_parameter: int,
and_another_long_one: bool = False,
let_us_make_sure_this_is_looong: Optional[str] = None,
) -> bool\
"""
> assert sig == expected
E AssertionError: assert 'long_functio...e,\n) -> bool' == 'long_functio...e,\n) -> bool'
E
E Skipping 116 identical leading characters in diff, use -v to show
E - s_looong: Optional[str] = None,
E + s_looong: str | None = None,
E ) -> bool
core/tests/test_oinspect.py:589: AssertionError
__________________ test_debug_magic_passes_through_generators __________________
@skip_win32
def test_debug_magic_passes_through_generators():
"""
This test that we can correctly pass through frames of a generator post-mortem.
"""
import pexpect
import re
in_prompt = re.compile(br'In ?\[\d+\]:')
ipdb_prompt = 'ipdb>'
env = os.environ.copy()
child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
env=env)
child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
child.expect(in_prompt)
child.timeout = 2 * IPYTHON_TESTING_TIMEOUT_SCALE
child.sendline("def f(x):")
child.sendline(" raise Exception")
child.sendline("")
child.expect(in_prompt)
child.sendline("gen = (f(x) for x in [0])")
child.sendline("")
child.expect(in_prompt)
child.sendline("for x in gen:")
child.sendline(" pass")
child.sendline("")
child.timeout = 10 * IPYTHON_TESTING_TIMEOUT_SCALE
child.expect('Exception:')
child.expect(in_prompt)
child.sendline(r'%debug')
> child.expect('----> 2 raise Exception')
terminal/tests/test_debug_magic.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:354: in expect
return self.expect_list(compiled_pattern_list,
/usr/lib/python3.14/site-packages/pexpect/spawnbase.py:383: in expect_list
return exp.expect_loop(timeout)
/usr/lib/python3.14/site-packages/pexpect/expect.py:181: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x7fa257d1be70>
err = TIMEOUT('Timeout exceeded.')
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x7fa266f60a50>
E command: /usr/bin/python3
E args: ['/usr/bin/python3', '-m', 'IPython', '--colors=nocolor', '--simple-prompt']
E buffer (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [5]: '
E before (last 100 chars): b'\n 499 try:\r\n 500 skipped = 0\r\n\r\nValueError: Context must be a positive integer\r\n\r\nIn [5]: '
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 4413
E child_fd: 57
E closed: False
E timeout: 40.0
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile(b'----> 2 raise Exception')
/usr/lib/python3.14/site-packages/pexpect/expect.py:144: TIMEOUT
_____________________________ test_eval_formatter ______________________________
def test_eval_formatter():
f = text.EvalFormatter()
> eval_formatter_check(f)
utils/tests/test_text.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
utils/tests/test_text.py:167: in eval_formatter_check
s = f.format("{[n//i for i in range(1,8)]}", **ns)
/usr/lib64/python3.14/string.py:190: in format
return self.vformat(format_string, args, kwargs)
/usr/lib64/python3.14/string.py:194: in vformat
result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
/usr/lib64/python3.14/string.py:235: in _vformat
obj, arg_used = self.get_field(field_name, args, kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <IPython.utils.text.EvalFormatter object at 0x7fa27fb096a0>
name = '0[n//i for i in range(1,8)]', args = ()
kwargs = {'__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'Attribute...ributeError'>, 'BaseException': <class 'BaseException'>, ...}, 'b': 'café', 'n': 12, 'os': <module 'os' (frozen)>, ...}
def get_field(self, name: str, args: Any, kwargs: Any) -> Tuple[Any, str]:
> v = eval(name, kwargs)
E File "<string>", line 1
E 0[n//i for i in range(1,8)]
E ^^^
E SyntaxError: invalid syntax
utils/text.py:547: SyntaxError
Some of them look easy to fix, but others will require deeper investigation.
Activity
Carreau commentedon Apr 3, 2025
Thanks for doing this, the MemoryError seem to maybe be a Python issue as it tests an issue we had with CPython parser that was fixed in 3.9.
Carreau commentedon Apr 3, 2025
Also I expect the two failures in teardown to be fixed once the corresponding tests are passing.
frenzymadness commentedon Aug 19, 2025
Python 3.14 is in the release candidate state, and the final release is expected in October.
frenzymadness commentedon Aug 19, 2025
Log from the latest build:
Carreau commentedon Aug 19, 2025
i'm on parental leave until october, so will likely not get to it until then. Unless this is critical then I can try to carve some time in september.
frenzymadness commentedon Aug 20, 2025
Thank you for your openness.
krassowski commentedon Aug 20, 2025
I will take a stab at fixing some of the failures this week.
krassowski commentedon Aug 20, 2025
On one level we are blocked by jedi/parso:
Support Python 3.14.0rc2, test on CI (#14967)