[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: Bump. I am still stumbling on that issue. I have a workaround by importing numpy but that's a rather large dependency for that one little thing. I see that the related issue https://bugs.python.org/issue35845 opened later has later discussion entries. -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: Bump. Is there anything I could do to move this forward (as in write and submit a patch for review) ? -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: > General support for strides in cast(), i.e. a zero-copy view for > non-contiguous arrays does not seem possible because buf.ptr is > moved around. Even NumPy does not support that: I'd be happy enough with zero-copy `cast()` of f-continguous arrays along with the parameter `shape`, as this makes interfacing with orginally-in-FORTRAN C libraries through ctypes or cffi possible (without having to write a C-extension). -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: Wait. Isn't a `memoryview` memerely a Python object for a buffer inferface, whatever its valid attributes or flags might be ? The perceived oddness that lead to the addition of the keyword 'shape' was a good initial instinct that something was off, but this is an incomplete workaround . If the rationale was to follow what `tobytes` is doing, this delegates the justification for excluding non 'C' views it. Then I do not understand the rationale behind `memoryview.tobytes`'s exclusive relationshop to C-contiguous arrays. A memmoryview is a window on a memory region (a Python buffer), and one would expect `tobytes` to just return bytes for it (in whatever bytes/strides) the memoryview is originally in. -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: Bump. What are the next steps here ? -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: Wouldn't a contiguity argument ('C' or 'F') be simpler ? (Independently, an argument strides is likely also missing from "cast"). Do you know what are the next possible steps here ? Bring this to the python-dev list ? Submit a patch ? -- components: +Extension Modules, Library (Lib) -Interpreter Core ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
Laurent Gautier added the comment: @mattip : do you mean that it can currently be achieved by calling `cast` with a specific shape parameter ? If the case, how so ? -- ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve
New submission from Laurent Gautier : The buffer protocol is accounting for the row-major or column-major arrays, and that information is shown in the attributes, `c_contiguous` and `f_contiguous` respectively, of a memoryview object. Using the method `cast` allows one to specify a shape but does not allow to specify whether row or column major: ``` # column-major 3x2 array of bytes that was serialized b = bytearray([1,2,3,4,5,6]) mv = memoryview(b) mv_b = mv.cast('b', shape=(3,2)) ``` The result object is believed to be row-major and little can be done to correct it: ``` >>> mv_int.c_contiguous True >>> mv_int.c_contiguous = False AttributeError: attribute 'c_contiguous' of 'memoryview' objects is not writable ``` -- components: Interpreter Core messages: 326167 nosy: lgautier priority: normal severity: normal status: open title: Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve type: enhancement versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue34778> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18323] 'GzipFile' object has no attribute 'extrastart'
New submission from Laurent Gautier: When creating a `gzip.GzipFile` using the named parameter `fileobj` rather than filename, iterating over it is broken: ``` AttributeError: 'GzipFile' object has no attribute 'extrastart' ``` The short example below is demonstrating the problem: ## --- import gzip, tempfile _data = (b'@WXOVW:25:85', b'ATACGCGGCT'+b'GATCGTAGCG', b'+', b'@@))BB'+b'???ECCEECC') data = gzip.zlib.compress(b'\n'.join(_data)) foo = tempfile.NamedTemporaryFile() foo.write(data) foo.flush() foo.seek(0) gzf = gzip.GzipFile(fileobj=foo) # this will trigger the AttributeError for x in gzf: print(x) -- components: Library (Lib) messages: 191989 nosy: Laurent.Gautier priority: normal severity: normal status: open title: 'GzipFile' object has no attribute 'extrastart' type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14398] bz2.BZ2DEcompressor.decompress fail on large files
New submission from Laurent Gautier lgaut...@gmail.com: The call ends with: Objects/stringobject.c:3884: bad argument to internal function sys.version: '2.7.2 (default, Jun 13 2011, 15:14:50) \n[GCC 4.4.5]' (on 64bit Linux) -- messages: 156698 nosy: Laurent.Gautier priority: normal severity: normal status: open title: bz2.BZ2DEcompressor.decompress fail on large files type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14398] bz2.BZ2DEcompressor.decompress fail on large files
Laurent Gautier lgaut...@gmail.com added the comment: Wow! Quick follow-up. The data file is about 1.6Gb. Is there a preferred way to pass it on (I suspect that the bug tracker is not the preferred way). The code goes like: import bz2 f = file(foobar.bz2, mode=rb) src_buf = f.read() decomp = bz2.BZ2Decompressor() tmp = decomp.decompress(src_buf) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2437] Distutils runtime_library_dirs broken on Windows
Laurent Gautier [EMAIL PROTECTED] added the comment: The bug is still here with Python 2.5.2. I anyone want to have it work urgently, there is a quick but very ugly fix: add g['CC'] = 'gcc' into the function _init_nt() in the file Lib\distutils\sysconfig.py of the Python install. -- nosy: +lgautier __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2437 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com