2017-04-16 12:38:55

by Jakub Wilk

[permalink] [raw]
Subject: [PATCH BlueZ] test: Fix misuse of flags in re.sub() call

The 4th argument of re.sub() is maximum number of substitutions,
not flags.

The string doesn't contain any newlines, only hex digits, so the
re.DOTALL flag wouldn't have any effect. Let's remove it.
---
test/sap_client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/sap_client.py b/test/sap_client.py
index 413424c05..ba4f6f544 100644
--- a/test/sap_client.py
+++ b/test/sap_client.py
@@ -311,7 +311,7 @@ class SAPMessage:

def getContent(self):
s = "%s(id=0x%.2X) " % (self.name, self.id)
- if len( self.buf): s = s + "[%s]" % re.sub("(.{2})", "0x\\1 " , self.buf.tostring().encode("hex").upper(), re.DOTALL)
+ if len( self.buf): s = s + "[%s]" % re.sub("(.{2})", "0x\\1 " , self.buf.tostring().encode("hex").upper())
s = s + "\n\t"
for p in self.params:
s = s + "\t" + p.getContent()
--
2.11.0