Skip to contentSkip to conversation

Fix referenced before assignment error

PATCH Applied Sven Vermeulen 2 participants 2 messages May 1, 2013 – Oct 16, 2013 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix referenced before assignment error

Python warns with

UnboundLocalError: local variable 'message' referenced before assignment

Assigning the first value to message, and append later.

---
 policycoreutils/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/semanage/seobject.py +1 -1
index 85bc37f..236a182 100644
@@ -89,7 +89,7 @@ except:
 			self.log_list=[]
 
 		def log(self, msg, name = "", sename = "", serole = "", serange = "", oldsename = "", oldserole = "", oldserange = ""):
-			message += " %s name=%s" % (msg, name)
+			message = " %s name=%s" % (msg, name)
 			if sename != "":
 				message += " sename=" + sename
 			if oldsename != "":
Signature · 7 lines
1.8.1.5


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 7 lines · Sven Vermeulen

Python warns with

UnboundLocalError: local variable 'message' referenced before assignment

Assigning the first value to message, and append later.

Thanks, applied.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.