[Python-bugs-list] [ python-Bugs-734695 ] Function for creating/extracting CoreFoundation types
SourceForge.net
noreply@sourceforge.net
Thu, 29 May 2003 13:55:02 -0700
Bugs item #734695, was opened at 2003-05-08 17:15
Message generated for change (Comment added) made by ronaldoussoren
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=734695&group_id=5470
Category: Macintosh
Group: Feature Request
>Status: Open
Resolution: None
Priority: 5
Submitted By: Ronald Oussoren (ronaldoussoren)
Assigned to: Jack Jansen (jackjansen)
Summary: Function for creating/extracting CoreFoundation types
Initial Comment:
pymactoolbox.h contains a number of functions for
converting from CoreFoundation references to Python
wrappers for those functions (e.g. CFTypeRefObj_New).
Simularly there are functions for extracting the
CoreFoundation reference from a wrapped Python object
(e.g. CFTypeRefObj_Convert).
It would be nice if CFTypeRefObj_New would automaticly
create a more specialized Python wrapper if you pass it
a CFArrayRef, this decreases the coupling between the
python core and 3th party extension modules.
Simularly CFTypeRefObj_Convert should "work" when
passed a CFArrayRefObj.
----------------------------------------------------------------------
>Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2003-05-29 22:55
Message:
Logged In: YES
user_id=580910
My initial tests were a little too easy, now that I've
completely rebuild PyObjC I see:
ImportError: Module did not provide routine: Carbon.CF:
CFObj_New
Shouldn't there be code in _CFmodule.c to make sure that the
mactoolboxglue can find the two new functions?
----------------------------------------------------------------------
Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2003-05-29 21:55
Message:
Logged In: YES
user_id=580910
The new functions seem to work just fine, and the
implementation looks OK too.
I think the current implementation is fine, automaticly
converting only some types to/from their python equivalent
would be confusing. Furthermore the current behaviour allows
me to get as close as possible to 'toll-free bridging' ,
which means it should be possible to translate code examples
that use this feature into Python without too many problems.
Thanks for implementing this!
----------------------------------------------------------------------
Comment By: Jack Jansen (jackjansen)
Date: 2003-05-27 23:43
Message:
Logged In: YES
user_id=45365
Implemented in CVS, but I have called the new generalized functions
CFObj_New() and CFObj_Convert().
One issue is open to discussion: currently CFObj_New() expects a CFTypeRef
object for which a wrapper is available. An alternative would be to use
PyCF_CF2Python() otherwise (so CFNumber would get mapped to a Python
int, etc). Similarly for CFObj_Convert(), which expects an object of one of the
classes Carbon.CF implements. It could also fall back to using
PyCF_Python2CF(). Let me know which solution is better.
Also: the code is pretty much untested. Please test, and close this report
when you're satisfied (and after answering the previous question).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=734695&group_id=5470