Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53886
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <random832@fastmail.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'programmer': 0.03; 'assign': 0.07; 'subject:file': 0.07; 'string': 0.09; 'assigning': 0.09; 'received:internal': 0.09; 'skip:\\ 10': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'bug': 0.12; "'test": 0.16; 'assignment.': 0.16; 'buffers,': 0.16; 'cryptic.': 0.16; 'former,': 0.16; 'latter,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'overwriting': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'subject:String': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'bit': 0.19; '>>>': 0.22; 'pointer': 0.24; 'unicode': 0.24; 'mon,': 0.24; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'code': 0.31; 'ctypes': 0.31; 'sep': 0.31; 'workaround': 0.31; 'supposed': 0.32; 'actual': 0.34; 'subject:the': 0.34; 'received:66': 0.35; "can't": 0.35; 'created': 0.35; 'i.e.': 0.36; 'sequence': 0.36; 'received:10': 0.37; 'expected': 0.38; 'to:addr :python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; 'most': 0.60; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'talking': 0.65; '"one': 0.84; 'viable': 0.84; '2013,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= O33RsTY/fnF7PAhdaiJ/zgCkRKw=; b=pPnJZiJtdSQLfepTyarYRYTSmcx24LYN posH54cdi1uNqmxz4O6/xAtD5JISMTkf2WyPrhdgMJdIkp0RJpsdKXxBYkkhkqMD j6klhIXghtdLF2spujutcRbe/4Kuqqafc4zfdeqgLyHmpamy4yZMMpC+lRVqWRrW UzLSXZLAehQ= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=O33RsTY/fnF7PAhdaiJ/zgCkRKw=; b=kkR kacxv0q2z5VNGXlDi8AP9BdD1vCeohm9ySXaDGbW3iITWkqBi6cNBARkP4tuzmld vSJ4r7WM8sVYT/KtHAlsQO86DTAaEec09rwHeZs5Mq5YvhoyZuWZFfUpS03ZrVQN MOYF8x3IWpZj0ixmTn1fh7vAb6HqA8IBiMzevY1Y= |
| X-Sasl-Enc | HUfB5yFL4GTOKVGm53dv95rBfAjvlu/BFTVxViuIQDRV 1378754875 |
| From | random832@fastmail.us |
| To | python-list@python.org |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| Content-Type | text/plain |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-15090c31 |
| In-Reply-To | <CALwzidmRsxiW-X+rHU2Lh88Qr-TLoMFMAC2-stPvX0vGV5y_KQ@mail.gmail.com> |
| References | <4ce85ea8-4a4c-46cf-a546-ad999576a5f7@googlegroups.com> <m2a9jqq7g9.fsf@cochabamba.vanoostrum.org> <1378486748.10472.18800565.3DE728D7@webmail.messagingengine.com> <CAPTjJmoVattOtstGpooszV4a5F7KmvX+Y_Mzpb1M7m3EsAU7og@mail.gmail.com> <1378751676.20097.19809157.789868C5@webmail.messagingengine.com> <CALwzidmRsxiW-X+rHU2Lh88Qr-TLoMFMAC2-stPvX0vGV5y_KQ@mail.gmail.com> |
| Subject | Re: Chardet, file, ... and the Flexible String Representation |
| Date | Mon, 09 Sep 2013 15:27:55 -0400 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.191.1378754893.5461.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1378754893 news.xs4all.nl 15971 [2001:888:2000:d::a6]:38122 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53886 |
Show key headers only | View raw
On Mon, Sep 9, 2013, at 15:03, Ian Kelly wrote: > Do you mean that it breaks when overwriting Python string object buffers, > or when overwriting arbitrary C strings either received from C code or > created with create_unicode_buffer? > > If the former, I think that is to be expected since ctypes ultimately > can't > know what is the actual type of the pointer it was handed -- much as in > C, > that's up to the programmer to get right. I also think it's very bad > practice to be overwriting those anyway, since Python strings are > supposed > to be immutable. > > If the latter, that sounds like a bug in ctypes to me. I was talking about writing to the buffer object from python, i.e. with slice assignment. >>> s = 'Test \U00010000' >>> len(s) 6 >>> buf = create_unicode_buffer(32) >>> buf[:6] = s TypeError: one character unicode string expected >>> buf[:7] = s ValueError: Can only assign sequence of same size >>> buf[:7] = 'Test \ud800\udc00' >>> buf[:7] 'Test \U00010000' # len = 6 Assigning with .value works, however, which may be a viable workaround for most situations. The "one character unicode string expected" message is a bit cryptic.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Chardet, file, ... and the Flexible String Representation wxjmfauth@gmail.com - 2013-09-06 02:11 -0700
Re: Chardet, file, ... and the Flexible String Representation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-06 10:57 +0000
Re: Chardet, file, ... and the Flexible String Representation Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-06 13:10 +0200
Re: Chardet, file, ... and the Flexible String Representation Ned Batchelder <ned@nedbatchelder.com> - 2013-09-06 07:02 -0400
Re: Chardet, file, ... and the Flexible String Representation Piet van Oostrum <piet@vanoostrum.org> - 2013-09-06 11:46 -0400
Re: Chardet, file, ... and the Flexible String Representation Chris Angelico <rosuav@gmail.com> - 2013-09-07 02:04 +1000
Re: Chardet, file, ... and the Flexible String Representation random832@fastmail.us - 2013-09-06 12:59 -0400
Re: Chardet, file, ... and the Flexible String Representation Chris Angelico <rosuav@gmail.com> - 2013-09-07 03:04 +1000
Re: Chardet, file, ... and the Flexible String Representation wxjmfauth@gmail.com - 2013-09-09 07:28 -0700
Re: Chardet, file, ... and the Flexible String Representation Ned Batchelder <ned@nedbatchelder.com> - 2013-09-09 12:38 -0400
Re: Chardet, file, ... and the Flexible String Representation Michael Torrie <torriem@gmail.com> - 2013-09-09 11:05 -0600
Re: Chardet, file, ... and the Flexible String Representation Steven D'Aprano <steve@pearwood.info> - 2013-09-10 04:58 +0000
Re: Chardet, file, ... and the Flexible String Representation Terry Reedy <tjreedy@udel.edu> - 2013-09-09 16:47 -0400
Re: Chardet, file, ... and the Flexible String Representation random832@fastmail.us - 2013-09-10 11:36 -0400
Re: Chardet, file, ... and the Flexible String Representation random832@fastmail.us - 2013-09-09 14:34 -0400
Re: Chardet, file, ... and the Flexible String Representation Ian Kelly <ian.g.kelly@gmail.com> - 2013-09-09 13:03 -0600
Re: Chardet, file, ... and the Flexible String Representation random832@fastmail.us - 2013-09-09 15:27 -0400
Re: Chardet, file, ... and the Flexible String Representation Serhiy Storchaka <storchaka@gmail.com> - 2013-09-12 00:11 +0300
csiph-web