Commits

Ronald Oussoren  committed 5b89460

A fairly crude hack to make it possible to unarchive an archive with a frozenset that (indirectly) contains itself

e.g. this structure:

l = []
fs = frozenset(l)
l.append(fs)

  • Participants
  • Parent commits b68222b

Comments (0)

Files changed (1)

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

 - (id)initWithCoder:(NSCoder*)coder
 {
     int code;
+    id result;
 
     if ([coder allowsKeyedCoding]) {
         code = [coder decodeInt32ForKey:@"pytype"];
     }
 
     if (code == 1) {
-        value = PyFrozenSet_New(NULL);
-        return [super initWithCoder:coder];
+        //value = PyFrozenSet_New(NULL);
+        value = PySet_New(NULL);
+        result =  [super initWithCoder:coder];
+        if (result != nil) {
+            Py_TYPE(value) = &PyFrozenSet_Type;
+        }
+        return result;
     } else if (code == 2) {
         value = PySet_New(NULL);
         return [super initWithCoder:coder];