[d-feet/wjt/handle-unix-fd-type: 1/3] dbus_utils: simplify looking ahead 1 character
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [d-feet/wjt/handle-unix-fd-type: 1/3] dbus_utils: simplify looking ahead 1 character
- Date: Thu, 18 Oct 2018 14:34:32 +0000 (UTC)
commit c82efa9bfbf1b874dbf1ccea6121bea65ea89b7a
Author: Will Thompson <will willthompson co uk>
Date: Thu Oct 18 15:25:23 2018 +0100
dbus_utils: simplify looking ahead 1 character
It's legal to slice past the end of the string; you get back an empty
string in that case.
src/dfeet/dbus_utils.py | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
---
diff --git a/src/dfeet/dbus_utils.py b/src/dfeet/dbus_utils.py
index 4aa5fde..18df0fe 100644
--- a/src/dfeet/dbus_utils.py
+++ b/src/dfeet/dbus_utils.py
@@ -7,12 +7,7 @@ def convert_complex_type(subsig):
len_consumed = 0
c = subsig[0]
-
- c_lookahead = ''
- try:
- c_lookahead = subsig[1]
- except IndexError:
- c_lookahead = ''
+ c_lookahead = subsig[1:2]
if c == 'a' and c_lookahead == '{': # handle dicts as a special case array
ss = subsig[2:]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]