summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-10-31 22:37:13 +0100
committerChris Liechti <cliechti@gmx.net>2016-10-31 22:37:13 +0100
commit9e20574a9a6cd369b1ed488112fb3c2941ec72e9 (patch)
tree5096943015176ef2ccd91b037805b74bbb42091c
parent141ca00b69ee94d0f501e3c431225144a10b9673 (diff)
downloadpyserial-git-9e20574a9a6cd369b1ed488112fb3c2941ec72e9.tar.gz
docs: fix example, fixes #173
-rw-r--r--documentation/pyserial_api.rst2
-rw-r--r--documentation/shortintro.rst4
2 files changed, 4 insertions, 2 deletions
diff --git a/documentation/pyserial_api.rst b/documentation/pyserial_api.rst
index cec0078..90444df 100644
--- a/documentation/pyserial_api.rst
+++ b/documentation/pyserial_api.rst
@@ -494,6 +494,8 @@ Native ports
.. versionchanged:: 3.0 renamed from ``applySettingsDict``
+ .. _context-manager:
+
This class can be used as context manager. The serial port is closed when
the context is left.
diff --git a/documentation/shortintro.rst b/documentation/shortintro.rst
index 8f33a68..02385d9 100644
--- a/documentation/shortintro.rst
+++ b/documentation/shortintro.rst
@@ -44,9 +44,9 @@ Get a Serial instance and configure/open it later::
>>> ser.is_open
False
-Also supported with context manager::
+Also supported with :ref:`context manager <context-manager>`::
- serial.Serial() as ser:
+ with serial.Serial() as ser:
ser.baudrate = 19200
ser.port = 'COM1'
ser.open()