Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c
index 5bb7f9c..d540197 100644
--- a/Mac/Modules/ae/AEmodule.c
+++ b/Mac/Modules/ae/AEmodule.c
@@ -795,6 +795,7 @@
return PyMac_BuildOSType(self->ob_itself.descriptorType);
if (strcmp(name, "data") == 0) {
PyObject *res;
+#ifndef TARGET_API_MAC_CARBON
char state;
state = HGetState(self->ob_itself.dataHandle);
HLock(self->ob_itself.dataHandle);
@@ -803,6 +804,19 @@
GetHandleSize(self->ob_itself.dataHandle));
HUnlock(self->ob_itself.dataHandle);
HSetState(self->ob_itself.dataHandle, state);
+#else
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+#endif
return res;
}
if (strcmp(name, "__members__") == 0)
@@ -1145,7 +1159,7 @@
static pascal OSErr
-GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon)
+GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long refcon)
{
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;