Ronald Oussoren avatar Ronald Oussoren committed 82cdeb7

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

Comments (0)

Files changed (3)

pyobjc-core/Modules/objc/OC_PythonString.m

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

pyobjc-core/Modules/objc/OC_PythonUnicode.m

 	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) {

pyobjc-core/NEWS.txt

 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.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.