Commits

Ronald Oussoren  committed a0b5127

Fix issue that broke nscoding support for python objects

  • Participants
  • Parent commits b0e444a
  • Branches core-cleanup

Comments (0)

Files changed (2)

File pyobjc-core/Lib/objc/_convenience.py

 import warnings
 import collections
 
-__all__ = ( 'addConvenienceForClass' )
+__all__ = ( 'addConvenienceForClass', )
 
 
 _CONVENIENCE_METHODS = {}

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

 	 * Also if the name starts and ends with two underscores, return
 	 * it unmodified. This avoids mangling of Python's special methods.
 	 *
+	 * Also don't rewrite two underscores between name elements, such
+	 * as '__pyobjc__setItem_' -> '__pyobjc__setitem:'
+	 *
 	 * Both are heuristics and could be the wrong choice, but either 
 	 * form is very unlikely to exist in ObjC code.
 	 */
 	/* Replace all other underscores by colons */
 	cur = strchr(cur, '_');
 	while (cur != NULL) {
-		*cur = ':';
+		if (cur[1] == '_' && cur[2] && cur[2] != '_') {
+			/* Don't translate double underscores between
+			 * name elements.
+			 */
+			cur += 2;
+		} else {
+			*cur = ':';
+		}
 		cur = strchr(cur, '_');
 	}
 	return sel_registerName(buf);