Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-ipython for openSUSE:Factory checked in at 2021-07-10 22:53:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ipython (Old) and /work/SRC/openSUSE:Factory/.python-ipython.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ipython" Sat Jul 10 22:53:50 2021 rev:21 rq:902996 version:7.25.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ipython/python-ipython.changes 2021-04-10 15:25:51.478271219 +0200 +++ /work/SRC/openSUSE:Factory/.python-ipython.new.2625/python-ipython.changes 2021-07-10 22:53:58.772000715 +0200 @@ -1,0 +2,18 @@ +Sat Jun 26 14:45:40 UTC 2021 - Ben Greiner <[email protected]> + +- Update to version 7.25.0 + * debugger bug fix +- Release 7.24 + * Fix an issue where %recall would both succeeded and print an + error message it failed. + * Drop support for NumPy 1.16 ??? practically has no effect beyond + indicating in package metadata that we do not support it. + * Debugger improvements +- Release 7.23 + * We have a new dependency: matplotlib-inline, which try to + extract matplotlib inline backend specific behavior. It is + available on PyPI and conda-forge thus should not be a problem + to upgrade to this version. If you are a package maintainer + that might be an extra dependency to package first. + +------------------------------------------------------------------- Old: ---- ipython-7.22.0.tar.gz New: ---- ipython-7.25.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ipython.spec ++++++ --- /var/tmp/diff_new_pack.WemGfU/_old 2021-07-10 22:54:00.431987903 +0200 +++ /var/tmp/diff_new_pack.WemGfU/_new 2021-07-10 22:54:00.435987872 +0200 @@ -1,5 +1,5 @@ # -# spec file for package python-ipython-test +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -30,7 +30,7 @@ %define skip_python36 1 %bcond_without iptest Name: python-ipython%{psuffix} -Version: 7.22.0 +Version: 7.25.0 Release: 0 Summary: Rich architecture for interactive computing with Python License: BSD-3-Clause @@ -48,11 +48,11 @@ Requires: python-base >= 3.7 Requires: python-decorator Requires: python-jedi >= 0.16 -Requires: python-pexpect >= 4.6 +Requires: python-matplotlib-inline +Requires: python-pexpect >= 4.3 Requires: python-pickleshare Requires: python-prompt_toolkit < 3.1 Requires: python-prompt_toolkit >= 2.0 -Requires: python-simplegeneric > 0.8 Requires: python-traitlets >= 4.2 Recommends: jupyter Recommends: python-ipykernel @@ -75,8 +75,8 @@ Obsoletes: python-jupyter_ipython-doc-pdf < %{version} BuildArch: noarch %if %{with test} +# test requirements are specified in the iptest subpackage below BuildRequires: %{python_module ipython-iptest = %{version}} -BuildRequires: %{python_module matplotlib} %endif %if !%{with test} BuildRequires: desktop-file-utils @@ -128,7 +128,7 @@ Requires: python-ipykernel Requires: python-nbformat Requires: python-nose >= 0.10.1 -Requires: python-numpy +Requires: python-numpy >= 1.17 Requires: python-requests Requires: python-testpath Provides: python-jupyter_ipython-iptest = %{version} ++++++ ipython-7.22.0.tar.gz -> ipython-7.25.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/debugger.py new/ipython-7.25.0/IPython/core/debugger.py --- old/ipython-7.22.0/IPython/core/debugger.py 2021-03-27 01:47:57.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/debugger.py 2021-06-25 17:26:57.000000000 +0200 @@ -33,6 +33,7 @@ import sys import warnings import re +import os from IPython import get_ipython from IPython.utils import PyColorize @@ -198,21 +199,39 @@ for a standalone version that uses prompt_toolkit, see `IPython.terminal.debugger.TerminalPdb` and `IPython.terminal.debugger.set_trace()` + + + This debugger can hide and skip frames that are tagged according to some predicates. + See the `skip_predicates` commands. + """ + default_predicates = {"tbhide": True, "readonly": False, "ipython_internal": True} + def __init__(self, color_scheme=None, completekey=None, stdin=None, stdout=None, context=5, **kwargs): """Create a new IPython debugger. - - :param color_scheme: Deprecated, do not use. - :param completekey: Passed to pdb.Pdb. - :param stdin: Passed to pdb.Pdb. - :param stdout: Passed to pdb.Pdb. - :param context: Number of lines of source code context to show when + + Parameters + ---------- + color_scheme : default None + Deprecated, do not use. + completekey : default None + Passed to pdb.Pdb. + stdin : default None + Passed to pdb.Pdb. + stdout : default None + Passed to pdb.Pdb. + context : int + Number of lines of source code context to show when displaying stacktrace information. - :param kwargs: Passed to pdb.Pdb. - The possibilities are python version dependent, see the python - docs for more info. + **kwargs + Passed to pdb.Pdb. + + Notes + ----- + The possibilities are python version dependent, see the python + docs for more info. """ # Parent constructor: @@ -281,6 +300,10 @@ # Set the prompt - the default prompt is '(Pdb)' self.prompt = prompt self.skip_hidden = True + self.report_skipped = True + + # list of predicates we use to skip frames + self._predicates = self.default_predicates def set_colors(self, scheme): """Shorthand access to the color table scheme selector method.""" @@ -293,6 +316,26 @@ self.initial_frame = frame return super().set_trace(frame) + def _hidden_predicate(self, frame): + """ + Given a frame return whether it it should be hidden or not by IPython. + """ + + if self._predicates["readonly"]: + fname = frame.f_code.co_filename + # we need to check for file existence and interactively define + # function would otherwise appear as RO. + if os.path.isfile(fname) and not os.access(fname, os.W_OK): + return True + + if self._predicates["tbhide"]: + if frame in (self.curframe, getattr(self, "initial_frame", None)): + return False + else: + return self._get_frame_locals(frame).get("__tracebackhide__", False) + + return False + def hidden_frames(self, stack): """ Given an index in the stack return wether it should be skipped. @@ -303,14 +346,9 @@ # locals whenever the .f_locals accessor is called, so we # avoid calling it here to preserve self.curframe_locals. # Futhermore, there is no good reason to hide the current frame. - ip_hide = [ - False - if s[0] in (self.curframe, getattr(self, "initial_frame", None)) - else s[0].f_locals.get("__tracebackhide__", False) - for s in stack - ] + ip_hide = [self._hidden_predicate(s[0]) for s in stack] ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"] - if ip_start: + if ip_start and self._predicates["ipython_internal"]: ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)] return ip_hide @@ -386,6 +424,28 @@ self.shell.hooks.synchronize_with_editor(filename, lineno, 0) # vds: << + def _get_frame_locals(self, frame): + """ " + Acessing f_local of current frame reset the namespace, so we want to avoid + that or the following can happend + + ipdb> foo + "old" + ipdb> foo = "new" + ipdb> foo + "new" + ipdb> where + ipdb> foo + "old" + + So if frame is self.current_frame we instead return self.curframe_locals + + """ + if frame is self.curframe: + return self.curframe_locals + else: + return frame.f_locals + def format_stack_entry(self, frame_lineno, lprefix=': ', context=None): if context is None: context = self.context @@ -413,10 +473,11 @@ frame, lineno = frame_lineno return_value = '' - if '__return__' in frame.f_locals: - rv = frame.f_locals['__return__'] - #return_value += '->' - return_value += reprlib.repr(rv) + '\n' + loc_frame = self._get_frame_locals(frame) + if "__return__" in loc_frame: + rv = loc_frame["__return__"] + # return_value += '->' + return_value += reprlib.repr(rv) + "\n" ret.append(return_value) #s = filename + '(' + `lineno` + ')' @@ -428,10 +489,10 @@ else: func = "<lambda>" - call = '' - if func != '?': - if '__args__' in frame.f_locals: - args = reprlib.repr(frame.f_locals['__args__']) + call = "" + if func != "?": + if "__args__" in loc_frame: + args = reprlib.repr(loc_frame["__args__"]) else: args = '()' call = tpl_call % (func, args) @@ -521,15 +582,68 @@ except KeyboardInterrupt: pass + def do_skip_predicates(self, args): + """ + Turn on/off individual predicates as to whether a frame should be hidden/skip. + + The global option to skip (or not) hidden frames is set with skip_hidden + + To change the value of a predicate + + skip_predicates key [true|false] + + Call without arguments to see the current values. + + To permanently change the value of an option add the corresponding + command to your ``~/.pdbrc`` file. If you are programmatically using the + Pdb instance you can also change the ``default_predicates`` class + attribute. + """ + if not args.strip(): + print("current predicates:") + for (p, v) in self._predicates.items(): + print(" ", p, ":", v) + return + type_value = args.strip().split(" ") + if len(type_value) != 2: + print( + f"Usage: skip_predicates <type> <value>, with <type> one of {set(self._predicates.keys())}" + ) + return + + type_, value = type_value + if type_ not in self._predicates: + print(f"{type_!r} not in {set(self._predicates.keys())}") + return + if value.lower() not in ("true", "yes", "1", "no", "false", "0"): + print( + f"{value!r} is invalid - use one of ('true', 'yes', '1', 'no', 'false', '0')" + ) + return + + self._predicates[type_] = value.lower() in ("true", "yes", "1") + if not any(self._predicates.values()): + print( + "Warning, all predicates set to False, skip_hidden may not have any effects." + ) + def do_skip_hidden(self, arg): """ Change whether or not we should skip frames with the __tracebackhide__ attribute. """ - if arg.strip().lower() in ("true", "yes"): + if not arg.strip(): + print( + f"skip_hidden = {self.skip_hidden}, use 'yes','no', 'true', or 'false' to change." + ) + elif arg.strip().lower() in ("true", "yes"): self.skip_hidden = True elif arg.strip().lower() in ("false", "no"): self.skip_hidden = False + if not any(self._predicates.values()): + print( + "Warning, all predicates set to False, skip_hidden may not have any effects." + ) def do_list(self, arg): """Print lines of code from the current stack frame @@ -569,7 +683,7 @@ def getsourcelines(self, obj): lines, lineno = inspect.findsource(obj) - if inspect.isframe(obj) and obj.f_globals is obj.f_locals: + if inspect.isframe(obj) and obj.f_globals is self._get_frame_locals(obj): # must be a module frame: do not try to cut a block out of it return lines, 1 elif inspect.ismodule(obj): @@ -694,12 +808,14 @@ """Check if pdb should stop here""" if not super().stop_here(frame): return False - if self.skip_hidden and frame.f_locals.get("__tracebackhide__", False): - if self._wait_for_mainpyfile: - return False - Colors = self.color_scheme_table.active_colors - ColorsNormal = Colors.Normal - print(f"{Colors.excName} [... skipped 1 hidden frame]{ColorsNormal}\n") + hidden = False + if self.skip_hidden: + hidden = self._hidden_predicate(frame) + if hidden: + if self.report_skipped: + Colors = self.color_scheme_table.active_colors + ColorsNormal = Colors.Normal + print(f"{Colors.excName} [... skipped 1 hidden frame]{ColorsNormal}\n") return False return True @@ -710,8 +826,8 @@ Will skip hidden frames. """ - ## modified version of upstream that skips - # frames with __tracebackide__ + # modified version of upstream that skips + # frames with __tracebackhide__ if self.curindex == 0: self.error("Oldest frame") return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/display.py new/ipython-7.25.0/IPython/core/display.py --- old/ipython-7.22.0/IPython/core/display.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/display.py 2021-06-25 17:26:39.000000000 +0200 @@ -163,6 +163,9 @@ Set an id for the display. This id can be used for updating this display area later via update_display. If given as `True`, generate a new `display_id` + clear : bool, optional + Should the output area be cleared before displaying anything? If True, + this will wait for additional output before clearing. [default: False] kwargs: additional keyword-args, optional Additional keyword-arguments are passed through to the display publisher. @@ -281,8 +284,9 @@ # Directly print objects. print(*objs) return - - raw = kwargs.pop('raw', False) + + raw = kwargs.pop("raw", False) + clear = kwargs.pop("clear", False) if transient is None: transient = {} if metadata is None: @@ -306,6 +310,9 @@ if not raw: format = InteractiveShell.instance().display_formatter.format + if clear: + clear_output(wait=True) + for obj in objs: if raw: publish_display_data(data=obj, metadata=metadata, **kwargs) @@ -675,7 +682,7 @@ with gzip.open(BytesIO(data), 'rt', encoding=encoding) as fp: encoding = None data = fp.read() - + # decode data, if an encoding was specified # We only touch self.data once since # subclasses such as SVG have @data.setter methods @@ -1471,7 +1478,12 @@ @skip_doctest def set_matplotlib_formats(*formats, **kwargs): - """Select figure formats for the inline backend. Optionally pass quality for JPEG. + """ + .. deprecated:: 7.23 + + use `matplotlib_inline.backend_inline.set_matplotlib_formats()` + + Select figure formats for the inline backend. Optionally pass quality for JPEG. For example, this enables PNG and JPEG output with a JPEG quality of 90%:: @@ -1489,20 +1501,28 @@ **kwargs : Keyword args will be relayed to ``figure.canvas.print_figure``. """ - from IPython.core.interactiveshell import InteractiveShell - from IPython.core.pylabtools import select_figure_formats - # build kwargs, starting with InlineBackend config - kw = {} - from ipykernel.pylab.config import InlineBackend - cfg = InlineBackend.instance() - kw.update(cfg.print_figure_kwargs) - kw.update(**kwargs) - shell = InteractiveShell.instance() - select_figure_formats(shell, formats, **kw) + warnings.warn( + "`set_matplotlib_formats` is deprecated since IPython 7.23, directly " + "use `matplotlib_inline.backend_inline.set_matplotlib_formats()`", + DeprecationWarning, + stacklevel=2, + ) + + from matplotlib_inline.backend_inline import ( + set_matplotlib_formats as set_matplotlib_formats_orig, + ) + + set_matplotlib_formats_orig(*formats, **kwargs) @skip_doctest def set_matplotlib_close(close=True): - """Set whether the inline backend closes all figures automatically or not. + """ + .. deprecated:: 7.23 + + use `matplotlib_inline.backend_inline.set_matplotlib_close()` + + + Set whether the inline backend closes all figures automatically or not. By default, the inline backend used in the IPython Notebook will close all matplotlib figures automatically after each cell is run. This means that @@ -1522,6 +1542,15 @@ Should all matplotlib figures be automatically closed after each cell is run? """ - from ipykernel.pylab.config import InlineBackend - cfg = InlineBackend.instance() - cfg.close_figures = close + warnings.warn( + "`set_matplotlib_close` is deprecated since IPython 7.23, directly " + "use `matplotlib_inline.backend_inline.set_matplotlib_close()`", + DeprecationWarning, + stacklevel=2, + ) + + from matplotlib_inline.backend_inline import ( + set_matplotlib_close as set_matplotlib_close_orig, + ) + + set_matplotlib_close_orig(close) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/interactiveshell.py new/ipython-7.25.0/IPython/core/interactiveshell.py --- old/ipython-7.22.0/IPython/core/interactiveshell.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/interactiveshell.py 2021-06-25 17:26:39.000000000 +0200 @@ -2075,13 +2075,17 @@ except KeyboardInterrupt: print('\n' + self.get_exception_only(), file=sys.stderr) - def _showtraceback(self, etype, evalue, stb): + def _showtraceback(self, etype, evalue, stb: str): """Actually show a traceback. Subclasses may override this method to put the traceback on a different place, like a side channel. """ - print(self.InteractiveTB.stb2text(stb)) + val = self.InteractiveTB.stb2text(stb) + try: + print(val) + except UnicodeEncodeError: + print(val.encode("utf-8", "backslashreplace").decode()) def showsyntaxerror(self, filename=None, running_compiled_code=False): """Display the syntax error that just occurred. @@ -3510,6 +3514,7 @@ display figures inline. """ from IPython.core import pylabtools as pt + from matplotlib_inline.backend_inline import configure_inline_support gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select) if gui != 'inline': @@ -3523,7 +3528,7 @@ gui, backend = pt.find_gui_and_backend(self.pylab_gui_select) pt.activate_matplotlib(backend) - pt.configure_inline_support(self, backend) + configure_inline_support(self, backend) # Now we must activate the gui pylab wants to use, and fix %run to take # plot updates into account diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/magics/history.py new/ipython-7.25.0/IPython/core/magics/history.py --- old/ipython-7.22.0/IPython/core/magics/history.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/magics/history.py 2021-06-25 17:26:39.000000000 +0200 @@ -274,6 +274,7 @@ return else: self.shell.set_next_input(cmd.rstrip()) + return print("Couldn't evaluate or find in history:", arg) @line_magic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/pylabtools.py new/ipython-7.25.0/IPython/core/pylabtools.py --- old/ipython-7.22.0/IPython/core/pylabtools.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/pylabtools.py 2021-06-25 17:26:39.000000000 +0200 @@ -5,30 +5,32 @@ # Distributed under the terms of the Modified BSD License. from io import BytesIO +import warnings from IPython.core.display import _pngxy from IPython.utils.decorators import flag_calls # If user specifies a GUI, that dictates the backend, otherwise we read the # user's mpl default from the mpl rc structure -backends = {'tk': 'TkAgg', - 'gtk': 'GTKAgg', - 'gtk3': 'GTK3Agg', - 'wx': 'WXAgg', - 'qt4': 'Qt4Agg', - 'qt5': 'Qt5Agg', - 'qt': 'Qt5Agg', - 'osx': 'MacOSX', - 'nbagg': 'nbAgg', - 'notebook': 'nbAgg', - 'agg': 'agg', - 'svg': 'svg', - 'pdf': 'pdf', - 'ps': 'ps', - 'inline': 'module://ipykernel.pylab.backend_inline', - 'ipympl': 'module://ipympl.backend_nbagg', - 'widget': 'module://ipympl.backend_nbagg', - } +backends = { + "tk": "TkAgg", + "gtk": "GTKAgg", + "gtk3": "GTK3Agg", + "wx": "WXAgg", + "qt4": "Qt4Agg", + "qt5": "Qt5Agg", + "qt": "Qt5Agg", + "osx": "MacOSX", + "nbagg": "nbAgg", + "notebook": "nbAgg", + "agg": "agg", + "svg": "svg", + "pdf": "pdf", + "ps": "ps", + "inline": "module://matplotlib_inline.backend_inline", + "ipympl": "module://ipympl.backend_nbagg", + "widget": "module://ipympl.backend_nbagg", +} # We also need a reverse backends2guis mapping that will properly choose which # GUI support to activate based on the desired matplotlib backend. For the @@ -44,12 +46,12 @@ backend2gui['WX'] = 'wx' backend2gui['CocoaAgg'] = 'osx' # And some backends that don't need GUI integration -del backend2gui['nbAgg'] -del backend2gui['agg'] -del backend2gui['svg'] -del backend2gui['pdf'] -del backend2gui['ps'] -del backend2gui['module://ipykernel.pylab.backend_inline'] +del backend2gui["nbAgg"] +del backend2gui["agg"] +del backend2gui["svg"] +del backend2gui["pdf"] +del backend2gui["ps"] +del backend2gui["module://matplotlib_inline.backend_inline"] #----------------------------------------------------------------------------- # Matplotlib utilities @@ -96,10 +98,10 @@ def print_figure(fig, fmt='png', bbox_inches='tight', **kwargs): """Print a figure to an image, and return the resulting file data - + Returned data will be bytes unless ``fmt='svg'``, in which case it will be unicode. - + Any keyword args are passed to fig.canvas.print_figure, such as ``quality`` or ``bbox_inches``. """ @@ -112,7 +114,7 @@ if fmt == 'retina': dpi = dpi * 2 fmt = 'png' - + # build keyword args kw = { "format":fmt, @@ -162,7 +164,7 @@ A function suitable for use as the ``runner`` argument of the %run magic function. """ - + def mpl_execfile(fname,*where,**kw): """matplotlib-aware wrapper around safe_execfile. @@ -243,7 +245,7 @@ bs = "%s" % ','.join([repr(f) for f in bad]) gs = "%s" % ','.join([repr(f) for f in supported]) raise ValueError("supported formats are: %s not %s" % (gs, bs)) - + if 'png' in formats: png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) if 'retina' in formats or 'png2x' in formats: @@ -274,7 +276,7 @@ Returns ------- A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg', - 'WXAgg','Qt4Agg','module://ipykernel.pylab.backend_inline','agg'). + 'WXAgg','Qt4Agg','module://matplotlib_inline.backend_inline','agg'). """ import matplotlib @@ -308,7 +310,7 @@ import matplotlib matplotlib.interactive(True) - + # Matplotlib had a bug where even switch_backend could not force # the rcParam to update. This needs to be set *before* the module # magic of switch_backend(). @@ -329,11 +331,11 @@ def import_pylab(user_ns, import_all=True): """Populate the namespace with pylab-related values. - + Imports matplotlib, pylab, numpy, and everything from pylab and numpy. - + Also imports a few names from IPython (figsize, display, getfigs) - + """ # Import numpy as np/pyplot as plt are conventions we're trying to @@ -346,12 +348,12 @@ "plt = pyplot\n" ) exec(s, user_ns) - + if import_all: s = ("from matplotlib.pylab import *\n" "from numpy import *\n") exec(s, user_ns) - + # IPython symbols to add user_ns['figsize'] = figsize from IPython.core.display import display @@ -361,7 +363,12 @@ def configure_inline_support(shell, backend): - """Configure an IPython shell object for matplotlib use. + """ + .. deprecated: 7.23 + + use `matplotlib_inline.backend_inline.configure_inline_support()` + + Configure an IPython shell object for matplotlib use. Parameters ---------- @@ -369,51 +376,13 @@ backend : matplotlib backend """ - # If using our svg payload backend, register the post-execution - # function that will pick up the results for display. This can only be - # done with access to the real shell object. - - # Note: if we can't load the inline backend, then there's no point - # continuing (such as in terminal-only shells in environments without - # zeromq available). - try: - from ipykernel.pylab.backend_inline import InlineBackend - except ImportError: - return - import matplotlib + warnings.warn( + "`configure_inline_support` is deprecated since IPython 7.23, directly " + "use `matplotlib_inline.backend_inline.configure_inline_support()`", + DeprecationWarning, + stacklevel=2, + ) - cfg = InlineBackend.instance(parent=shell) - cfg.shell = shell - if cfg not in shell.configurables: - shell.configurables.append(cfg) - - if backend == backends['inline']: - from ipykernel.pylab.backend_inline import flush_figures - shell.events.register('post_execute', flush_figures) - - # Save rcParams that will be overwrittern - shell._saved_rcParams = {} - for k in cfg.rc: - shell._saved_rcParams[k] = matplotlib.rcParams[k] - # load inline_rc - matplotlib.rcParams.update(cfg.rc) - new_backend_name = "inline" - else: - from ipykernel.pylab.backend_inline import flush_figures - try: - shell.events.unregister('post_execute', flush_figures) - except ValueError: - pass - if hasattr(shell, '_saved_rcParams'): - matplotlib.rcParams.update(shell._saved_rcParams) - del shell._saved_rcParams - new_backend_name = "other" - - # only enable the formats once -> don't change the enabled formats (which the user may - # has changed) when getting another "%matplotlib inline" call. - # See https://github.com/ipython/ipykernel/issues/29 - cur_backend = getattr(configure_inline_support, "current_backend", "unset") - if new_backend_name != cur_backend: - # Setup the default figure format - select_figure_formats(shell, cfg.figure_formats, **cfg.print_figure_kwargs) - configure_inline_support.current_backend = new_backend_name + from matplotlib_inline.backend_inline import configure_inline_support as configure_inline_support_orig + + configure_inline_support_orig(shell, backend) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/release.py new/ipython-7.25.0/IPython/core/release.py --- old/ipython-7.22.0/IPython/core/release.py 2021-03-27 01:48:52.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/release.py 2021-06-25 17:45:54.000000000 +0200 @@ -20,11 +20,11 @@ # release. 'dev' as a _version_extra string means this is a development # version _version_major = 7 -_version_minor = 22 +_version_minor = 25 _version_patch = 0 _version_extra = '.dev' # _version_extra = 'b1' -_version_extra = '' # Uncomment this for full releases +_version_extra = "" # Uncomment this for full releases # Construct full version string from these. _ver = [_version_major, _version_minor, _version_patch] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/tests/test_debugger.py new/ipython-7.25.0/IPython/core/tests/test_debugger.py --- old/ipython-7.22.0/IPython/core/tests/test_debugger.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/tests/test_debugger.py 2021-06-25 17:26:57.000000000 +0200 @@ -280,14 +280,14 @@ block = dedent( """ -def f(): - __tracebackhide__ = True - g() + def f(): + __tracebackhide__ = True + g() -def g(): - raise ValueError + def g(): + raise ValueError -f() + f() """ ) @@ -298,15 +298,15 @@ block = dedent( """ -def f(): - __tracebackhide__ = True - g() - -def g(): - from IPython.core.debugger import set_trace - set_trace() + def f(): + __tracebackhide__ = True + g() + + def g(): + from IPython.core.debugger import set_trace + set_trace() -f() + f() """ ) @@ -324,3 +324,70 @@ child.expect("ipdb>") child.close() + + +@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>") + + child.sendline("myvar") + child.expect("1") + + ## + child.expect("ipdb>") + + child.sendline("myvar = 2") + + ## + child.expect_exact("ipdb>") + + child.sendline("myvar") + + child.expect_exact("2") + + ## + child.expect("ipdb>") + child.sendline("where") + + ## + child.expect("ipdb>") + child.sendline("myvar") + + child.expect_exact("2") + child.expect("ipdb>") + + child.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/tests/test_display.py new/ipython-7.25.0/IPython/core/tests/test_display.py --- old/ipython-7.22.0/IPython/core/tests/test_display.py 2021-03-27 01:47:57.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/tests/test_display.py 2021-06-25 17:26:39.000000000 +0200 @@ -135,7 +135,7 @@ nt.assert_is_none(img._repr_jpeg_()) def _get_inline_config(): - from ipykernel.pylab.config import InlineBackend + from matplotlib_inline.config import InlineBackend return InlineBackend.instance() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/tests/test_interactiveshell.py new/ipython-7.25.0/IPython/core/tests/test_interactiveshell.py --- old/ipython-7.22.0/IPython/core/tests/test_interactiveshell.py 2020-10-23 00:51:43.000000000 +0200 +++ new/ipython-7.25.0/IPython/core/tests/test_interactiveshell.py 2021-06-25 17:26:39.000000000 +0200 @@ -449,6 +449,25 @@ # Reset the custom exception hook ip.set_custom_exc((), None) + @mock.patch("builtins.print") + def test_showtraceback_with_surrogates(self, mocked_print): + values = [] + + def mock_print_func(value, sep=" ", end="\n", file=sys.stdout, flush=False): + values.append(value) + if value == chr(0xD8FF): + raise UnicodeEncodeError("utf-8", chr(0xD8FF), 0, 1, "") + + # mock builtins.print + mocked_print.side_effect = mock_print_func + + # ip._showtraceback() is replaced in globalipapp.py. + # Call original method to test. + interactiveshell.InteractiveShell._showtraceback(ip, None, None, chr(0xD8FF)) + + self.assertEqual(mocked_print.call_count, 2) + self.assertEqual(values, [chr(0xD8FF), "\\ud8ff"]) + def test_mktempfile(self): filename = ip.mktempfile() # Check that we can open the file again on Windows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/core/tests/test_pylabtools.py new/ipython-7.25.0/IPython/core/tests/test_pylabtools.py --- old/ipython-7.22.0/IPython/core/tests/test_pylabtools.py 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/IPython/core/tests/test_pylabtools.py 2021-06-25 17:26:39.000000000 +0200 @@ -15,6 +15,7 @@ import nose.tools as nt from matplotlib import pyplot as plt +import matplotlib_inline import numpy as np from IPython.core.getipython import get_ipython @@ -167,13 +168,15 @@ pt.activate_matplotlib = act_mpl self._save_ip = pt.import_pylab pt.import_pylab = lambda *a,**kw:None - self._save_cis = pt.configure_inline_support - pt.configure_inline_support = lambda *a,**kw:None + self._save_cis = matplotlib_inline.backend_inline.configure_inline_support + matplotlib_inline.backend_inline.configure_inline_support = ( + lambda *a, **kw: None + ) def teardown(self): pt.activate_matplotlib = self._save_am pt.import_pylab = self._save_ip - pt.configure_inline_support = self._save_cis + matplotlib_inline.backend_inline.configure_inline_support = self._save_cis import matplotlib matplotlib.rcParams = self._saved_rcParams matplotlib.rcParamsOrig = self._saved_rcParamsOrig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/lib/editorhooks.py new/ipython-7.25.0/IPython/lib/editorhooks.py --- old/ipython-7.22.0/IPython/lib/editorhooks.py 2020-08-29 23:05:46.000000000 +0200 +++ new/ipython-7.25.0/IPython/lib/editorhooks.py 2021-05-01 00:55:12.000000000 +0200 @@ -6,7 +6,6 @@ """ import os -import pipes import shlex import subprocess import sys @@ -47,9 +46,9 @@ def call_editor(self, filename, line=0): if line is None: line = 0 - cmd = template.format(filename=pipes.quote(filename), line=line) + cmd = template.format(filename=shlex.quote(filename), line=line) print(">", cmd) - # pipes.quote doesn't work right on Windows, but it does after splitting + # shlex.quote doesn't work right on Windows, but it does after splitting if sys.platform.startswith('win'): cmd = shlex.split(cmd) proc = subprocess.Popen(cmd, shell=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/IPython/utils/_sysinfo.py new/ipython-7.25.0/IPython/utils/_sysinfo.py --- old/ipython-7.22.0/IPython/utils/_sysinfo.py 2021-03-27 01:48:52.000000000 +0100 +++ new/ipython-7.25.0/IPython/utils/_sysinfo.py 2021-06-25 17:45:54.000000000 +0200 @@ -1,2 +1,2 @@ # GENERATED BY setup.py -commit = u"8648ed8d7" +commit = u"63a5c09ed" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/PKG-INFO new/ipython-7.25.0/PKG-INFO --- old/ipython-7.22.0/PKG-INFO 2021-03-27 01:48:52.000000000 +0100 +++ new/ipython-7.25.0/PKG-INFO 2021-06-25 17:45:54.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ipython -Version: 7.22.0 +Version: 7.25.0 Summary: IPython: Productive Interactive Computing Home-page: https://ipython.org Author: The IPython Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/docs/requirements.txt new/ipython-7.25.0/docs/requirements.txt --- old/ipython-7.22.0/docs/requirements.txt 2021-03-27 01:22:38.000000000 +0100 +++ new/ipython-7.25.0/docs/requirements.txt 2021-06-25 17:26:39.000000000 +0200 @@ -1,7 +1,8 @@ --e . +-e .[test] ipykernel setuptools>=18.5 sphinx sphinx-rtd-theme docrepr matplotlib +pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/docs/source/whatsnew/version7.rst new/ipython-7.25.0/docs/source/whatsnew/version7.rst --- old/ipython-7.22.0/docs/source/whatsnew/version7.rst 2021-03-27 01:47:57.000000000 +0100 +++ new/ipython-7.25.0/docs/source/whatsnew/version7.rst 2021-06-25 17:26:57.000000000 +0200 @@ -2,6 +2,171 @@ 7.x Series ============ +.. _version 7.25: + +IPython 7.25 +============ + +IPython 7.21 is a minor release that contains a singe bugfix, which is highly +recommended for all users of ipdb, ipython debugger %debug magic and similar. + +Issuing commands like ``where`` from within the debugger would reset the +local variables changes made by the user. It is interesting to look at the root +cause of the issue as accessing an attribute (``frame.f_locals``) would trigger +this side effects. + +Thanks in particular to the patience from the reporters at D.E. Shaw for their +initial bug report that was due to a similar coding oversight in an extension, +and who took time to debug and narrow down the problem. + +Thanks +------ + +Many thanks to all the contributors to this release you can find all individual +contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/89>`__. + +Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring +work on IPython and related libraries. + + +.. _version 7.24: + +IPython 7.24 +============ + +Third release of IPython for 2021, mostly containing bug fixes. A couple of not +typical updates: + +Misc +---- + + + - Fix an issue where ``%recall`` would both succeeded and print an error message + it failed. :ghpull:`12952` + - Drop support for NumPy 1.16 ??? practically has no effect beyond indicating in + package metadata that we do not support it. :ghpull:`12937` + +Debugger improvements +--------------------- + +The debugger (and ``%debug`` magic) have been improved and can skip or hide frames +originating from files that are not writable to the user, as these are less +likely to be the source of errors, or be part of system files this can be a useful +addition when debugging long errors. + +In addition to the global ``skip_hidden True|False`` command, the debugger has +gained finer grained control of predicates as to whether to a frame should be +considered hidden. So far 3 predicates are available : + + - ``tbhide``: frames containing the local variable ``__tracebackhide__`` set to + True. + - ``readonly``: frames originating from readonly files, set to False. + - ``ipython_internal``: frames that are likely to be from IPython internal + code, set to True. + +You can toggle individual predicates during a session with + +.. code-block:: + + ipdb> skip_predicates readonly True + +Read-only files will now be considered hidden frames. + + +You can call ``skip_predicates`` without arguments to see the states of current +predicates: + +.. code-block:: + + ipdb> skip_predicates + current predicates: + tbhide : True + readonly : False + ipython_internal : True + +If all predicates are set to ``False``, ``skip_hidden`` will practically have +no effect. We attempt to warn you when all predicates are False. + +Note that the ``readonly`` predicate may increase disk access as we check for +file access permission for all frames on many command invocation, but is usually +cached by operating systems. Let us know if you encounter any issues. + +As the IPython debugger does not use the traitlets infrastructure for +configuration, by editing your ``.pdbrc`` files and appending commands you would +like to be executed just before entering the interactive prompt. For example: + + +.. code:: + + # file : ~/.pdbrc + skip_predicates readonly True + skip_predicates tbhide False + +Will hide read only frames by default and show frames marked with +``__tracebackhide__``. + + + + +Thanks +------ + +Many thanks to all the contributors to this release you can find all individual +contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/87>`__. + +Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring +work on IPython and related libraries, in particular above mentioned +improvements to the debugger. + + + + +.. _version 7.23: + +IPython 7.23 and 7.23.1 +======================= + + +Third release of IPython for 2021, mostly containing bug fixes. A couple of not +typical updates: + + - We moved to GitHub actions away from Travis-CI, the transition may not be + 100% complete (not testing on nightly anymore), but as we ran out of + Travis-Ci hours on the IPython organisation that was a necessary step. + :ghpull:`12900`. + + - We have a new dependency: ``matplotlib-inline``, which try to extract + matplotlib inline backend specific behavior. It is available on PyPI and + conda-forge thus should not be a problem to upgrade to this version. If you + are a package maintainer that might be an extra dependency to package first. + :ghpull:`12817` (IPython 7.23.1 fix a typo that made this change fail) + +In the addition/new feature category, ``display()`` now have a ``clear=True`` +option to clear the display if any further outputs arrives, allowing users to +avoid having to use ``clear_output()`` directly. :ghpull:`12823`. + +In bug fixes category, this release fix an issue when printing tracebacks +containing Unicode characters :ghpull:`12758`. + +In code cleanup category :ghpull:`12932` remove usage of some deprecated +functionality for compatibility with Python 3.10. + + + +Thanks +------ + +Many thanks to all the contributors to this release you can find all individual +contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/86>`__. +In particular MrMino for responding to almost all new issues, and triaging many +of the old ones, as well as takluyver, minrk, willingc for reacting quikly when +we ran out of CI Hours. + +Thanks as well to organisations, QuantStack (martinRenou and SylvainCorlay) for +extracting matplotlib inline backend into its own package, and the `D. E. Shaw group +<https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. + + .. _version 7.22: IPython 7.22 @@ -32,7 +197,7 @@ Thanks as well to organisations, QuantStack for working on debugger compatibility for Xeus_python, and the `D. E. Shaw group -<https://deshaw.com/>` for sponsoring work on IPython and related libraries. +<https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. .. _version 721: @@ -114,14 +279,14 @@ - Docs docs formatting that make the install commands work on zsh :ghpull:`12587` - Always display the last frame in tracebacks even if hidden with - ``__traceback_hide__`` :ghpull:`12601` + ``__tracebackhide__`` :ghpull:`12601` - Avoid an issue where a callback can be registered multiple times. :ghpull:`12625` - Avoid an issue in debugger mode where frames changes could be lost. :ghpull:`12627` - Never hide the frames that invoke a debugger, even if marked as hidden by - ``__traceback_hide__`` :ghpull:`12631` + ``__tracebackhide__`` :ghpull:`12631` - Fix calling the debugger in a recursive manner :ghpull:`12659` @@ -272,7 +437,7 @@ <https://pypi.org/project/frappuccino/>`_ (still in beta): -The following items are new and mostly related to understanding ``__tracebackbhide__``:: +The following items are new and mostly related to understanding ``__tracebackbide__``:: + IPython.core.debugger.Pdb.do_down(self, arg) + IPython.core.debugger.Pdb.do_skip_hidden(self, arg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-7.22.0/setup.py new/ipython-7.25.0/setup.py --- old/ipython-7.22.0/setup.py 2021-03-27 01:47:57.000000000 +0100 +++ new/ipython-7.25.0/setup.py 2021-06-25 17:26:39.000000000 +0200 @@ -184,7 +184,7 @@ "pygments", "nbformat", "ipykernel", - "numpy>=1.16", + "numpy>=1.17", ], terminal=[], kernel=["ipykernel"], @@ -202,6 +202,7 @@ "prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1", "pygments", "backcall", + "matplotlib-inline", ] # Platform-specific dependencies:
