1. Dwayne Litzenberger
  2. pyobjc

Commits

Ronald Oussoren  committed 82cdeb7

Add missing calls to [super init] in the initializers for OC_PythonString and OC_PythonUnicode

  • Participants
  • Parent commits 828668d
  • Branches default

Comments (0)

Files changed (3)

File pyobjc-core/Modules/objc/OC_PythonString.m

View file
 
 - (id)initWithPythonObject:(PyObject*)v
 {
+	self = [super init];
+	if (unlikely(self == nil)) return nil;
 	Py_INCREF(v);
 	Py_XDECREF(value);
 	value = v;

File pyobjc-core/Modules/objc/OC_PythonUnicode.m

View file
 	OC_PythonUnicode* res;
 
 	res = [[OC_PythonUnicode alloc] initWithPythonObject:v];
-//	[res autorelease];
+	[res autorelease];
 	return res;
 }
 
 - (id)initWithPythonObject:(PyObject*)v
 {
+	self = [super init];
+	if (unlikely(self == nil)) return nil;
 	Py_INCREF(v);
 	Py_XDECREF(value);
 	value = v;
 
 #else // !PyObjC_UNICODE_FAST_PATH */
 
-/* XXX: Add __realObject__ implementation tuned for Python 3.3 (choose right
- *      NSString constructor based on unicode representation size
- */
-
 -(id)__realObject__
 {
 	if (!realObject) {

File pyobjc-core/NEWS.txt

View file
 Version 2.4  (or 3.0)
 ---------------------
 
+- Add missing calls to ``[super init]`` in the implementation of
+  OC_PythonUnicode and OC_PythonString (the ObjC proxies for python's
+  unicode and str types)
+
 - ``objc.addConvenienceForSelector`` is deprecated, primarily to make 
   it possible to restructure the pyobjc internals.