summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-06-04 22:28:14 +0200
committerChris Liechti <cliechti@gmx.net>2016-06-04 22:28:14 +0200
commit5984842cc5f785c181c2655425e40026344b4fee (patch)
treecec8ed0108bd9d262dccc1d61462697f17e398c9
parent68cecce2bfb35faf547d996fdd55d5ffb6642dcf (diff)
downloadpyserial-git-5984842cc5f785c181c2655425e40026344b4fee.tar.gz
posix: deprecate "nonblocking" method
-rw-r--r--documentation/pyserial_api.rst7
-rw-r--r--serial/aio.py1
-rw-r--r--serial/serialposix.py11
3 files changed, 9 insertions, 10 deletions
diff --git a/documentation/pyserial_api.rst b/documentation/pyserial_api.rst
index 6e9cf20..75e19e7 100644
--- a/documentation/pyserial_api.rst
+++ b/documentation/pyserial_api.rst
@@ -485,9 +485,10 @@ Native ports
:platform: Posix
- Configure the device for nonblocking operation. This can be useful if
- the port is used with :mod:`select`. Note that :attr:`timeout` must
- also be set to ``0``
+ .. deprecated:: 3.2
+ The serial port is already opened in this mode. This method is not
+ needed and going away.
+
.. method:: fileno()
diff --git a/serial/aio.py b/serial/aio.py
index b3238db..5756be0 100644
--- a/serial/aio.py
+++ b/serial/aio.py
@@ -52,7 +52,6 @@ class SerialTransport(asyncio.Transport):
# Asynchronous I/O requires non-blocking devices
self._serial.timeout = 0
self._serial.write_timeout = 0
- self._serial.nonblocking()
# These two callbacks will be enqueued in a FIFO queue by asyncio
loop.call_soon(protocol.connection_made, self)
diff --git a/serial/serialposix.py b/serial/serialposix.py
index 28164d8..bc2468c 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -635,12 +635,6 @@ class Serial(SerialBase, PlatformSpecific):
s = fcntl.ioctl(self.fd, TIOCOUTQ, TIOCM_zero_str)
return struct.unpack('I', s)[0]
- def nonblocking(self):
- """internal - not portable!"""
- if not self.is_open:
- raise portNotOpenError
- fcntl.fcntl(self.fd, fcntl.F_SETFL, os.O_NONBLOCK)
-
def fileno(self):
"""\
For easier use of the serial port instance with select.
@@ -676,6 +670,11 @@ class Serial(SerialBase, PlatformSpecific):
else:
termios.tcflow(self.fd, termios.TCOOFF)
+ def nonblocking(self):
+ """DEPRECATED - has no use"""
+ import warnings
+ warnings.warn("nonblocking() has no effect, already nonblocking", DeprecationWarning)
+
class PosixPollSerial(Serial):
"""\