diff options
| author | robot-contrib <[email protected]> | 2023-10-14 09:57:42 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2023-10-14 10:17:49 +0300 |
| commit | f13bfc9a1e469983083b02e19cf963678ace66c0 (patch) | |
| tree | 08bbf5b3ec11f1ce4aa614c451089b74caec35e2 /contrib/python/ipython/py3/IPython/core | |
| parent | 82c487106cdf6fa8ae9a18967e53de52fb52e4e8 (diff) | |
Update contrib/python/ipython/py3 to 8.16.0
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core')
5 files changed, 26 insertions, 20 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/debugger.py b/contrib/python/ipython/py3/IPython/core/debugger.py index 30be9fc0d19..8e968548f81 100644 --- a/contrib/python/ipython/py3/IPython/core/debugger.py +++ b/contrib/python/ipython/py3/IPython/core/debugger.py @@ -419,7 +419,12 @@ class Pdb(OldPdb): rep = repr(exc) if len(rep) > 80: rep = rep[:77] + "..." - self.message(f"{prompt} {ix:>3} {rep}") + indicator = ( + " -" + if self._chained_exceptions[ix].__traceback__ is None + else f"{ix:>3}" + ) + self.message(f"{prompt} {indicator} {rep}") else: try: number = int(arg) @@ -427,6 +432,12 @@ class Pdb(OldPdb): self.error("Argument must be an integer") return if 0 <= number < len(self._chained_exceptions): + if self._chained_exceptions[number].__traceback__ is None: + self.error( + "This exception does not have a traceback, cannot jump to it" + ) + return + self._chained_exception_index = number self.setup(None, self._chained_exceptions[number].__traceback__) self.print_stack_entry(self.stack[self.curindex]) @@ -438,6 +449,8 @@ class Pdb(OldPdb): if CHAIN_EXCEPTIONS: # this context manager is part of interaction in 3.13 _chained_exceptions, tb = self._get_tb_and_exceptions(tb_or_exc) + if isinstance(tb_or_exc, BaseException): + assert tb is not None, "main exception must have a traceback" with self._hold_exceptions(_chained_exceptions): OldPdb.interaction(self, frame, tb) else: diff --git a/contrib/python/ipython/py3/IPython/core/displayhook.py b/contrib/python/ipython/py3/IPython/core/displayhook.py index b411f116139..1ea8d8506f5 100644 --- a/contrib/python/ipython/py3/IPython/core/displayhook.py +++ b/contrib/python/ipython/py3/IPython/core/displayhook.py @@ -51,7 +51,7 @@ class DisplayHook(Configurable): # we need a reference to the user-level namespace self.shell = shell - + self._,self.__,self.___ = '','','' # these are deliberately global: @@ -83,15 +83,9 @@ class DisplayHook(Configurable): def quiet(self): """Should we silence the display hook because of ';'?""" - # do not print output if input ends in ';' - - try: - cell = self.shell.history_manager.input_hist_parsed[-1] - except IndexError: - # some uses of ipshellembed may fail here - return False - - return self.semicolon_at_end_of_expression(cell) + if self.exec_result is not None: + return self.semicolon_at_end_of_expression(self.exec_result.info.raw_cell) + return False @staticmethod def semicolon_at_end_of_expression(expression): @@ -280,13 +274,12 @@ class DisplayHook(Configurable): cull_count = max(int(sz * self.cull_fraction), 2) warn('Output cache limit (currently {sz} entries) hit.\n' 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count)) - + for i, n in enumerate(sorted(oh)): if i >= cull_count: break self.shell.user_ns.pop('_%i' % n, None) oh.pop(n, None) - def flush(self): if not self.do_full_cache: diff --git a/contrib/python/ipython/py3/IPython/core/guarded_eval.py b/contrib/python/ipython/py3/IPython/core/guarded_eval.py index d576a2a769d..5d405b2208e 100644 --- a/contrib/python/ipython/py3/IPython/core/guarded_eval.py +++ b/contrib/python/ipython/py3/IPython/core/guarded_eval.py @@ -444,7 +444,7 @@ def eval_node(node: Union[ast.AST, None], context: EvaluationContext): - control flow: - conditionals (``if x:``) except for ternary IfExp (``a if x else b``) - - loops (``for`` and `while``) + - loops (``for`` and ``while``) - exception handling The purpose of this function is to guard against unwanted side-effects; diff --git a/contrib/python/ipython/py3/IPython/core/magics/basic.py b/contrib/python/ipython/py3/IPython/core/magics/basic.py index 54b0c2a4de7..865e760eb18 100644 --- a/contrib/python/ipython/py3/IPython/core/magics/basic.py +++ b/contrib/python/ipython/py3/IPython/core/magics/basic.py @@ -122,7 +122,7 @@ class BasicMagics(Magics): Created `%whereami` as an alias for `%pwd`. In [6]: %whereami - Out[6]: u'/home/testuser' + Out[6]: '/home/testuser' In [7]: %alias_magic h history "-p -l 30" --line Created `%h` as an alias for `%history -l 30`. @@ -537,25 +537,25 @@ Currently the magic system has the following functions:""", In [1]: from math import pi In [2]: %precision 3 - Out[2]: u'%.3f' + Out[2]: '%.3f' In [3]: pi Out[3]: 3.142 In [4]: %precision %i - Out[4]: u'%i' + Out[4]: '%i' In [5]: pi Out[5]: 3 In [6]: %precision %e - Out[6]: u'%e' + Out[6]: '%e' In [7]: pi**10 Out[7]: 9.364805e+04 In [8]: %precision - Out[8]: u'%r' + Out[8]: '%r' In [9]: pi**10 Out[9]: 93648.047476082982 diff --git a/contrib/python/ipython/py3/IPython/core/release.py b/contrib/python/ipython/py3/IPython/core/release.py index a1df4d10586..4d0a244e40e 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 = 15 +_version_minor = 16 _version_patch = 0 _version_extra = ".dev" # _version_extra = "rc1" |
