user [email protected] usertags 1114709 python3.15 tags 1114709 patch thanks
Hi! While rebuilding the python related packages against the Python 3.15rc2 version I ran into this FTBFS [1]. To fix the issue, I had to backport upstream's commit d1003c5b654d15ec54361419c283f890486f46f8: permit numpy as _ArrayData_/_ArrayZipData_, speed up ndarray encoding/decoding. I've applied this fix in the sandbox [2] to verify that it builds successfully, these should be applied in Debian to get the package back to a healthy state. Happy hacking, [1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4368992/ [2]: https://debusine.debian.net/debian/r-python-python3.15/artifact/ -- "Can you imagine what I would do if I could do all I can?" -- Sun Tzu Saludos /\/\ /\ >< `/
From: Qianqian Fang <[email protected]> Date: Tue, 30 Aug 2022 15:09:32 -0400 Subject: permit numpy as _ArrayData_/_ArrayZipData_, speed up ndarray encoding/decoding --- jdata/jdata.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: pyjdata/jdata/jdata.py =================================================================== --- pyjdata.orig/jdata/jdata.py +++ pyjdata/jdata/jdata.py @@ -83,7 +83,7 @@ def encode(d, opt={}): raise Exception('JData', 'compression method is not supported') newobj['_ArrayZipType_']=opt['compression']; newobj['_ArrayZipSize_']=[1+int('_ArrayIsComplex_' in newobj), d.size]; - newobj['_ArrayZipData_']=np.asarray(newobj['_ArrayData_'],dtype=d.dtype).tostring(); + newobj['_ArrayZipData_']=np.asarray(newobj['_ArrayData_'],dtype=d.dtype).tobytes(); if(opt['compression']=='zlib'): newobj['_ArrayZipData_']=zlib.compress(newobj['_ArrayZipData_']); elif(opt['compression']=='gzip'): @@ -124,7 +124,7 @@ def decode(d, opt={}): elif isinstance(d, dict): if('_ArrayType_' in d): if(isinstance(d['_ArraySize_'],str)): - d['_ArraySize_']=np.array(bytearray(d['_ArraySize_'])); + d['_ArraySize_']=np.frombuffer(bytearray(d['_ArraySize_'])); if('_ArrayZipData_' in d): newobj=d['_ArrayZipData_'] if(('base64' in opt) and (opt['base64'])): @@ -137,7 +137,7 @@ def decode(d, opt={}): newobj=zlib.decompress(bytes(newobj),zlib.MAX_WBITS|32) elif(d['_ArrayZipType_']=='lzma'): newobj=lzma.decompress(bytes(newobj),lzma.FORMAT_ALONE) - newobj=np.fromstring(newobj,dtype=np.dtype(d['_ArrayType_'])).reshape(d['_ArrayZipSize_']); + newobj=np.frombuffer(bytearray(newobj),dtype=np.dtype(d['_ArrayType_'])).reshape(d['_ArrayZipSize_']); if('_ArrayIsComplex_' in d and newobj.shape[0]==2): newobj=newobj[0]+1j*newobj[1]; newobj=newobj.reshape(list(d['_ArraySize_']));

