[openlp-dev] Trunk revision 2764 backwards compatibility

Raoul Snyman raoul at snyman.info
Thu Sep 7 01:24:43 EDT 2017


Hey Phil,

We have a problem with Python 3.6 (and apparently 3.5 as well, although 
I'm not seeing it right now):

$ python3.6 openlp.py
Traceback (most recent call last):
   File "openlp.py", line 44, in <module>
     main()
   File "openlp/core/__init__.py", line 440, in main
     settings.upgrade_settings()
   File "openlp/core/common/settings.py", line 495, in upgrade_settings
     self.setValue(new_key, old_value)
   File "openlp/core/common/settings.py", line 525, in setValue
     value = json.dumps(value, cls=OpenLPJsonEncoder)
   File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps
     **kw).encode(obj)
   File "openlp/core/common/json.py", line 74, in __init__
     super().__init__(skipkeys, ensure_ascii, check_circular, allow_nan, 
sort_keys, indent, separators, default)
TypeError: __init__() takes 1 positional argument but 9 were given


They've removed the __init__() method from the C implementation of the 
json module. Everything is now set up in __new__.

  - https://bugs.python.org/issue30243
  - 
https://github.com/python/cpython/commit/39b73dd5131ce205dcee3b9e24ba0fc28934d79c

It looks like you're not supposed to subclass JSONEncoder anymore, 
you're supposed to pass it a default instead:

  - https://github.com/python/cpython/blob/3.6/Lib/json/__init__.py#L73


Ugh, that's a pain.

-- 
Raoul Snyman
+1 (520) 490-9743
raoul at snyman.info


More information about the openlp-dev mailing list