public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ipython] rawhide: Update to 9.16.1 (rhbz#2509712)
@ 2026-08-13  7:10 Lumir Balhar
  0 siblings, 0 replies; only message in thread
From: Lumir Balhar @ 2026-08-13  7:10 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/ipython
Branch : rawhide
Commit : 5da362d2e68ac9360b49617c70a6c6024e87f846
Author : Lumir Balhar <lbalhar@redhat.com>
Date   : 2026-08-12T13:23:29+02:00
Stats  : +8/-141 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/ipython/c/5da362d2e68ac9360b49617c70a6c6024e87f846?branch=rawhide

Log:
Update to 9.16.1 (rhbz#2509712)

---
diff --git a/15262.patch b/15262.patch
deleted file mode 100644
index f175af7..0000000
--- a/15262.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-From a715f0bc3a0dcfb830ce0c97a2ad1ec54a46030b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lum=C3=ADr=20Balhar?= <lbalhar@redhat.com>
-Date: Sun, 14 Jun 2026 09:00:31 +0000
-Subject: [PATCH] Fix init_path ignoring CWD when -P used in script shebang
- (#15214)
-
-When Python is invoked as a script with -P in the shebang,
-sys.flags.safe_path is set but -P only excludes the
-script's directory from sys.path, not CWD. The previous fix in 9.7 treated
-safe_path as a blanket signal to skip adding CWD.
-
-Now init_path only honors safe_path when Python was invoked as a module
-(-m) or with -c, which is when -P actually excludes the current working
-directory.
----
- IPython/core/shellapp.py | 19 +++++++++++--
- tests/test_shellapp.py   | 58 ++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 75 insertions(+), 2 deletions(-)
-
-diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py
-index f5199ff7a18..d42fb837ddc 100644
---- a/IPython/core/shellapp.py
-+++ b/IPython/core/shellapp.py
-@@ -247,7 +247,8 @@ def _user_ns_changed(self, change):
-     def init_path(self):
-         """Add current working directory, '', to sys.path
- 
--        Unless disabled by ignore_cwd config or sys.flags.safe_path.
-+        Unless disabled by ignore_cwd config, or sys.flags.safe_path is set
-+        and IPython was not invoked as a plain script.
- 
-         Unlike Python's default, we insert before the first `site-packages`
-         or `dist-packages` directory,
-@@ -259,8 +260,22 @@ def init_path(self):
-             Allow optionally not including the current directory in sys.path
-         .. versionchanged:: 9.7
-             Respect sys.flags.safe_path (PYTHONSAFEPATH and -P flag)
-+        .. versionchanged:: 9.9
-+            Only honor safe_path for -m/-c invocations, not plain scripts.
-+            When Python is run as a script (e.g. via a shebang with -P), -P
-+            only excludes the script's directory from sys.path, not CWD.
-         """
--        if "" in sys.path or self.ignore_cwd or sys.flags.safe_path:
-+        # sys.flags.safe_path is set by -P or PYTHONSAFEPATH. Its meaning
-+        # depends on how Python was invoked:
-+        #   python -m ipython: -P excludes CWD → honor safe_path
-+        #   python -c "...":   -P excludes CWD → honor safe_path
-+        #   python /path/to/ipython (script/shebang): -P only excludes the
-+        #     script's directory, NOT CWD → ignore safe_path
-+        # Detect script invocation: __main__.__spec__ is None for scripts.
-+        _main_spec = getattr(sys.modules.get('__main__'), '__spec__', None)
-+        _argv0 = sys.argv[0] if sys.argv else ''
-+        _is_script_invocation = _main_spec is None and _argv0 not in ('-c', '-')
-+        if "" in sys.path or self.ignore_cwd or (sys.flags.safe_path and not _is_script_invocation):
-             return
-         for idx, path in enumerate(sys.path):
-             parent, last_part = os.path.split(path)
-diff --git a/tests/test_shellapp.py b/tests/test_shellapp.py
-index 3e7964d0e15..0d94de1bfcd 100644
---- a/tests/test_shellapp.py
-+++ b/tests/test_shellapp.py
-@@ -15,12 +15,70 @@
- # -----------------------------------------------------------------------------
- # Imports
- # -----------------------------------------------------------------------------
-+import sys
-+import types
- import unittest
-+from unittest.mock import patch
- 
-+from IPython.core.shellapp import InteractiveShellApp
- from IPython.testing import decorators as dec
- from IPython.testing import tools as tt
- 
- 
-+class _MinimalApp:
-+    """Minimal stub for testing InteractiveShellApp.init_path."""
-+    ignore_cwd = False
-+    init_path = InteractiveShellApp.init_path
-+
-+
-+class TestInitPath(unittest.TestCase):
-+    """Tests for InteractiveShellApp.init_path, focused on safe_path handling."""
-+
-+    def setUp(self):
-+        self._original_path = sys.path[:]
-+        # Remove '' so init_path has a chance to add it
-+        sys.path[:] = [p for p in sys.path if p != '']
-+
-+    def tearDown(self):
-+        sys.path[:] = self._original_path
-+
-+    def _call_init_path(self, safe_path, main_spec, argv0):
-+        app = _MinimalApp()
-+        mock_flags = types.SimpleNamespace(safe_path=safe_path)
-+        mock_main = types.SimpleNamespace(__spec__=main_spec)
-+        with patch('sys.flags', mock_flags), \
-+             patch.dict(sys.modules, {'__main__': mock_main}), \
-+             patch.object(sys, 'argv', [argv0]):
-+            app.init_path()
-+
-+    def test_script_with_safe_path_adds_cwd(self):
-+        """Script invocation with -P/-PYTHONSAFEPATH should still add CWD.
-+
-+        When Python is run as a script (e.g. via a shebang containing -P),
-+        sys.flags.safe_path is set but -P only excludes the script's directory
-+        from sys.path, not CWD.  IPython should still add CWD in this case.
-+        Regression test for https://github.com/ipython/ipython/issues/15214
-+        """
-+        self._call_init_path(safe_path=1, main_spec=None, argv0='/usr/bin/ipython')
-+        self.assertIn('', sys.path)
-+
-+    def test_module_with_safe_path_skips_cwd(self):
-+        """Module invocation (-m) with -P should NOT add CWD."""
-+        mock_spec = types.SimpleNamespace(name='IPython.__main__')
-+        self._call_init_path(safe_path=1, main_spec=mock_spec, argv0='/usr/lib/python/IPython/__main__.py')
-+        self.assertNotIn('', sys.path)
-+
-+    def test_dashc_with_safe_path_skips_cwd(self):
-+        """python -P -c invocation should NOT add CWD."""
-+        self._call_init_path(safe_path=1, main_spec=None, argv0='-c')
-+        self.assertNotIn('', sys.path)
-+
-+    def test_no_safe_path_adds_cwd(self):
-+        """Without safe_path, CWD is always added (existing behavior)."""
-+        self._call_init_path(safe_path=0, main_spec=None, argv0='/usr/bin/ipython')
-+        self.assertIn('', sys.path)
-+
-+
- class TestFileToRun(tt.TempFileMixin, unittest.TestCase):
-     """Test the behavior of the file_to_run parameter."""
- 

diff --git a/ipython.spec b/ipython.spec
index 971ca55..9e430a8 100644
--- a/ipython.spec
+++ b/ipython.spec
@@ -14,7 +14,7 @@
 %endif
 
 Name:           ipython
-Version:        9.15.0
+Version:        9.16.1
 Release:        %autorelease
 Summary:        An enhanced interactive Python shell
 
@@ -27,10 +27,6 @@ License:        BSD-3-Clause AND MIT
 URL:            http://ipython.org/
 Source0:        %pypi_source
 
-# Fix init_path ignoring CWD when -P used in script shebang
-# Fixes rhbz#2479711
-Patch:          https://github.com/ipython/ipython/pull/15262.patch
-
 # Unset -s on python shebang - ensure that packages installed with pip
 # to user locations are seen and properly loaded.
 %undefine _py3_shebang_s
@@ -166,9 +162,12 @@ export IPYTHON_TESTING_TIMEOUT_SCALE=4
 # Switch to a temporary directory to avoid _pytest.pathlib.ImportPathMismatchError
 mkdir test_temp_dir
 pushd test_temp_dir
-# test_get_xdg_dir_3 and test_extension don't work well with out custom paths
-# test_hist_file_config is flaky https://github.com/ipython/ipython/issues/15161
-%pytest -vv -p no:cacheprovider -k "not test_get_xdg_dir_3 and not test_extension and not test_hist_file_config" ../tests
+# - test_get_xdg_dir_3 and test_extension don't work well with out custom paths
+# - test_hist_file_config is flaky https://github.com/ipython/ipython/issues/15161
+# - test_init_path_inserts_before_site_packages and test_init_path_no_site_packages_inserts_front
+#   don't work well with our custom paths
+%pytest -vv -p no:cacheprovider -k "not test_get_xdg_dir_3 and not test_extension and not test_hist_file_config and \
+                                    not test_init_path_inserts_before_site_packages and not test_init_path_no_site_packages_inserts_front" ../tests
 popd
 rm -rf test_temp_dir
 %endif

diff --git a/sources b/sources
index 91c9b9a..52ebeb7 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (ipython-9.15.0.tar.gz) = 120f1f42d58e6844bb48073e6f91520c46d3c08a8d5345e310493e29bd7a1abf9ce654beaf2c8abc9f6feb7d9b1d8b5a9538f1e13e3c3d49068e5743163f2d32
+SHA512 (ipython-9.16.1.tar.gz) = 3d144661ae6521eaf738e71b18b4c89cfca66ac088c53c1ca01eb9be71981769927d5ea5966c8b165badb7143fd34fc4d7fed41a32859e9d003d2ba17511431b

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-13  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-13  7:10 [rpms/ipython] rawhide: Update to 9.16.1 (rhbz#2509712) Lumir Balhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox