From 13d64f9479a1b904caa7398407dac1283ef533a7 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 2 Oct 2023 09:57:25 +0200 Subject: [PATCH 1/4] Backport PR #14198: Revert "fix semicolon detection with no history" --- IPython/core/displayhook.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/IPython/core/displayhook.py b/IPython/core/displayhook.py index 1ea8d8506f5..b411f116139 100644 --- a/IPython/core/displayhook.py +++ b/IPython/core/displayhook.py @@ -51,7 +51,7 @@ def __init__(self, shell=None, cache_size=1000, **kwargs): # we need a reference to the user-level namespace self.shell = shell - + self._,self.__,self.___ = '','','' # these are deliberately global: @@ -83,9 +83,15 @@ def check_for_underscore(self): def quiet(self): """Should we silence the display hook because of ';'?""" - if self.exec_result is not None: - return self.semicolon_at_end_of_expression(self.exec_result.info.raw_cell) - return False + # 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) @staticmethod def semicolon_at_end_of_expression(expression): @@ -274,12 +280,13 @@ def cull_cache(self): 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: From 355cca6cd92c147136f49af6a23339a3ee8c52ad Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 2 Oct 2023 10:19:22 +0200 Subject: [PATCH 2/4] Backport PR #14200: Update what's new for 8.16.1 --- docs/source/whatsnew/version8.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/source/whatsnew/version8.rst b/docs/source/whatsnew/version8.rst index b5c599c425a..830e6bba276 100644 --- a/docs/source/whatsnew/version8.rst +++ b/docs/source/whatsnew/version8.rst @@ -3,9 +3,10 @@ ============ .. _version 8.16: +.. _version 8.16.1: -IPython 8.16 ------------- +IPython 8.16, 8.16.1 +-------------------- Small double release of IPython (with the 8.12.3 release notes just below). Mostly bug fixes and cleanups, and type annotations. Of interest for users: @@ -13,12 +14,16 @@ Mostly bug fixes and cleanups, and type annotations. Of interest for users: - :ghpull:`14153` Fix a bug of the new iPdb chained traceback where some Exception would not have any traceback. (see upstream fix in CPython for more details). - - :ghpull:`14163` Fix an error where semicolon would not suppress output. - :ghpull:`14168` Fix case with spurious message about event loops when using matplotlib. -As usual you can find the full list of PRs on GitHub under `the 8.16 milestone -`__. +This PR is in 8.16.0 but reverted in 8.16.1, we'll rework the fix for 8.17 + + - :ghpull:`14163` Fix an error where semicolon would not suppress output. + +As usual you can find the full list of PRs on GitHub under `the 8.16 +`__ and `8.16.1 milestone +`__. Thanks to the `D.E. Shaw group `__ for the request and sponsoring the work. From a2af83ddfda76f7a84a0b32700a4259596bc4683 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 2 Oct 2023 10:25:24 +0200 Subject: [PATCH 3/4] release 8.16.1 --- IPython/core/release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/core/release.py b/IPython/core/release.py index 4d0a244e40e..152ebcb87bb 100644 --- a/IPython/core/release.py +++ b/IPython/core/release.py @@ -17,7 +17,7 @@ # version _version_major = 8 _version_minor = 16 -_version_patch = 0 +_version_patch = 1 _version_extra = ".dev" # _version_extra = "rc1" _version_extra = "" # Uncomment this for full releases From b33bab93a2a2bad19d93b40d2dd6a7fca5138eb2 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 2 Oct 2023 10:25:46 +0200 Subject: [PATCH 4/4] back to dev --- IPython/core/release.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/core/release.py b/IPython/core/release.py index 152ebcb87bb..4be11ac4525 100644 --- a/IPython/core/release.py +++ b/IPython/core/release.py @@ -17,10 +17,10 @@ # version _version_major = 8 _version_minor = 16 -_version_patch = 1 +_version_patch = 2 _version_extra = ".dev" # _version_extra = "rc1" -_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]