From 4f5160da6ac3805c99917f6448de98460ea8668e Mon Sep 17 00:00:00 2001
From: ivasenkov15 <ivasenkov15@yandex-team.com>
Date: Tue, 23 Jan 2024 12:12:09 +0300
Subject: fix bank-applications: remove bank-forms usage

---
 .../python/ipython/py3/IPython/core/debugger.py    |  2 +-
 .../ipython/py3/IPython/core/interactiveshell.py   |  2 +-
 .../ipython/py3/IPython/core/magics/basic.py       |  2 +-
 contrib/python/ipython/py3/IPython/core/release.py |  2 +-
 .../py3/IPython/terminal/interactiveshell.py       | 32 +++++++++++++++-------
 .../python/ipython/py3/IPython/utils/_sysinfo.py   |  2 +-
 contrib/python/ipython/py3/IPython/utils/text.py   |  4 +--
 7 files changed, 29 insertions(+), 17 deletions(-)

(limited to 'contrib/python/ipython/py3/IPython')

diff --git a/contrib/python/ipython/py3/IPython/core/debugger.py b/contrib/python/ipython/py3/IPython/core/debugger.py
index 389592d066..f370070140 100644
--- a/contrib/python/ipython/py3/IPython/core/debugger.py
+++ b/contrib/python/ipython/py3/IPython/core/debugger.py
@@ -454,7 +454,7 @@ class Pdb(OldPdb):
                 with self._hold_exceptions(_chained_exceptions):
                     OldPdb.interaction(self, frame, tb)
             else:
-                OldPdb.interaction(self, frame, traceback)
+                OldPdb.interaction(self, frame, tb_or_exc)
 
         except KeyboardInterrupt:
             self.stdout.write("\n" + self.shell.get_exception_only())
diff --git a/contrib/python/ipython/py3/IPython/core/interactiveshell.py b/contrib/python/ipython/py3/IPython/core/interactiveshell.py
index 1a73571f78..fef5ddc949 100644
--- a/contrib/python/ipython/py3/IPython/core/interactiveshell.py
+++ b/contrib/python/ipython/py3/IPython/core/interactiveshell.py
@@ -3604,7 +3604,7 @@ class InteractiveShell(SingletonConfigurable):
     # Things related to GUI support and pylab
     #-------------------------------------------------------------------------
 
-    active_eventloop = None
+    active_eventloop: Optional[str] = None
 
     def enable_gui(self, gui=None):
         raise NotImplementedError('Implement enable_gui in a subclass')
diff --git a/contrib/python/ipython/py3/IPython/core/magics/basic.py b/contrib/python/ipython/py3/IPython/core/magics/basic.py
index 865e760eb1..3ac4049614 100644
--- a/contrib/python/ipython/py3/IPython/core/magics/basic.py
+++ b/contrib/python/ipython/py3/IPython/core/magics/basic.py
@@ -124,7 +124,7 @@ class BasicMagics(Magics):
           In [6]: %whereami
           Out[6]: '/home/testuser'
 
