Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68527
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Controlling buffer alignment in file.read() |
| Date | 2014-03-19 13:07 +1300 |
| Message-ID | <bos5diF9glrU1@mid.individual.net> (permalink) |
| References | <mailman.8260.1395174272.18130.python-list@python.org> <bos1vgF8r6oU1@mid.individual.net> <mailman.8265.1395184430.18130.python-list@python.org> |
Haralanov, Mitko wrote: > The problem is not controlling the number of bytes read. That part seems to > be working. The issue is that the buffer into which the data is placed needs > to be of certain alignment (8byte-aligned). Python does not seem to have a > way that allows me to control that. Hmmm, that could be tricky. Have you tried using os.read()? If you're lucky, Python will be using a malloc() call or equivalent to create a str/bytes object to read the data into, and that will return something platform-aligned. If you're unlucky, there's probably no pure-Python solution, and you might need to write a small C or Cython module to accomplish this trick. -- Greg
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Controlling buffer alignment in file.read() "Haralanov, Mitko" <mitko.haralanov@intel.com> - 2014-03-18 20:23 +0000
Re: Controlling buffer alignment in file.read() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-19 12:08 +1300
RE: Controlling buffer alignment in file.read() "Haralanov, Mitko" <mitko.haralanov@intel.com> - 2014-03-18 23:13 +0000
Re: Controlling buffer alignment in file.read() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-19 13:07 +1300
RE: Controlling buffer alignment in file.read() Laurent Pointal <laurent.pointal@free.fr> - 2014-03-22 19:28 +0100
csiph-web