Package: player / 3.0.2+dfsg-4

0005-Raise-python-exceptions-correctly.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Michael Janssen <jamuraa@base0.net>
Date: Wed, 8 Dec 2010 22:43:40 -0600
Subject: Raise python exceptions correctly

---
 libplayerinterface/playerxdrgen.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libplayerinterface/playerxdrgen.py b/libplayerinterface/playerxdrgen.py
index a113d0b..44b51da 100755
--- a/libplayerinterface/playerxdrgen.py
+++ b/libplayerinterface/playerxdrgen.py
@@ -36,7 +36,7 @@ class DataTypeMember:
         self.arraysize = self.arraysize[0]
         body = self.arraypattern.sub('', body)
     elif len(pointers) > 1:  # This checks for things like "uint8_t* *data"
-      raise 'Illegal pointer declaration in struct\n' + body
+      raise Exception('Illegal pointer declaration in struct\n' + body)
     elif len(pointers) > 0:
       self.array = True
       self.arraysize = ''
@@ -94,7 +94,7 @@ class DataType:
     varpart = self.contentspattern.findall(body)
     if len(varpart) != 1:
       print 'skipping nested / empty struct ' + typename
-      raise "Empty Struct"
+      raise Exception("Empty Struct")
     # separate the variable declarations
     decls = self.declpattern.findall(varpart[0])
     for dstring in decls:
@@ -174,7 +174,7 @@ int xdr_%(typename)s (XDR* xdrs, %(typename)s * msg)
             # Check for a matching count variable, because compulsory for dynamic arrays
             # FIXME: Add this test back
             if var.countvar not in datatype.GetVarNames():
-              raise 'Missing count var "' + countvar + '" in\n' + s
+              raise Exception('Missing count var "' + countvar + '" in\n' + s)
             # First put in a check to see if unpacking, and if so allocate memory for the array
             sourcefile.write('  if(xdrs->x_op == XDR_DECODE)\n  {\n')
             sourcefile.write('    if((msg->' + var.Name + ' = malloc(msg->' + var.countvar + '*sizeof(' + member.typename + '))) == NULL)\n      return(0);\n')