-          In [7]: %alias_magic h history "-p -l 30" --line
+          In [7]: %alias_magic h history -p "-l 30" --line
           Created `%h` as an alias for `%history -l 30`.
         """
 
diff --git a/contrib/python/ipython/py3/IPython/core/release.py b/contrib/python/ipython/py3/IPython/core/release.py
index 70d5a675a3..ec50c45721 100644
--- a/contrib/python/ipython/py3/IPython/core/release.py
+++ b/contrib/python/ipython/py3/IPython/core/release.py
@@ -16,7 +16,7 @@
 # release.  'dev' as a _version_extra string means this is a development
 # version
 _version_major = 8
-_version_minor = 19
+_version_minor = 20
 _version_patch = 0
 _version_extra = ".dev"
 # _version_extra = "rc1"
diff --git a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
index 532287f5e7..fcb816eb17 100644
--- a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
+++ b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
@@ -1,8 +1,8 @@
 """IPython terminal interface using prompt_toolkit"""
 
-import asyncio
 import os
 import sys
+import inspect
 from warnings import warn
 from typing import Union as UnionType, Optional
 
@@ -66,8 +66,8 @@ from .shortcuts.auto_suggest import (
 PTK3 = ptk_version.startswith('3.')
 
 
-class _NoStyle(Style): pass
-
+class _NoStyle(Style):
+    pass
 
 
 _style_overrides_light_bg = {
@@ -84,6 +84,20 @@ _style_overrides_linux = {
             Token.OutPromptNum: '#ansired bold',
 }
 
+
+def _backward_compat_continuation_prompt_tokens(method, width: int, *, lineno: int):
+    """
+    Sagemath use custom prompt and we broke them in 8.19.
+    """
+    sig = inspect.signature(method)
+    if "lineno" in inspect.signature(method).parameters or any(
+        [p.kind == p.VAR_KEYWORD for p in sig.parameters.values()]
+    ):
+        return method(width, lineno=lineno)
+    else:
+        return method(width)
+
+
 def get_default_editor():
     try:
         return os.environ['EDITOR']
@@ -96,7 +110,8 @@ def get_default_editor():
     if os.name == 'posix':
         return 'vi'  # the only one guaranteed to be there!
     else:
-        return 'notepad' # same in Windows!
+        return "notepad"  # same in Windows!
+
 
 # conservatively check for tty
 # overridden streams can result in things like:
@@ -293,7 +308,6 @@ class TerminalInteractiveShell(InteractiveShell):
 
         return self.editing_mode
 
-
     @observe('editing_mode')
     def _editing_mode(self, change):
         if self.pt_app:
@@ -322,7 +336,6 @@ class TerminalInteractiveShell(InteractiveShell):
     def refresh_style(self):
         self._style = self._make_style_from_name_or_cls(self.highlighting_style)
 
-
     highlighting_style_overrides = Dict(
         help="Override highlighting format for specific tokens"
     ).tag(config=True)
@@ -764,7 +777,9 @@ class TerminalInteractiveShell(InteractiveShell):
             "message": get_message,
             "prompt_continuation": (
                 lambda width, lineno, is_soft_wrap: PygmentsTokens(
-                    self.prompts.continuation_prompt_tokens(width, lineno=lineno)
+                    _backward_compat_continuation_prompt_tokens(
+                        self.prompts.continuation_prompt_tokens, width, lineno=lineno
+                    )
                 )
             ),
             "multiline": True,
@@ -859,7 +874,6 @@ class TerminalInteractiveShell(InteractiveShell):
             for cmd in ('clear', 'more', 'less', 'man'):
                 self.alias_manager.soft_define_alias(cmd, cmd)
 
-
     def __init__(self, *args, **kwargs) -> None:
         super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
         self._set_autosuggestions(self.autosuggestions_provider)
@@ -868,7 +882,6 @@ class TerminalInteractiveShell(InteractiveShell):
         self.keep_running = True
         self._set_formatter(self.autoformatter)
 
-
     def ask_exit(self):
         self.keep_running = False
 
@@ -916,7 +929,6 @@ class TerminalInteractiveShell(InteractiveShell):
 
         self._atexit_once()
 
-
     _inputhook = None
     def inputhook(self, context):
         if self._inputhook is not None:
diff --git a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
index 02820dc9c1..461aae5256 100644
--- a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
+++ b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
@@ -1,2 +1,2 @@
 # GENERATED BY setup.py
-commit = "dc4369111"
+commit = "19f24dd8e"
diff --git a/contrib/python/ipython/py3/IPython/utils/text.py b/contrib/python/ipython/py3/IPython/utils/text.py
index 9b653dcee0..8f73dca28a 100644
--- a/contrib/python/ipython/py3/IPython/utils/text.py
+++ b/contrib/python/ipython/py3/IPython/utils/text.py
@@ -17,7 +17,7 @@ import warnings
 from string import Formatter
 from pathlib import Path
 
-from typing import List, Union, Optional, Dict, Tuple
+from typing import List, Dict, Tuple
 
 
 class LSString(str):
@@ -357,7 +357,7 @@ def format_screen(strng):
     return strng
 
 
-def dedent(text):
+def dedent(text: str) -> str:
     """Equivalent of textwrap.dedent that ignores unindented first line.
 
     This means it will still dedent strings like:
-- 
cgit v1.2.3