Commits

Ronald Oussoren committed abbb2e0

py3k fix broke py2 support :-(

  • Participants
  • Parent commits 0ad6de1

Comments (0)

Files changed (1)

pyobjc-core/Lib/objc/_properties.py

 if sys.version_info[0] == 2:
     range = xrange
 
+    def _str(value):
+        return value
+
 else: # pragma: no cover (py3k)
     long = int
 
+    def _str(value):
+        return value.decode('ascii')
+
+
 
 def attrsetter(prop, name, copy):
     if copy:
                     instance_methods.add(setprop)
 
                     # Use dynamic setter to avoid problems when subclassing
-                    self.__setprop = _dynamic_setter(setterName.decode('ascii'))
+                    self.__setprop = _dynamic_setter(_str(setterName))
             else:
                 setprop = selector(
                     self._setter,
                 instance_methods.add(setprop)
 
                 # Use dynamic setter to avoid problems when subclassing
-                self.__setprop = _dynamic_setter(setterName.decode('ascii'))
+                self.__setprop = _dynamic_setter(_str(setterName))
 
         if self._typestr in (_C_NSBOOL, _C_BOOL):
             getterName = b'is' + name[0].upper().encode('latin1') + name[1:].encode('latin1')