Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de>
Branch: py3.6
Changeset: r97453:6e81e44fab5b
Date: 2019-09-11 23:18 +0200
http://bitbucket.org/pypy/pypy/changeset/6e81e44fab5b/

Log:    merge default

diff --git a/pypy/module/_codecs/interp_codecs.py 
b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -715,6 +715,8 @@
 @unwrap_spec(errors='text_or_none')
 def utf_8_encode(space, w_obj, errors="strict"):
     utf8, lgt = space.utf8_len_w(w_obj)
+    if lgt == len(utf8): # ascii
+        return space.newtuple([space.newbytes(utf8), space.newint(lgt)])
     if errors is None:
         errors = 'strict'
     state = space.fromcache(CodecState)
diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -56,7 +56,7 @@
         # `__IOBase_closed` and call flush() by itself, but it is redundant
         # with whatever behaviour a non-trivial derived class will implement.
         self.space = space
-        self.w_dict = space.newdict()
+        self.w_dict = space.newdict(instance=True)
         self.__IOBase_closed = False
         if add_to_autoflusher:
             get_autoflusher(space).add(self)
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -928,9 +928,13 @@
         return space.newint(textlen)
 
     def _writeflush(self, space):
+        # jit inlinable fast path
         if not self.pending_bytes:
             return
 
+        self._really_flush(space)
+
+    def _really_flush(self, space):
         pending_bytes = ''.join(self.pending_bytes)
         self.pending_bytes = None
         self.pending_bytes_count = 0
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to