Commit b857e04e authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Jérome Perrin

XXX-zope4py3: zodbpickle: Dirty hack to have encoding sets to utf-8.

Otherwise it fails with the following exception because of non-ASCII characters
(`[A-Z&é@{]{3,7})`) (see unconvert()) below):

  => erp5_core/PathTemplateItem/portal_preferences/default_site_preference.xml
     File "zodbpickle-2.0.0-py3.7-linux-x86_64.egg/zodbpickle/pickle_3.py", line 844, in load
        dispatch[key[0]](self)
     File "zodbpickle-2.0.0-py3.7-linux-x86_64.egg/zodbpickle/pickle_3.py", line 1035, in load_short_binstring
        self.append(self.decode_string(data))
     File "zodbpickle-2.0.0-py3.7-linux-x86_64.egg/zodbpickle/pickle_3.py", line 989, in decode_string
        return value.decode(self.encoding, self.errors)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)
parent f4c11679
...@@ -47,7 +47,7 @@ eggs = ${ZODB:egg} ...@@ -47,7 +47,7 @@ eggs = ${ZODB:egg}
recipe = zc.recipe.egg:eggs recipe = zc.recipe.egg:eggs
egg = ZODB egg = ZODB
eggs = ${:egg} eggs = ${:egg}
depends = ${persistent:egg} ${BTrees:egg} depends = ${persistent:egg} ${BTrees:egg} ${zodbpickle:egg}
[ZODB4] [ZODB4]
<= _ZODB <= _ZODB
...@@ -91,12 +91,19 @@ recipe = zc.recipe.egg:custom ...@@ -91,12 +91,19 @@ recipe = zc.recipe.egg:custom
egg = ${:_buildout_section_name_} egg = ${:_buildout_section_name_}
setup-eggs = ${python-cffi:egg} setup-eggs = ${python-cffi:egg}
[zodbpickle]
recipe = zc.recipe.egg:custom
egg = zodbpickle
patches =
${:_profile_base_location_}/../../component/egg-patch/zodbpickle/utf8-by-default.patch#bef23b1883d175e1238b9aaf38faaa7b
patch-options = -p1
patch-binary = ${patch:location}/bin/patch
# eggs that are common to ZODB4 and ZODB5. # eggs that are common to ZODB4 and ZODB5.
[versions] [versions]
BTrees = 4.11.3 BTrees = 4.11.3
persistent = 4.9.3 persistent = 4.9.3
zodbpickle = 2.6.0 zodbpickle = 2.6.0+SlapOSPatched001
# Provide ZODB3 for those eggs that still care about ZODB3 compatibility - # Provide ZODB3 for those eggs that still care about ZODB3 compatibility -
# for example wendelin.core. ZODB3 3.11 is just a dependency egg on _latest_ # for example wendelin.core. ZODB3 3.11 is just a dependency egg on _latest_
......
--- a/src/zodbpickle/pickle_3.py 2022-05-04 17:14:14.001724804 +0000
+++ b/src/zodbpickle/pickle_3.py 2022-05-05 18:19:59.604856127 +0000
@@ -788,7 +788,7 @@
class _Unpickler:
def __init__(self, file, *, fix_imports=True,
- encoding="ASCII", errors="strict"):
+ encoding="utf-8", errors="strict"):
"""This takes a binary file for reading a pickle data stream.
The protocol version of the pickle is detected automatically, so no
@@ -1479,9 +1479,10 @@
encoding=encoding, errors=errors).load()
# Use the faster _pickle if possible
-try:
- from zodbpickle._pickle import *
-except ImportError:
+#try:
+# from zodbpickle._pickle import *
+#except ImportError:
+if 1:
Pickler, Unpickler = _Pickler, _Unpickler
dump, dumps, load, loads = _dump, _dumps, _load, _loads
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment