Brian Lloyd wrote: > That might actually be because bool didn't exist in python way back > then ;) I suspect its probably safe to fix it now. > Cool. :-)
Michael > -Brian > > > On 11/2/07 12:14 PM, "Michael Foord" <[EMAIL PROTECTED]> wrote: > > >> Hello all, >> >> I'm using the Python.Runtime assembly to provide access to CPython >> modules from IronPython. >> >> I'm converting objects that pass from CPython to IronPython (and >> vice-versa) by converting datatypes or proxying access. >> >> To convert to CPython types I use "PyObject.FromManagedObject(obj)" >> where possible and do type specific conversion for other types. >> >> Unfortunately "PyObject.FromManagedObject(obj)" doesn't work for >> booleans and passing in booleans to CPython doesn't result in 'True' or >> 'False', but a 'System.Boolean' instead. >> >> As a workaround I'm using: >> >> @GIL >> def _getBools(): >> "Hack because 'FromManagedObject' doesn't work for bools" >> builtin = engine.ImportModule('__builtin__') >> return {False: builtin.GetAttr('False'), True: builtin.GetAttr('True')} >> >> _bools = _getBools() >> >> Is the fact that "PyObject.FromManagedObject(obj)" doesn't work for >> booleans a bug? (Or is there an alternative method you can suggest?) >> >> All the best, >> >> >> Michael Foord >> http://www.manning.com/foord >> _________________________________________________ >> Python.NET mailing list - PythonDotNet@python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> > > -------------------------- > Brian Lloyd > > [EMAIL PROTECTED] > > > _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet