1. Jonathan Eunice
  2. options


options / options / core.py

Diff from to

File options/core.py

 import sys
-from stuf import orderedstuf
-from otherstuf import chainstuf
+from stuf import orderedstuf, chainstuf
+# from otherstuf import chainstuf
 from options.configparser import ConfigParser
 from options.nulltype import NullType
 from options.funclike import *
     def __init__(self, *args, **kwargs):
-        orderedstuf.__init__(self, *args, **kwargs)
+        orderedstuf.__init__(self, *args)
+        for k,v in kwargs.items():
+            self[k] = v
         self._magic = {}
+        # The explicit for loop setting values from kwargs should not be necessary.
+        # orderedstuf.__init__(self, *args, **kwargs) should do the trick. And it
+        # does, on most platforms. But on PyPy, stuf(a=sys.stdout) fails in much
+        # the same way used to on Python 3. Until stuf/orderedstuf is fixed for
+        # PyPy, this workaround fixes the issue for Options.
     def __repr__(self):
         return "{0}({1})".format(self.__class__.__name__, attrs(self))