Got it worked with the following change.

PyUnicodeObject *p = ...whatever...;

char* tmp = (char *)p;
PyObject* arg = PyBytes_FromString (tmp); 

function( (PyBytesObject*) arg); 


>From : MathanK<switch2mat...@gmail.com>
To : "python-list" <python-list@python.org>
Date : Sat, 15 May 2010 02:50:22 -1200
Subject : Is there conversion method to convert pyunicodeobject to pybyteobject?

Hi All,

A variable whose data type is PyUnicodeObject is to be assigned to varioable of 
PyBytesObject type 

example :
void function( (PyBytesObject* byte){........} 
PyUnicodeObject *p = ...whatever...; 
function( (PyBytesObject*)p); 

compiled and got a Bus Error.

Cheers,
Mathan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to