Advertisement
Guest User

Untitled

a guest
Apr 5th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #ifdef PYTHON3
  2. %typemap(typecheck) const char*
  3. {
  4.     $1 = PyUnicode_Check($input);
  5. }
  6.  
  7. %typemap(in) const char*
  8. {
  9.     if(PyUnicode_Check($input))
  10.     {
  11.         $1 = PyBytes_AsString(PyUnicode_AsASCIIString(const_cast<PyObject*>($input)));
  12.     }
  13.     else { SWIG_fail; }
  14. }
  15.  
  16. %typemap(freearg) const char*
  17. {
  18.     // pass
  19. }
  20. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement