Since we want to do string operations on the inputs to the various grouptools modules assert that the inputs are in fact strings not other things.
Signed-off-by: Dylan Baker <[email protected]> --- framework/grouptools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/grouptools.py b/framework/grouptools.py index 74b75a3..7a7a127 100644 --- a/framework/grouptools.py +++ b/framework/grouptools.py @@ -44,6 +44,7 @@ __all__ = [ def _assert_illegal(group): """Helper that checks for illegal characters in input.""" + assert isinstance(group, (str, unicode)), 'Type must be string or unicode' assert '\\' not in group, \ 'Groups are not paths and cannot contain \\. ({})'.format(group) assert not group.startswith('/'), \ @@ -103,6 +104,8 @@ def join(*args): """ for group in args: + assert isinstance(group, (str, unicode)), \ + 'Type must be string or unicode' assert '\\' not in group, \ 'Groups are not paths and cannot contain \\. ({})'.format(group) assert not args[0].startswith('/'), \ @@ -149,6 +152,7 @@ def from_path(path): This safely handles both Windows and Unix style paths. """ + assert isinstance(path, (str, unicode)), 'Type must be string or unicode' assert not path.startswith('/'), \ 'Groups cannot start with /. ({})' .format(path) -- 2.2.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
