summaryrefslogtreecommitdiff
path: root/docs/reference/speed_python.rst
diff options
context:
space:
mode:
authorPeter Hinch <peter@hinch.me.uk>2019-08-17 13:50:21 +0100
committerDamien George <damien.p.george@gmail.com>2019-08-19 16:39:30 +1000
commit3a679eaf00b909980ad38344ec0c7395adcd0564 (patch)
tree1ac40750e6e048ea509c9633f5fb3111e39dcf0a /docs/reference/speed_python.rst
parent11ecdf2ec699c5f78ef7b2bc1bd34618394cc9fa (diff)
docs/reference/speed_python: Update that read-only buffers are accepted.
As allowed by recent cd35dd9d9a29836906acdce60c931f6352b536d0
Diffstat (limited to 'docs/reference/speed_python.rst')
-rw-r--r--docs/reference/speed_python.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/reference/speed_python.rst b/docs/reference/speed_python.rst
index c5aa80c6e..f2d7739fb 100644
--- a/docs/reference/speed_python.rst
+++ b/docs/reference/speed_python.rst
@@ -293,10 +293,12 @@ microseconds. The rules for casting are as follows:
* The argument to a bool cast must be integral type (boolean or integer); when used as a return
type the viper function will return True or False objects.
* If the argument is a Python object and the cast is ``ptr``, ``ptr``, ``ptr16`` or ``ptr32``,
- then the Python object must either have the buffer protocol with read-write capabilities
- (in which case a pointer to the start of the buffer is returned) or it must be of integral
- type (in which case the value of that integral object is returned).
-
+ then the Python object must either have the buffer protocol (in which case a pointer to the
+ start of the buffer is returned) or it must be of integral type (in which case the value of
+ that integral object is returned).
+
+Writing to a pointer which points to a read-only object will lead to undefined behaviour.
+
The following example illustrates the use of a ``ptr16`` cast to toggle pin X1 ``n`` times:
.. code:: python