blueloveTH 2 lat temu
rodzic
commit
52e6fdb860
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      python/_set.py
  2. 1 1
      src/pocketpy.h

+ 1 - 1
python/_set.py

@@ -95,4 +95,4 @@ class set:
         return '{'+ ', '.join([repr(i) for i in self._a.keys()]) + '}'
         return '{'+ ', '.join([repr(i) for i in self._a.keys()]) + '}'
     
     
     def __iter__(self):
     def __iter__(self):
-        return self._a.keys()
+        return iter(self._a.keys())

+ 1 - 1
src/pocketpy.h

@@ -897,7 +897,7 @@ inline void init_builtins(VM* _vm) {
         for(auto& item : self.items()){
         for(auto& item : self.items()){
             if(!first) ss << ", ";
             if(!first) ss << ", ";
             first = false;
             first = false;
-            Str key = CAST(Str&, item.first);
+            Str key = CAST(Str&, item.first).escape();
             Str value = CAST(Str&, vm->py_json(item.second));
             Str value = CAST(Str&, vm->py_json(item.second));
             ss << key << ": " << value;
             ss << key << ": " << value;
         }
         }