Advertisement
scls

Untitled

Sep 25th, 2018
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def ctype_convert(n, typ):
  2. c_n = typ(n)
  3. if c_n.value != n:
  4. raise(ValueError("out of %r bounds with %r" % (typ, n)))
  5. return c_n.value
  6.  
  7. ctype_convert(-1, ctypes.c_uint8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement