[issue5391] mmap: read_byte/write_byte and object type

2010-10-16 Thread benrg
benrg added the comment: With this patch, read_byte returns an integer in the range -128 to 127 instead of 0 to 255 if char is signed. Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 is affected by this. I think it is a bug. The test code would fail if th

[issue5391] mmap: read_byte/write_byte and object type

2010-11-04 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Thank for pointing this out. I've looked at bytearray and bytes implementations, they actually return unsigned value. I fixed this in r86159(py3k) and r86160(release31-maint). -- ___ Python tracker

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Hirokazu Yamamoto
New submission from Hirokazu Yamamoto : On Python3000, mmap.read_byte returns str not bytes, and mmap.write_byte accepts str. Is this intended behavior? >>> import mmap >>> m = mmap.mmap(-1, 10) >>> type(m.read_byte()) >>> m.write_byte("a") >>> m.write_byte(b"a") Maybe another possibility. rea

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Martin v. Löwis
Martin v. Löwis added the comment: Indeed, I think it should use the "b" code, instead of the "c" code. Please discuss this on python-dev, though. It might not be ok to backport this to 3.0, since it may break existing code. -- nosy: +loewis ___ Pyt

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Martin v. Löwis
Martin v. Löwis added the comment: Furthermore, all other uses of the "c" code might need to be reconsidered. ___ Python tracker ___ ___ Python

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : -- versions: -Python 3.0 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread STINNER Victor
STINNER Victor added the comment: loewis> Furthermore, all other uses of the "c" code might loewis> need to be reconsidered. $ grep 'BuildValue.*"c"' */*c Modules/_cursesmodule.c:return Py_BuildValue("c", rtn); Modules/mmapmodule.c: return Py_BuildValue("c", value); $ grep '_Par

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: I think more *bytes* cleanup is needed for mmap module documentation & implementation. (and other modules?) Especially mmap.find() and its friends. >>> import mmap >>> m = mmap.mmap(-1, 10) >>> m[:] = b"0123456789" >>> m.find(b'2') 2 >>> m.find('2') # XXX: a

[issue5391] mmap: read_byte/write_byte and object type

2009-02-28 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Patch attached. read_byte and write_byte use integer as byte, and other bytes related cleanup. -- keywords: +patch Added file: http://bugs.python.org/file13215/py3k_mmap_and_bytes.patch ___ Python tracker

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread STINNER Victor
STINNER Victor added the comment: In the python-dev thread, most people agree to use bytes in mmap. Did anyone reviewed the patch? Can you commit it to py3k than then to the 3.0 branch? -- ___ Python tracker

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: >In the python-dev thread, most people agree to use bytes in mmap. Did >anyone reviewed the patch? Well, there is no conclusion which of your choices (a or b) is preferred. http://www.nabble.com/What-type-of-object-mmap.read_byte-should-return-on-py3k--tt22

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread STINNER Victor
STINNER Victor added the comment: Le Tuesday 17 March 2009 14:39:59 Hirokazu Yamamoto, vous avez écrit : > Well, there is no conclusion which of your choices (a or b) is preferred. Guido just wrote in other mail thread (py3k: accept unicode for 'c' and byte for 'C' in getarg?): "Yeah, mmap

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Ah, no, this should not be backported to 3.0. Martin saids so in msg82904, and I agreed. -- ___ Python tracker ___ __

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread Martin v. Löwis
Martin v. Löwis added the comment: STINNER Victor wrote: > STINNER Victor added the comment: > > Le Tuesday 17 March 2009 14:39:59 Hirokazu Yamamoto, vous avez écrit : >> Well, there is no conclusion which of your choices (a or b) is preferred. > > Guido just wrote in other mail thread (py3k:

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread STINNER Victor
STINNER Victor added the comment: > How does that answer the question? We know what data type to > use for multiple bytes - but what data type should be used > for a single byte? Hum, what was the question? :-) Quote of my email: « About m.read_byte(), we have two choices: (a) Py_BuildValue

[issue5391] mmap: read_byte/write_byte and object type

2009-03-17 Thread Martin v. Löwis
Martin v. Löwis added the comment: > Oh, I though that the question was about bytes vs str :-/ Ocean-city > and I prefer the solution (a). And you Martin? I also think that ints should be used to represent individual bytes. However, your list of alternatives is incomplete: we *could* also cha

[issue5391] mmap: read_byte/write_byte and object type

2009-03-26 Thread STINNER Victor
STINNER Victor added the comment: martin> However, your list of alternatives is incomplete: we martin> *could* also change the "c" code to accept and produce martin> int - then mmapmodule would not need to change at all. That's extactly the idea that I proposed in issue #5499 ;-) I prefer to

[issue5391] mmap: read_byte/write_byte and object type

2009-03-31 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : -- dependencies: +only accept byte for getarg('c') and unicode for getarg('C') ___ Python tracker ___ __

[issue5391] mmap: read_byte/write_byte and object type

2009-04-01 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : -- priority: -> release blocker ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread STINNER Victor
STINNER Victor added the comment: @ocean-city: Can you update your patch to leave Py_BuildValue("c", ...) and PyArg_ParseTuple(args, "c:write_byte", ...) unchanged, since #5499 is fixed? -- ___ Python tracker __

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Yes, here is the patch. But I noticed Py_BuildValue('c') still returns unicode. To pass the test, #5666 is needed. -- dependencies: +Py_BuildValue("c") should return bytes? Added file: http://bugs.python.org/file13575/py3k_mmap_bytes_cleanup_with_ge

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : Removed file: http://bugs.python.org/file13575/py3k_mmap_bytes_cleanup_with_getarg_c.patch ___ Python tracker ___ _

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : Added file: http://bugs.python.org/file13576/py3k_mmap_bytes_cleanup_with_getarg_c.patch ___ Python tracker ___ ___

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread STINNER Victor
STINNER Victor added the comment: So .read_byte() gives a byte string of 1 byte, ok. Port from Python2 will be easier. The patch looks correct, thanks for updating it. We know have to wait for #5666 :-) -- ___ Python tracker

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Yes, you can do m.write_byte(b"a") but on the other hand you cannot do a = b"abc" m.write_byte(a[1]) instead you should do a = b"abc" m.write_byte(a[1:2]) This is trade off, though. I'll update "with getarg('b') version" to compare. -- Add

[issue5391] mmap: read_byte/write_byte and object type

2009-04-02 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : Removed file: http://bugs.python.org/file13215/py3k_mmap_and_bytes.patch ___ Python tracker ___ ___ Python-bugs-

[issue5391] mmap: read_byte/write_byte and object type

2009-04-03 Thread STINNER Victor
STINNER Victor added the comment: #5666 is closed. I finally prefers getarg('c') (byte string of lenght 1). -- ___ Python tracker ___

[issue5391] mmap: read_byte/write_byte and object type

2009-04-04 Thread Benjamin Peterson
Benjamin Peterson added the comment: Fixed in r71174. -- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed ___ Python tracker ___