Thread View
j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
https://hg.python.org/cpython/rev/f87239a2499b
changeset: 102980:f87239a2499b
user: Terry Jan Reedy <tjreedy(a)udel.edu>
date: Wed Aug 31 19:45:39 2016 -0400
summary:
Improve idlelib.textview comments.
files:
Lib/idlelib/textview.py | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textview.py
--- a/Lib/idlelib/textview.py
+++ b/Lib/idlelib/textview.py
@@ -7,9 +7,8 @@
class TextViewer(Toplevel):
- """A simple text viewer dialog for IDLE
+ "A simple text viewer dialog for IDLE."
- """
def __init__(self, parent, title, text, modal=True, _htest=False):
"""Show the given text in a scrollable window with a 'close' button
@@ -21,11 +20,11 @@
"""
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
- # place dialog below parent if running htest
+ # Place dialog below parent if running htest.
self.geometry("=%dx%d+%d+%d" % (750, 500,
parent.winfo_rootx() + 10,
parent.winfo_rooty() + (10 if not _htest else 100)))
- #elguavas - config placeholders til config stuff completed
+ # TODO: get fg/bg from theme.
self.bg = '#ffffff'
self.fg = '#000000'
@@ -34,9 +33,9 @@
self.protocol("WM_DELETE_WINDOW", self.Ok)
self.parent = parent
self.textView.focus_set()
- #key bindings for this dialog
- self.bind('<Return>',self.Ok) #dismiss dialog
- self.bind('<Escape>',self.Ok) #dismiss dialog
+ # Bind keys for closing this dialog.
+ self.bind('<Return>',self.Ok)
+ self.bind('<Escape>',self.Ok)
self.textView.insert(0.0, text)
self.textView.config(state=DISABLED)
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/28ce37a2d888
changeset: 102979:28ce37a2d888
user: Terry Jan Reedy <tjreedy(a)udel.edu>
date: Wed Aug 31 19:37:28 2016 -0400
summary:
Issue #27891: Tweak new idlelib README entry.
files:
Lib/idlelib/README.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt
--- a/Lib/idlelib/README.txt
+++ b/Lib/idlelib/README.txt
@@ -242,8 +242,8 @@
together by module, ignoring within module objects.
Put 'import __main__' after other idlelib imports.
-Imports only needed for testing are not at the top but are put in the
-htest function def or the "if __name__ == '__main__'" clause.
+Imports only needed for testing are put not at the top but in an
+htest function def or "if __name__ == '__main__'" clause.
Within module imports like "from idlelib.mod import class" may cause
circular imports to deadlock. Even without this, circular imports may
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/f23fc0f48ebe
changeset: 102978:f23fc0f48ebe
parent: 102975:fcf65749ef71
parent: 102977:5ae941fef3be
user: Raymond Hettinger <python(a)rcn.com>
date: Wed Aug 31 15:01:28 2016 -0700
summary:
Merge
files:
Lib/random.py | 7 +++++++
Lib/test/test_random.py | 18 ++++++++++++++++++
Misc/NEWS | 5 +++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/Lib/random.py b/Lib/random.py
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -112,6 +112,13 @@
import time
a = int(time.time() * 256) # use fractional seconds
+ if version == 1 and isinstance(a, (str, bytes)):
+ x = ord(a[0]) << 7 if a else 0
+ for c in a:
+ x = ((1000003 * x) ^ ord(c)) & 0xFFFFFFFFFFFFFFFF
+ x ^= len(a)
+ a = -2 if x == -1 else x
+
if version == 2:
if isinstance(a, (str, bytes, bytearray)):
if isinstance(a, str):
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -326,6 +326,24 @@
['0x1.1239ddfb11b7cp-3', '0x1.b3cbb5c51b120p-4',
'0x1.8c4f55116b60fp-1', '0x1.63eb525174a27p-1'])
+ def test_bug_27706(self):
+ # Verify that version 1 seeds are unaffected by hash randomization
+
+ self.gen.seed('nofar', version=1) # hash('nofar') == 5990528763808513177
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.8645314505ad7p-1', '0x1.afb1f82e40a40p-5',
+ '0x1.2a59d2285e971p-1', '0x1.56977142a7880p-6'])
+
+ self.gen.seed('rachel', version=1) # hash('rachel') == -9091735575445484789
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.0b294cc856fcdp-1', '0x1.2ad22d79e77b8p-3',
+ '0x1.3052b9c072678p-2', '0x1.578f332106574p-3'])
+
+ self.gen.seed('', version=1) # hash('') == 0
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1',
+ '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2'])
+
def test_setstate_first_arg(self):
self.assertRaises(ValueError, self.gen.setstate, (1, None, None))
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,11 @@
- Issue #19884: Avoid spurious output on OS X with Gnu Readline.
+- Issue #27706: Restore deterministic behavior of random.Random().seed()
+ for string seeds using seeding version 1. Allows sequences of calls
+ to random() to exactly match those obtained in Python 2.
+ Patch by Nofar Schnider.
+
- Issue #10513: Fix a regression in Connection.commit(). Statements should
not be reset after a commit.
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/5ae941fef3be
changeset: 102977:5ae941fef3be
branch: 3.5
parent: 102974:dfaa38a8c7ec
user: Raymond Hettinger <python(a)rcn.com>
date: Wed Aug 31 15:01:08 2016 -0700
summary:
Issue #27706: Fix regression in random.seed(somestr, version=1)
files:
Lib/random.py | 7 +++++++
Lib/test/test_random.py | 18 ++++++++++++++++++
Misc/NEWS | 5 +++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/Lib/random.py b/Lib/random.py
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -112,6 +112,13 @@
import time
a = int(time.time() * 256) # use fractional seconds
+ if version == 1 and isinstance(a, (str, bytes)):
+ x = ord(a[0]) << 7 if a else 0
+ for c in a:
+ x = ((1000003 * x) ^ ord(c)) & 0xFFFFFFFFFFFFFFFF
+ x ^= len(a)
+ a = -2 if x == -1 else x
+
if version == 2:
if isinstance(a, (str, bytes, bytearray)):
if isinstance(a, str):
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -326,6 +326,24 @@
['0x1.1239ddfb11b7cp-3', '0x1.b3cbb5c51b120p-4',
'0x1.8c4f55116b60fp-1', '0x1.63eb525174a27p-1'])
+ def test_bug_27706(self):
+ # Verify that version 1 seeds are unaffected by hash randomization
+
+ self.gen.seed('nofar', version=1) # hash('nofar') == 5990528763808513177
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.8645314505ad7p-1', '0x1.afb1f82e40a40p-5',
+ '0x1.2a59d2285e971p-1', '0x1.56977142a7880p-6'])
+
+ self.gen.seed('rachel', version=1) # hash('rachel') == -9091735575445484789
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.0b294cc856fcdp-1', '0x1.2ad22d79e77b8p-3',
+ '0x1.3052b9c072678p-2', '0x1.578f332106574p-3'])
+
+ self.gen.seed('', version=1) # hash('') == 0
+ self.assertEqual([self.gen.random().hex() for i in range(4)],
+ ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1',
+ '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2'])
+
def test_setstate_first_arg(self):
self.assertRaises(ValueError, self.gen.setstate, (1, None, None))
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,11 @@
- Issue #19884: Avoid spurious output on OS X with Gnu Readline.
+- Issue #27706: Restore deterministic behavior of random.Random().seed()
+ for string seeds using seeding version 1. Allows sequences of calls
+ to random() to exactly match those obtained in Python 2.
+ Patch by Nofar Schnider.
+
- Issue #10513: Fix a regression in Connection.commit(). Statements should
not be reset after a commit.
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/1f37903e6040
changeset: 102976:1f37903e6040
branch: 2.7
parent: 102961:f478f9b88319
user: Raymond Hettinger <python(a)rcn.com>
date: Wed Aug 31 14:57:32 2016 -0700
summary:
Issue #27706: Document that random.seed() is non-deterministic when PYTHONHASHSEED is enabled
files:
Doc/library/random.rst | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -80,6 +80,9 @@
they are used instead of the system time (see the :func:`os.urandom` function
for details on availability).
+ If a :term:`hashable` object is given, deterministic results are only assured
+ when :envvar:`PYTHONHASHSEED` is disabled.
+
.. versionchanged:: 2.4
formerly, operating system resources were not used.
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/fcf65749ef71
changeset: 102975:fcf65749ef71
parent: 102972:c9592e878dfa
parent: 102974:dfaa38a8c7ec
user: Guido van Rossum <guido(a)dropbox.com>
date: Wed Aug 31 09:47:08 2016 -0700
summary:
Merge asyncio from 3.5
files:
Lib/asyncio/unix_events.py | 33 ++++--
Lib/test/test_asyncio/test_events.py | 75 ++++++++++++++++
2 files changed, 97 insertions(+), 11 deletions(-)
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -305,14 +305,20 @@
self._loop = loop
self._pipe = pipe
self._fileno = pipe.fileno()
+ self._protocol = protocol
+ self._closing = False
+
mode = os.fstat(self._fileno).st_mode
if not (stat.S_ISFIFO(mode) or
stat.S_ISSOCK(mode) or
stat.S_ISCHR(mode)):
+ self._pipe = None
+ self._fileno = None
+ self._protocol = None
raise ValueError("Pipe transport is for pipes/sockets only.")
+
_set_nonblocking(self._fileno)
- self._protocol = protocol
- self._closing = False
+
self._loop.call_soon(self._protocol.connection_made, self)
# only start reading when connection_made() has been called
self._loop.call_soon(self._loop.add_reader,
@@ -422,25 +428,30 @@
self._extra['pipe'] = pipe
self._pipe = pipe
self._fileno = pipe.fileno()
- mode = os.fstat(self._fileno).st_mode
- is_socket = stat.S_ISSOCK(mode)
- if not (is_socket or
- stat.S_ISFIFO(mode) or
- stat.S_ISCHR(mode)):
- raise ValueError("Pipe transport is only for "
- "pipes, sockets and character devices")
- _set_nonblocking(self._fileno)
self._protocol = protocol
self._buffer = []
self._conn_lost = 0
self._closing = False # Set when close() or write_eof() called.
+ mode = os.fstat(self._fileno).st_mode
+ is_char = stat.S_ISCHR(mode)
+ is_fifo = stat.S_ISFIFO(mode)
+ is_socket = stat.S_ISSOCK(mode)
+ if not (is_char or is_fifo or is_socket):
+ self._pipe = None
+ self._fileno = None
+ self._protocol = None
+ raise ValueError("Pipe transport is only for "
+ "pipes, sockets and character devices")
+
+ _set_nonblocking(self._fileno)
+
self._loop.call_soon(self._protocol.connection_made, self)
# On AIX, the reader trick (to be notified when the read end of the
# socket is closed) only works for sockets. On other platforms it
# works for pipes and sockets. (Exception: OS X 10.4? Issue #19294.)
- if is_socket or not sys.platform.startswith("aix"):
+ if is_socket or (is_fifo and not sys.platform.startswith("aix")):
# only start reading when connection_made() has been called
self._loop.call_soon(self._loop.add_reader,
self._fileno, self._read_ready)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -21,6 +21,8 @@
from unittest import mock
import weakref
+if sys.platform != 'win32':
+ import tty
import asyncio
from asyncio import proactor_events
@@ -1626,6 +1628,79 @@
self.loop.run_until_complete(proto.done)
self.assertEqual('CLOSED', proto.state)
+ @unittest.skipUnless(sys.platform != 'win32',
+ "Don't support pipes for Windows")
+ # select, poll and kqueue don't support character devices (PTY) on Mac OS X
+ # older than 10.6 (Snow Leopard)
+ @support.requires_mac_ver(10, 6)
+ def test_bidirectional_pty(self):
+ master, read_slave = os.openpty()
+ write_slave = os.dup(read_slave)
+ tty.setraw(read_slave)
+
+ slave_read_obj = io.open(read_slave, 'rb', 0)
+ read_proto = MyReadPipeProto(loop=self.loop)
+ read_connect = self.loop.connect_read_pipe(lambda: read_proto,
+ slave_read_obj)
+ read_transport, p = self.loop.run_until_complete(read_connect)
+ self.assertIs(p, read_proto)
+ self.assertIs(read_transport, read_proto.transport)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(0, read_proto.nbytes)
+
+
+ slave_write_obj = io.open(write_slave, 'wb', 0)
+ write_proto = MyWritePipeProto(loop=self.loop)
+ write_connect = self.loop.connect_write_pipe(lambda: write_proto,
+ slave_write_obj)
+ write_transport, p = self.loop.run_until_complete(write_connect)
+ self.assertIs(p, write_proto)
+ self.assertIs(write_transport, write_proto.transport)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ data = bytearray()
+ def reader(data):
+ chunk = os.read(master, 1024)
+ data += chunk
+ return len(data)
+
+ write_transport.write(b'1')
+ test_utils.run_until(self.loop, lambda: reader(data) >= 1, timeout=10)
+ self.assertEqual(b'1', data)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.write(master, b'a')
+ test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 1,
+ timeout=10)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(1, read_proto.nbytes)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ write_transport.write(b'2345')
+ test_utils.run_until(self.loop, lambda: reader(data) >= 5, timeout=10)
+ self.assertEqual(b'12345', data)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.write(master, b'bcde')
+ test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 5,
+ timeout=10)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(5, read_proto.nbytes)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.close(master)
+
+ read_transport.close()
+ self.loop.run_until_complete(read_proto.done)
+ self.assertEqual(
+ ['INITIAL', 'CONNECTED', 'EOF', 'CLOSED'], read_proto.state)
+
+ write_transport.close()
+ self.loop.run_until_complete(write_proto.done)
+ self.assertEqual('CLOSED', write_proto.state)
+
def test_prompt_cancellation(self):
r, w = test_utils.socketpair()
r.setblocking(False)
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/fa8fadc7f065
changeset: 102973:fa8fadc7f065
branch: 3.5
parent: 102971:2a748320616b
user: Guido van Rossum <guido(a)python.org>
date: Wed Aug 31 09:40:18 2016 -0700
summary:
Don't select for read on character devices in _UnixWritePipeTransport.
Upstream https://github.com/python/asyncio/pull/374 by Ron Frederick.
files:
Lib/asyncio/unix_events.py | 8 +-
Lib/test/test_asyncio/test_events.py | 75 ++++++++++++++++
2 files changed, 79 insertions(+), 4 deletions(-)
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -422,10 +422,10 @@
self._pipe = pipe
self._fileno = pipe.fileno()
mode = os.fstat(self._fileno).st_mode
+ is_char = stat.S_ISCHR(mode)
+ is_fifo = stat.S_ISFIFO(mode)
is_socket = stat.S_ISSOCK(mode)
- if not (is_socket or
- stat.S_ISFIFO(mode) or
- stat.S_ISCHR(mode)):
+ if not (is_char or is_fifo or is_socket):
raise ValueError("Pipe transport is only for "
"pipes, sockets and character devices")
_set_nonblocking(self._fileno)
@@ -439,7 +439,7 @@
# On AIX, the reader trick (to be notified when the read end of the
# socket is closed) only works for sockets. On other platforms it
# works for pipes and sockets. (Exception: OS X 10.4? Issue #19294.)
- if is_socket or not sys.platform.startswith("aix"):
+ if is_socket or (is_fifo and not sys.platform.startswith("aix")):
# only start reading when connection_made() has been called
self._loop.call_soon(self._loop.add_reader,
self._fileno, self._read_ready)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -21,6 +21,8 @@
from unittest import mock
import weakref
+if sys.platform != 'win32':
+ import tty
import asyncio
from asyncio import proactor_events
@@ -1626,6 +1628,79 @@
self.loop.run_until_complete(proto.done)
self.assertEqual('CLOSED', proto.state)
+ @unittest.skipUnless(sys.platform != 'win32',
+ "Don't support pipes for Windows")
+ # select, poll and kqueue don't support character devices (PTY) on Mac OS X
+ # older than 10.6 (Snow Leopard)
+ @support.requires_mac_ver(10, 6)
+ def test_bidirectional_pty(self):
+ master, read_slave = os.openpty()
+ write_slave = os.dup(read_slave)
+ tty.setraw(read_slave)
+
+ slave_read_obj = io.open(read_slave, 'rb', 0)
+ read_proto = MyReadPipeProto(loop=self.loop)
+ read_connect = self.loop.connect_read_pipe(lambda: read_proto,
+ slave_read_obj)
+ read_transport, p = self.loop.run_until_complete(read_connect)
+ self.assertIs(p, read_proto)
+ self.assertIs(read_transport, read_proto.transport)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(0, read_proto.nbytes)
+
+
+ slave_write_obj = io.open(write_slave, 'wb', 0)
+ write_proto = MyWritePipeProto(loop=self.loop)
+ write_connect = self.loop.connect_write_pipe(lambda: write_proto,
+ slave_write_obj)
+ write_transport, p = self.loop.run_until_complete(write_connect)
+ self.assertIs(p, write_proto)
+ self.assertIs(write_transport, write_proto.transport)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ data = bytearray()
+ def reader(data):
+ chunk = os.read(master, 1024)
+ data += chunk
+ return len(data)
+
+ write_transport.write(b'1')
+ test_utils.run_until(self.loop, lambda: reader(data) >= 1, timeout=10)
+ self.assertEqual(b'1', data)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.write(master, b'a')
+ test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 1,
+ timeout=10)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(1, read_proto.nbytes)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ write_transport.write(b'2345')
+ test_utils.run_until(self.loop, lambda: reader(data) >= 5, timeout=10)
+ self.assertEqual(b'12345', data)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.write(master, b'bcde')
+ test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 5,
+ timeout=10)
+ self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state)
+ self.assertEqual(5, read_proto.nbytes)
+ self.assertEqual('CONNECTED', write_proto.state)
+
+ os.close(master)
+
+ read_transport.close()
+ self.loop.run_until_complete(read_proto.done)
+ self.assertEqual(
+ ['INITIAL', 'CONNECTED', 'EOF', 'CLOSED'], read_proto.state)
+
+ write_transport.close()
+ self.loop.run_until_complete(write_proto.done)
+ self.assertEqual('CLOSED', write_proto.state)
+
def test_prompt_cancellation(self):
r, w = test_utils.socketpair()
r.setblocking(False)
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/dfaa38a8c7ec
changeset: 102974:dfaa38a8c7ec
branch: 3.5
user: Guido van Rossum <guido(a)python.org>
date: Wed Aug 31 09:42:38 2016 -0700
summary:
Fix ordering issues in UNIX read/write pipe transport constructors.
Upstream https://github.com/python/asyncio/pull/408 by Ron Frederick.
files:
Lib/asyncio/unix_events.py | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -305,14 +305,20 @@
self._loop = loop
self._pipe = pipe
self._fileno = pipe.fileno()
+ self._protocol = protocol
+ self._closing = False
+
mode = os.fstat(self._fileno).st_mode
if not (stat.S_ISFIFO(mode) or
stat.S_ISSOCK(mode) or
stat.S_ISCHR(mode)):
+ self._pipe = None
+ self._fileno = None
+ self._protocol = None
raise ValueError("Pipe transport is for pipes/sockets only.")
+
_set_nonblocking(self._fileno)
- self._protocol = protocol
- self._closing = False
+
self._loop.call_soon(self._protocol.connection_made, self)
# only start reading when connection_made() has been called
self._loop.call_soon(self._loop.add_reader,
@@ -421,18 +427,23 @@
self._extra['pipe'] = pipe
self._pipe = pipe
self._fileno = pipe.fileno()
+ self._protocol = protocol
+ self._buffer = []
+ self._conn_lost = 0
+ self._closing = False # Set when close() or write_eof() called.
+
mode = os.fstat(self._fileno).st_mode
is_char = stat.S_ISCHR(mode)
is_fifo = stat.S_ISFIFO(mode)
is_socket = stat.S_ISSOCK(mode)
if not (is_char or is_fifo or is_socket):
+ self._pipe = None
+ self._fileno = None
+ self._protocol = None
raise ValueError("Pipe transport is only for "
"pipes, sockets and character devices")
+
_set_nonblocking(self._fileno)
- self._protocol = protocol
- self._buffer = []
- self._conn_lost = 0
- self._closing = False # Set when close() or write_eof() called.
self._loop.call_soon(self._protocol.connection_made, self)
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/2a748320616b
changeset: 102971:2a748320616b
branch: 3.5
parent: 102969:caf547c9e589
user: Guido van Rossum <guido(a)python.org>
date: Wed Aug 31 09:08:41 2016 -0700
summary:
Issue #27907: variable rename. (Ville Skyttä)
files:
Lib/test/test_asyncio/test_events.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -763,11 +763,11 @@
addr = lsock.getsockname()
message = b'test data'
- reponse = None
+ response = None
expected_response = b'roger'
def client():
- global response
+ nonlocal response
try:
csock = socket.socket()
if client_ssl is not None:
--
Repository URL: https://hg.python.org/cpython
https://hg.python.org/cpython/rev/c9592e878dfa
changeset: 102972:c9592e878dfa
parent: 102970:16bba5b49441
parent: 102971:2a748320616b
user: Guido van Rossum <guido(a)dropbox.com>
date: Wed Aug 31 09:09:04 2016 -0700
summary:
Issue #27907: variable rename. (Ville Skyttä) (Merge 3.5->3.6)
files:
Lib/test/test_asyncio/test_events.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -763,11 +763,11 @@
addr = lsock.getsockname()
message = b'test data'
- reponse = None
+ response = None
expected_response = b'roger'
def client():
- global response
+ nonlocal response
try:
csock = socket.socket()
if client_ssl is not None:
--
Repository URL: https://hg.python.org/cpython