Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ptpython for openSUSE:Factory 
checked in at 2024-09-02 13:14:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ptpython (Old)
 and      /work/SRC/openSUSE:Factory/.python-ptpython.new.2698 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ptpython"

Mon Sep  2 13:14:13 2024 rev:15 rq:1198055 version:3.0.29

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ptpython/python-ptpython.changes  
2024-06-07 15:04:37.702530356 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-ptpython.new.2698/python-ptpython.changes    
    2024-09-02 13:14:19.946057907 +0200
@@ -1,0 +2,11 @@
+Sat Aug 31 12:08:45 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 3.0.29:
+  * Further improve performance of dictionary completions.
+  * Custom 'exit' function to return from REPL that
+  * doesn't terminate `sys.stdin` when `exit` is called
+    (important for `embed()`).
+  * doesn't require to be called with parentheses.
+  * Clean up signatures on control-c.
+
+-------------------------------------------------------------------

Old:
----
  ptpython-3.0.27.tar.gz

New:
----
  ptpython-3.0.29.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-ptpython.spec ++++++
--- /var/tmp/diff_new_pack.AsnQl9/_old  2024-09-02 13:14:20.490080530 +0200
+++ /var/tmp/diff_new_pack.AsnQl9/_new  2024-09-02 13:14:20.490080530 +0200
@@ -19,7 +19,7 @@
 %{?sle15_python_module_pythons}
 %define skip_python39 1
 Name:           python-ptpython
-Version:        3.0.27
+Version:        3.0.29
 Release:        0
 Summary:        Python REPL build on top of prompt_toolkit
 License:        ISC

++++++ ptpython-3.0.27.tar.gz -> ptpython-3.0.29.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/CHANGELOG 
new/ptpython-3.0.29/CHANGELOG
--- old/ptpython-3.0.27/CHANGELOG       2024-05-27 22:52:10.000000000 +0200
+++ new/ptpython-3.0.29/CHANGELOG       2024-07-22 14:42:25.000000000 +0200
@@ -1,6 +1,26 @@
 CHANGELOG
 =========
 
