def coerce_to(self, dst_type, env):
if dst_type.is_int:
if not self.type.is_pyobject and len(self.entry.init) == 1:
- # we use the *encoded* value here
- return CharNode(self.pos, value=self.entry.init)
+ return CharNode(self.pos, value=self.value)
else:
error(self.pos, "Only coerce single-character ascii strings can be used as ints.")
return self
if 'pxd' in s.level:
if s.sy not in ['*', '?']:
error(pos, "default values cannot be specified in pxd files, use ? or *")
- default = 1
+ default = ExprNodes.BoolNode(1)
s.next()
else:
default = p_simple_expr(s)
if m is not None:
break
else:
+ print type(self), type(obj)
+ print self.access_path
+ print self.access_path[-1][0].pos
+ print self.access_path[-1][0].__dict__
raise RuntimeError("Visitor does not accept object: %s" % obj)
self.dispatch_table[mname] = m
return m(obj)
--- /dev/null
+cdef class A:
+ cpdef foo(self, bint a=*, b=*)
--- /dev/null
+__doc__ = """
+ >>> a = A()
+ >>> a.foo()
+ (True, 'yo')
+ >>> a.foo(False)
+ (False, 'yo')
+ >>> a.foo(10, 'yes')
+ (True, 'yes')
+"""
+
+cdef class A:
+ cpdef foo(self, bint a=True, b="yo"):
+ return a, b