Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b981b4

Browse files
committed
drop 3.11
1 parent c23e2ed commit 4b981b4

10 files changed

Lines changed: 11 additions & 66 deletions

File tree

IPython/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
#-----------------------------------------------------------------------------
2828

2929
# Don't forget to also update setup.py when this changes!
30-
if sys.version_info < (3, 11):
30+
if sys.version_info < (3, 12):
3131
raise ImportError(
3232
"""
33+
IPython 9.x supports Python 3.12 and above, following SPEC0
3334
IPython 8.31+ supports Python 3.11 and above, following SPEC0
3435
IPython 8.19+ supports Python 3.10 and above, following SPEC0.
3536
IPython 8.13+ supports Python 3.9 and above, following NEP 29.
36-
IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29.
3737
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
3838
Python 3.3 and 3.4 were supported up to IPython 6.x.
3939
Python 3.5 was supported with IPython 7.0 to 7.9.

IPython/core/completer.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@
243243

244244
from typing import cast
245245

246-
if sys.version_info < (3, 12):
247-
from typing_extensions import TypedDict, Protocol
248-
from typing import NotRequired, TypeAlias, TypeGuard
249-
else:
250-
from typing import TypedDict, NotRequired, Protocol, TypeAlias, TypeGuard
246+
from typing import TypedDict, NotRequired, Protocol, TypeAlias, TypeGuard
251247

252248

253249
# skip module docstests

IPython/core/guarded_eval.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
import types
3333
from typing import Self, LiteralString, get_type_hints
3434

35-
if sys.version_info < (3, 12):
36-
from typing_extensions import TypeAliasType
37-
else:
38-
from typing import TypeAliasType
35+
from typing import TypeAliasType
3936

4037

4138
@undoc

IPython/core/inputtransformer2.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -356,24 +356,8 @@ def transform(self, lines: List[str]):
356356
class SystemAssign(TokenTransformBase):
357357
"""Transformer for assignments from system commands (a = !foo)"""
358358
@classmethod
359-
def find_pre_312(cls, tokens_by_line):
360-
for line in tokens_by_line:
361-
assign_ix = _find_assign_op(line)
362-
if (assign_ix is not None) \
363-
and not line[assign_ix].line.strip().startswith('=') \
364-
and (len(line) >= assign_ix + 2) \
365-
and (line[assign_ix + 1].type == tokenize.ERRORTOKEN):
366-
ix = assign_ix + 1
367-
368-
while ix < len(line) and line[ix].type == tokenize.ERRORTOKEN:
369-
if line[ix].string == '!':
370-
return cls(line[ix].start)
371-
elif not line[ix].string.isspace():
372-
break
373-
ix += 1
374-
375-
@classmethod
376-
def find_post_312(cls, tokens_by_line):
359+
def find(cls, tokens_by_line):
360+
"""Find the first system assignment (a = !foo) in the cell."""
377361
for line in tokens_by_line:
378362
assign_ix = _find_assign_op(line)
379363
if (
@@ -385,13 +369,6 @@ def find_post_312(cls, tokens_by_line):
385369
):
386370
return cls(line[assign_ix + 1].start)
387371

388-
@classmethod
389-
def find(cls, tokens_by_line):
390-
"""Find the first system assignment (a = !foo) in the cell."""
391-
if sys.version_info < (3, 12):
392-
return cls.find_pre_312(tokens_by_line)
393-
return cls.find_post_312(tokens_by_line)
394-
395372
def transform(self, lines: List[str]):
396373
"""Transform a system assignment found by the ``find()`` classmethod.
397374
"""

IPython/core/interactiveshell.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,8 +2118,7 @@ def _get_exc_info(self, exc_tuple=None):
21182118
sys.last_type = etype
21192119
sys.last_value = value
21202120
sys.last_traceback = tb
2121-
if sys.version_info >= (3, 12):
2122-
sys.last_exc = value
2121+
sys.last_exc = value
21232122

21242123
return etype, value, tb
21252124

IPython/core/ultratb.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,11 +961,7 @@ def debugger(self, force: bool = False) -> None:
961961
self.pdb.botframe = etb.tb_frame
962962
# last_value should be deprecated, but last-exc sometimme not set
963963
# please check why later and remove the getattr.
964-
exc = (
965-
sys.last_value
966-
if sys.version_info < (3, 12)
967-
else getattr(sys, "last_exc", sys.last_value)
968-
) # type: ignore[attr-defined]
964+
exc = getattr(sys, "last_exc", sys.last_value)
969965
if exc:
970966
self.pdb.interaction(None, exc)
971967
else:

IPython/utils/text.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
)
2929
from collections.abc import Sequence, Mapping, Callable, Iterator
3030

31-
if sys.version_info < (3, 12):
32-
from typing import Self
33-
else:
34-
from typing import Self
31+
from typing import Self
3532

3633

3734
class LSString(str):

setup.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@
2323
#
2424
# This check is also made in IPython/__init__, don't forget to update both when
2525
# changing Python version requirements.
26-
if sys.version_info < (3, 11):
27-
pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
28-
try:
29-
import pip
30-
pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
31-
if pip_version < (9, 0, 1) :
32-
pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
33-
'pip {} detected.'.format(pip.__version__)
34-
else:
35-
# pip is new enough - it must be something else
36-
pip_message = ''
37-
except Exception:
38-
pass
3926

4027

4128
error = """

tests/test_guarded_eval.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232

3333
from typing import Self, LiteralString
3434

35-
if sys.version_info < (3, 12):
36-
from typing_extensions import TypeAliasType
37-
else:
38-
from typing import TypeAliasType
35+
from typing import TypeAliasType
3936

4037

4138
def create_context(evaluation: str, **kwargs):

tests/test_zzz_autoreload.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ class TestEnum(Enum):
396396
self.shell.run_code("assert func2() == 'changed'")
397397
self.shell.run_code("t = Test(); assert t.new_func() == 'changed'")
398398
self.shell.run_code("assert number == 1")
399-
if sys.version_info < (3, 12):
400-
self.shell.run_code("assert TestEnum.B.value == 'added'")
399+
self.shell.run_code("assert TestEnum.B.value == 'added'")
401400

402401
# ----------- TEST IMPORT FROM MODULE --------------------------
403402

0 commit comments

Comments
 (0)