+3.0.29: 2024-07-22
+------------------
+
+Fixes:
+- Further improve performance of dictionary completions.
+
+
+3.0.28: 2024-07-22
+------------------
+
+New features:
+- Custom 'exit' function to return from REPL that
+  * doesn't terminate `sys.stdin` when `exit` is called (important for
+    `embed()`).
+  * doesn't require to be called with parentheses.
+
+Fixes:
+- Clean up signatures on control-c.
+
+
 3.0.27: 2024-05-27
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/PKG-INFO new/ptpython-3.0.29/PKG-INFO
--- old/ptpython-3.0.27/PKG-INFO        2024-05-27 22:53:44.847145600 +0200
+++ new/ptpython-3.0.29/PKG-INFO        2024-07-22 14:43:01.023684000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ptpython
-Version: 3.0.27
+Version: 3.0.29
 Summary: Python REPL build on top of prompt_toolkit
 Home-page: https://github.com/prompt-toolkit/ptpython
 Author: Jonathan Slenders
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/ptpython/completer.py 
new/ptpython-3.0.29/ptpython/completer.py
--- old/ptpython-3.0.27/ptpython/completer.py   2024-05-16 14:36:17.000000000 
+0200
+++ new/ptpython-3.0.29/ptpython/completer.py   2024-07-22 14:39:55.000000000 
+0200
@@ -476,20 +476,34 @@
         Complete dictionary keys.
         """
 
-        def meta_repr(value: object) -> Callable[[], str]:
+        def meta_repr(obj: object, key: object) -> Callable[[], str]:
             "Abbreviate meta text, make sure it fits on one line."
+            cached_result: str | None = None
 
             # We return a function, so that it gets computed when it's needed.
             # When there are many completions, that improves the performance
             # quite a bit (for the multi-column completion menu, we only need
             # to display one meta text).
+            # Note that we also do the lookup itself in here (`obj[key]`),
+            # because this part can also be slow for some mapping
+            # implementations.
             def get_value_repr() -> str:
-                text = self._do_repr(value)
+                nonlocal cached_result
+                if cached_result is not None:
+                    return cached_result
+
+                try:
+                    value = obj[key]  # type: ignore
+
+                    text = self._do_repr(value)
+                except BaseException:
+                    return "-"
 
                 # Take first line, if multiple lines.
                 if "\n" in text:
                     text = text.split("\n", 1)[0] + "..."
 
+                cached_result = text
                 return text
 
             return get_value_repr
@@ -504,24 +518,24 @@
             # If this object is a dictionary, complete the keys.
             if isinstance(result, (dict, collections_abc.Mapping)):
                 # Try to evaluate the key.
-                key_obj = key
+                key_obj_str = str(key)
                 for k in [key, key + '"', key + "'"]:
                     try:
-                        key_obj = ast.literal_eval(k)
+                        key_obj_str = str(ast.literal_eval(k))
                     except (SyntaxError, ValueError):
                         continue
                     else:
                         break
 
-                for k, v in result.items():
-                    if str(k).startswith(str(key_obj)):
+                for k in result:
+                    if str(k).startswith(key_obj_str):
                         try:
                             k_repr = self._do_repr(k)
                             yield Completion(
                                 k_repr + "]",
                                 -len(key),
                                 display=f"[{k_repr}]",
-                                display_meta=meta_repr(v),
+                                display_meta=meta_repr(result, k),
                             )
                         except ReprFailedError:
                             pass
@@ -537,7 +551,7 @@
                                     k_repr + "]",
                                     -len(key),
                                     display=f"[{k_repr}]",
-                                    display_meta=meta_repr(result[k]),
+                                    display_meta=meta_repr(result, k),
                                 )
                             except KeyError:
                                 # `result[k]` lookup failed. Trying to complete
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/ptpython/python_input.py 
new/ptpython-3.0.29/ptpython/python_input.py
--- old/ptpython-3.0.27/ptpython/python_input.py        2024-05-16 
14:36:17.000000000 +0200
+++ new/ptpython-3.0.29/ptpython/python_input.py        2024-07-22 
11:02:20.000000000 +0200
@@ -1116,4 +1116,5 @@
                     return result
             except KeyboardInterrupt:
                 # Abort - try again.
+                self.signatures = []
                 self.default_buffer.document = Document()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/ptpython/repl.py 
new/ptpython-3.0.29/ptpython/repl.py
--- old/ptpython-3.0.27/ptpython/repl.py        2024-05-16 14:36:17.000000000 
+0200
+++ new/ptpython-3.0.29/ptpython/repl.py        2024-07-22 11:32:24.000000000 
+0200
@@ -20,7 +20,7 @@
 import warnings
 from dis import COMPILER_FLAG_NAMES
 from pathlib import Path
-from typing import Any, Callable, ContextManager, Iterable, Sequence
+from typing import Any, Callable, ContextManager, Iterable, NoReturn, Sequence
 
 from prompt_toolkit.formatted_text import OneStyleAndTextTuple
 from prompt_toolkit.patch_stdout import patch_stdout as patch_stdout_context
@@ -40,7 +40,15 @@
 except ImportError:
     PyCF_ALLOW_TOP_LEVEL_AWAIT = 0
 
-__all__ = ["PythonRepl", "enable_deprecation_warnings", "run_config", "embed"]
+
+__all__ = [
+    "PythonRepl",
+    "enable_deprecation_warnings",
+    "run_config",
+    "embed",
+    "exit",
+    "ReplExit",
+]
 
 
 def _get_coroutine_flag() -> int | None:
@@ -91,9 +99,16 @@
                 raise
             except SystemExit:
                 raise
+            except ReplExit:
+                raise
             except BaseException as e:
                 self._handle_exception(e)
             else:
+                if isinstance(result, exit):
+                    # When `exit` is evaluated without parentheses.
+                    # Automatically trigger the `ReplExit` exception.
+                    raise ReplExit
+
                 # Print.
                 if result is not None:
                     self._show_result(result)
@@ -155,7 +170,10 @@
                     continue
 
                 # Run it; display the result (or errors if applicable).
-                self.run_and_show_expression(text)
+                try:
+                    self.run_and_show_expression(text)
+                except ReplExit:
+                    return
         finally:
             if self.terminal_title:
                 clear_title()
@@ -383,6 +401,7 @@
             return self
 
         globals["get_ptpython"] = get_ptpython
+        globals["exit"] = exit()
 
     def _remove_from_namespace(self) -> None:
         """
@@ -459,6 +478,29 @@
         enter_to_continue()
 
 
+class exit:
+    """
+    Exit the ptpython REPL.
+    """
+
+    # This custom exit function ensures that the `embed` function returns from
+    # where we are embedded, and Python doesn't close `sys.stdin` like
+    # the default `exit` from `_sitebuiltins.Quitter` does.
+
+    def __call__(self) -> NoReturn:
+        raise ReplExit
+
+    def __repr__(self) -> str:
+        # (Same message as the built-in Python REPL.)
+        return "Use exit() or Ctrl-D (i.e. EOF) to exit"
+
+
+class ReplExit(Exception):
+    """
+    Exception raised by ptpython's exit function.
+    """
+
+
 def embed(
     globals: dict[str, Any] | None = None,
     locals: dict[str, Any] | None = None,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/ptpython.egg-info/PKG-INFO 
new/ptpython-3.0.29/ptpython.egg-info/PKG-INFO
--- old/ptpython-3.0.27/ptpython.egg-info/PKG-INFO      2024-05-27 
22:53:44.000000000 +0200
+++ new/ptpython-3.0.29/ptpython.egg-info/PKG-INFO      2024-07-22 
14:43:00.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ptpython
-Version: 3.0.27
+Version: 3.0.29
 Summary: Python REPL build on top of prompt_toolkit
 Home-page: https://github.com/prompt-toolkit/ptpython
 Author: Jonathan Slenders
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptpython-3.0.27/setup.py new/ptpython-3.0.29/setup.py
--- old/ptpython-3.0.27/setup.py        2024-05-27 22:52:10.000000000 +0200
+++ new/ptpython-3.0.29/setup.py        2024-07-22 14:40:06.000000000 +0200
@@ -11,7 +11,7 @@
 setup(
     name="ptpython",
     author="Jonathan Slenders",
-    version="3.0.27",
+    version="3.0.29",
     url="https://github.com/prompt-toolkit/ptpython";,
     description="Python REPL build on top of prompt_toolkit",
     long_description=long_description,

Reply via email to