Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68527
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
| Newsgroups | comp.lang.python |
| Subject | Re: Controlling buffer alignment in file.read() |
| Date | Wed, 19 Mar 2014 13:07:12 +1300 |
| Lines | 19 |
| 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> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net 7BrKHv26kKsTN4dGcoM3pw+mC7tnrI4p0e69FiaFm8E6z2/m5U |
| Cancel-Lock | sha1:mu9Lx9SUDB6vZxw4RzL4RaUIWUM= |
| User-Agent | Mozilla Thunderbird 1.0.5 (Macintosh/20050711) |
| X-Accept-Language | en-us, en |
| In-Reply-To | <mailman.8265.1395184430.18130.python-list@python.org> |
| Xref | csiph.com comp.lang.python:68527 |
Show key headers only | View raw
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