1. Ronald Oussoren
  2. pyobjc

Commits

Ronald Oussoren  committed 6c06670

whitespace changes, remove unused OC_PythonString implementation

  • Participants
  • Parent commits 813fbd9
  • Branches pyobjc-ancient

Comments (0)

Files changed (3)

File Modules/objc/OC_PythonDictionary.m

View file
 
 -(void)dealloc
 {
-
 	PyObjC_BEGIN_WITH_GIL
 		Py_XDECREF(value);
 		value = NULL;

File Modules/objc/OC_PythonObject.m

View file
 
 	PyObjC_END_WITH_GIL
 	
-	// not reached
+	/* not reached */
 	return @"a python object";
 }
   
 		}
 	}
   
-
 	pymethod = PyObject_GetAttrString(obj, 
 			PyObjC_SELToPythonName(
 				aSelector, pymeth_name, sizeof(pymeth_name)));
 		return YES;
 	} 
 
-	
 	PyObjC_BEGIN_WITH_GIL
 		m = get_method_for_selector(pyObject, aSelector);
 
 			func_code = (PyCodeObject *) PyFunction_GetCode(
 				PyMethod_Function (pymethod));
 			argcount = func_code->co_argcount-1;
+
 		} else {
 			func_code = (PyCodeObject *) PyFunction_GetCode(
 				pymethod);
     NSLog(@"*** Ignoring *** %@ for '%@' (of %@).", NSStringFromSelector(_cmd), keyPath, observer);
 }
 #endif
+
 @end /* OC_PythonObject class implementation */

File Modules/objc/OC_PythonString.m

-#include "pyobjc.h"
-
-/* 
- * FIXME: Using CFString in the implementation of this class seems unnecessary.
- */
-
-#error "This code is not used and probably suffered from bitrot"
-
-@implementation OC_PythonString
-+newWithPythonObject:(PyObject*)v;
-{
-	OC_PythonString* res = [[OC_PythonString alloc] initWithPythonObject:v];
-	[res autorelease];
-	return res;
-}
-
--initWithPythonObject:(PyObject*)v;
-{
-	PyGILState_STATE state = PyObjCGILState_Ensure();
-	value = v;
-
-	if (PyString_Check(value)) {
-		char *buffer;
-		int length;
-		int result;
-
-		result = PyString_AsStringAndSize(value, &buffer, &length);
-		if(result == -1) {
-			[self release];
-			PyObjCErr_ToObjCWithGILState(&state);
-			return nil; 
-		}
-		stringValue = CFStringCreateWithCStringNoCopy(NULL,
-							buffer,
-							kCFStringEncodingUTF8,
-							kCFAllocatorNull);
-		_internalRep = NULL;
-		} else if (PyUnicode_Check(value)) {
-		char *buffer;
-		int length;
-		int result;
-	#warning Is there a way to determine what the encoding of value is and instantiate a CFString directly?
-		_internalRep = PyUnicode_AsUTF8String(value);
-		result = PyString_AsStringAndSize(_internalRep, &buffer, &length);
-		if(result == -1) {
-			PyObjCErr_ToObjC();
-			[self release];
-			return nil;
-	}
-
-	stringValue = CFStringCreateWithCStringNoCopy(NULL,
-						buffer,
-						kCFStringEncodingUTF8,
-						kCFAllocatorNull);
-	}
-	
-	Py_INCREF(value);
-	PyGILState_Release(state);
-	
-	return self;
-}
-
--(PyObject*)__pyobjc_PythonObject__
-{
-	Py_INCREF(value);
-	return value;
-}
-
--(void)dealloc
-{
-	PyGILState_STATE state;
-
-	CFRelease(stringValue);
-	state = PyObjCGILState_Ensure();
-	Py_XDECREF(value);
-	Py_XDECREF(_internalRep);
-	PyGILState_Release(state);
-	[super dealloc];
-}
-
-- (unsigned int)length;
-{
-	int result;
-	result = CFStringGetLength(stringValue);
-	return result;
-}
-
-- (unichar)characterAtIndex:(unsigned)index;
-{
-	UniChar result;
-	result = CFStringGetCharacterAtIndex(stringValue, index);
-	return result;
-}
-@end