File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ def nullable_ptr(ptr):
32
32
else :
33
33
return 'NULL'
34
34
35
+ def nullable_strptr (s ,caststr = 'char*' ):
36
+ if s :
37
+ return '(%s)"%s"' % (caststr ,s )
38
+ else :
39
+ return 'NULL'
40
+
35
41
def simple_unaryfunc (identifier , typename , c_expression ):
36
42
"""Define a simple unaryfunc, using a specifc PyObject subclass"""
37
43
self .add_defn ("static PyObject *\n " +
@@ -97,7 +103,7 @@ def c_defn(self):
97
103
result = ' {(char*)"%s",\n ' % self .name
98
104
result += ' (getter)%s,\n ' % nullable_ptr (self .get )
99
105
result += ' (setter)%s,\n ' % nullable_ptr (self .set )
100
- result += ' (char*)"%s" ,\n ' % nullable_ptr (self .doc )
106
+ result += ' %s ,\n ' % nullable_strptr (self .doc )
101
107
result += ' %s},\n ' % nullable_ptr (self .closure )
102
108
return result
103
109
You can’t perform that action at this time.
0 commit comments