Commits

Ronald Oussoren committed 1482857

Disable gc module when loading the objc module when on Python 2.2.0. At
least this allows one to use PyObjC with Apple's python on 10.2

Comments (0)

Files changed (3)

pyobjc/.gdb_history

 run -v -v -v
 print Py_VerboseFlag
 print Py_DebugFlag
+r Examples/addressbook.py
+up
+up
+up
+up
+up
+up
+up
+up
+up
+p values->ob_type->tp_name
+p values
+p type_dict
+p type_dict->tp_name
+p type_dict->ob_type->tp_name
+p *type_dict
+p PyDict
+p (PyDict*)type_dict
+p *(PyDictObject*)type_dict
+p cls
+p *cls
+r Examples/addressbook.py
+p node
+up
+up
+up
+down
+down
+p x
+up
+up
+down
+down
+down
+up
+p i
+p x
+p *x
+where
+ quit
+r Examples/addressbook.py
+up
+p x
+p i
+p *o
+up
+p op
+locals
+up
+down

pyobjc/Lib/objc/__init__.py

 from _objc import *
 from _objc import __version__
 
-# Backward compat stuff, Python 2.2.0 doesn't have 'True' and 'False'
+# Backward compat stuff
 try:
 	getattr(__builtins__, 'True')
 except AttributeError:
+	# Python 2.2.0 doesn't have 'True' and 'False'
+	# It also has a GC that interacts badly with us...
+	import gc
+	gc.disable()
 	True=1
 	False=0
 

pyobjc/Modules/objc/objc-class.m

 	}
 
 	bases = PyTuple_New(1);
+	PyTuple_SET_ITEM(bases, 0, NULL);
 
 	if (objc_class->super_class == NULL) {
 		PyTuple_SetItem(bases, 0, (PyObject*)&ObjCObject_Type);
 			ObjCClass_New(objc_class->super_class));
 	} 
 	args = PyTuple_New(3);
-	PyTuple_SetItem(args, 0, PyString_FromString(objc_class->name));
-	PyTuple_SetItem(args, 1, bases);
-	PyTuple_SetItem(args, 2, dict);
+	PyTuple_SET_ITEM(args, 0, PyString_FromString(objc_class->name));
+	PyTuple_SET_ITEM(args, 1, bases);
+	PyTuple_SET_ITEM(args, 2, dict);
 
 	result = PyType_Type.tp_new(&ObjCClass_Type, args, NULL);
 	if (result == NULL) {