From 57c53921ec35b38d708983ff3bd0a39ba6a8f708 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 11 Feb 2020 13:59:41 +0100 Subject: [PATCH] api/ev3messaging: don't encode by default The Numeric/Text/Logic will be the convenience classes for common data types, so make the basic class general purpose for sending bytes. --- pybricks/ev3messaging.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pybricks/ev3messaging.py b/pybricks/ev3messaging.py index aa9fa65..0a579bf 100644 --- a/pybricks/ev3messaging.py +++ b/pybricks/ev3messaging.py @@ -12,7 +12,7 @@ This module contains everything to do with EV3 bytecode messages. class Mailbox: - def __init__(self, name, connection, encode=repr, decode=eval): + def __init__(self, name, connection, encode=None, decode=None): """Object that represents a mailbox that contains encoded data. See :class:`LogicMailbox`, :class:`NumericMailbox` and @@ -20,13 +20,7 @@ class Mailbox: standard EV3 firmware and desktop programming software. ``encode`` is used in :meth:`send` and ``decode`` is used in - :meth:`read`. The defaults of ``repr`` and ``eval`` work with most - builtin types (like dict and list) but don't work for other objects - (like motors and sensors). - - .. warning:: In general, ``eval`` is considered a security risk because - it can execute arbitrary code! Never use ``eval`` with untrusted - data, like like data received from the Internet. + :meth:`read`. Arguments: name (str):