Hello community,

here is the log from the commit of package python-six for openSUSE:Factory 
checked in at 2020-06-05 20:00:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-six (Old)
 and      /work/SRC/openSUSE:Factory/.python-six.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-six"

Fri Jun  5 20:00:27 2020 rev:38 rq:811025 version:1.15.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-six/python-six.changes    2020-03-16 
10:17:32.939567945 +0100
+++ /work/SRC/openSUSE:Factory/.python-six.new.3606/python-six.changes  
2020-06-05 20:00:35.052013433 +0200
@@ -1,0 +2,6 @@
+Tue Jun  2 17:11:49 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 1.15.0:
+ - Pull request #331: Optimize `six.ensure_str` and `six.ensure_binary`.
+
+-------------------------------------------------------------------

Old:
----
  six-1.14.0.tar.gz

New:
----
  six-1.15.0.tar.gz

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

Other differences:
------------------
++++++ python-six.spec ++++++
--- /var/tmp/diff_new_pack.GjBYtd/_old  2020-06-05 20:00:37.804022459 +0200
+++ /var/tmp/diff_new_pack.GjBYtd/_new  2020-06-05 20:00:37.808022472 +0200
@@ -28,7 +28,7 @@
 %define psuffix %{nil}
 %endif
 Name:           python-six%{psuffix}
-Version:        1.14.0
+Version:        1.15.0
 Release:        0
 Summary:        Python 2 and 3 compatibility utilities
 License:        MIT

++++++ six-1.14.0.tar.gz -> six-1.15.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/six-1.14.0/CHANGES new/six-1.15.0/CHANGES
--- old/six-1.14.0/CHANGES      2020-01-15 19:10:01.000000000 +0100
+++ new/six-1.15.0/CHANGES      2020-05-21 17:25:33.000000000 +0200
@@ -3,6 +3,11 @@
 
 This file lists the changes in each six version.
 
+1.15.0
+------
+
+- Pull request #331: Optimize `six.ensure_str` and `six.ensure_binary`.
+
 1.14.0
 ------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/six-1.14.0/PKG-INFO new/six-1.15.0/PKG-INFO
--- old/six-1.14.0/PKG-INFO     2020-01-15 19:10:19.026476400 +0100
+++ new/six-1.15.0/PKG-INFO     2020-05-21 17:25:53.508234700 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: six
-Version: 1.14.0
+Version: 1.15.0
 Summary: Python 2 and 3 compatibility utilities
 Home-page: https://github.com/benjaminp/six
 Author: Benjamin Peterson
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/six-1.14.0/documentation/index.rst 
new/six-1.15.0/documentation/index.rst
--- old/six-1.14.0/documentation/index.rst      2020-01-15 19:10:01.000000000 
+0100
+++ new/six-1.15.0/documentation/index.rst      2020-05-21 17:25:33.000000000 
+0200
@@ -452,7 +452,7 @@
 .. function:: ensure_text(s, encoding='utf-8', errors='strict')
 
    Coerce *s* to :data:`text_type`. *encoding*, *errors* are the same as
-   :meth:`py3:str.encode`
+   :meth:`py3:bytes.decode`
 
 
 .. data:: StringIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/six-1.14.0/six.egg-info/PKG-INFO 
new/six-1.15.0/six.egg-info/PKG-INFO
--- old/six-1.14.0/six.egg-info/PKG-INFO        2020-01-15 19:10:18.000000000 
+0100
+++ new/six-1.15.0/six.egg-info/PKG-INFO        2020-05-21 17:25:53.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: six
-Version: 1.14.0
+Version: 1.15.0
 Summary: Python 2 and 3 compatibility utilities
 Home-page: https://github.com/benjaminp/six
 Author: Benjamin Peterson
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/six-1.14.0/six.py new/six-1.15.0/six.py
--- old/six-1.14.0/six.py       2020-01-15 19:10:01.000000000 +0100
+++ new/six-1.15.0/six.py       2020-05-21 17:25:33.000000000 +0200
@@ -29,7 +29,7 @@
 import types
 
 __author__ = "Benjamin Peterson <[email protected]>"
-__version__ = "1.14.0"
+__version__ = "1.15.0"
 
 
 # Useful for very coarse version differentiation.
@@ -890,12 +890,11 @@
       - `str` -> encoded to `bytes`
       - `bytes` -> `bytes`
     """
+    if isinstance(s, binary_type):
+        return s
     if isinstance(s, text_type):
         return s.encode(encoding, errors)
-    elif isinstance(s, binary_type):
-        return s
-    else:
-        raise TypeError("not expecting type '%s'" % type(s))
+    raise TypeError("not expecting type '%s'" % type(s))
 
 
 def ensure_str(s, encoding='utf-8', errors='strict'):
@@ -909,12 +908,15 @@
       - `str` -> `str`
       - `bytes` -> decoded to `str`
     """
-    if not isinstance(s, (text_type, binary_type)):
-        raise TypeError("not expecting type '%s'" % type(s))
+    # Optimization: Fast return for the common case.
+    if type(s) is str:
+        return s
     if PY2 and isinstance(s, text_type):
-        s = s.encode(encoding, errors)
+        return s.encode(encoding, errors)
     elif PY3 and isinstance(s, binary_type):
-        s = s.decode(encoding, errors)
+        return s.decode(encoding, errors)
+    elif not isinstance(s, (text_type, binary_type)):
+        raise TypeError("not expecting type '%s'" % type(s))
     return s
 
 


Reply via email to