Re: [Python-3000] unicode_test

2008-11-24 Thread Victor Stinner
; and Run -> Run Module -> it gives error "invalid character in > identifier" This bug may be related to: http://bugs.python.org/issue4323 -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000

Re: [Python-3000] Possible py3k problem.

2008-11-19 Thread Victor Stinner
Le Wednesday 19 November 2008 15:39:43 Martin (gzlist), vous avez écrit : > This is covered in the documentation, isn't it? > > > > Important note for callback functions: > > Make sure you keep references to CFUNCTYPE objects as long a

Re: [Python-3000] Possible py3k problem.

2008-11-19 Thread Victor Stinner
Le Wednesday 19 November 2008 10:21:16 Victor Stinner, vous avez écrit : > > Attached program works with > > GSL is needed. Debian package: libgsl0-dev > > dump.py works correctly on computer: Ooops, "./python dump.py" is ok but "./python dump.py 1" does

Re: [Python-3000] Possible py3k problem.

2008-11-19 Thread Victor Stinner
> Attached program works with GSL is needed. Debian package: libgsl0-dev dump.py works correctly on computer: - Debian Sid - python 3.0 trunk - i386 Problem specific to x86_64? Where is the issue? :-) Victor ___ Python-3000 mailing list Python-3000@p

Re: [Python-3000] 2.6.1 and 3.0

2008-11-18 Thread Victor Stinner
Le Tuesday 18 November 2008 11:03:02 Facundo Batista, vous avez écrit : > 2008/11/17 Barry Warsaw <[EMAIL PROTECTED]>: > > Martin suggests, and I agree, that we should release Python 3.0 final and > > 2.6.1 at the same time. Makes sense to me. That would mean that Python > > 2.6.1 should be ready

[Python-3000] Status of the email package ? (or: email package and unicode)

2008-11-12 Thread Victor Stinner
ASCII charset! See the reported bugs at: http://bugs.python.org/issue4306 Before the Python 3.0 final, we have to test the email package with unicode characters! I wrote two small patches, one includes at little test :-) -- Victor Stinner aka haypo http://www.haypocalc.com

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Victor Stinner
ger an None ;-) I like the new behaviour, it helps to detect bugs earlier ! I hope that the -bb option will be enabled by default in Python 2.7 :-) You can use an explicit comparaison to None as workaround for your problem: (x is None) or (x < y) -- Victor Stinner aka haypo http://www.hayp

Re: [Python-3000] [Python-Dev] RELEASED Python 3.0rc2

2008-11-07 Thread Victor Stinner
d somewhere that someone wrote a document explaining how to port a C extension to Python3. What about a link to the "What's new in Python 2.6" document? Most people are still using Python 2.4 or 2.5. And Python3 is Python 2.5 + + . -- Victor Stinner aka haypo http://w

Re: [Python-3000] bug in idle on rc1

2008-11-05 Thread Victor Stinner
n.org/view?rev=66518&view=rev That's why we are all waiting on barry for python 3.0rc2 :-) Thanks for the report, but next time, please use the tracker: http://bugs.python.org/ -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ P

Re: [Python-3000] close() on open(fd, closefd=False)

2008-10-31 Thread Victor Stinner
> Rightnow close() doesn't do anything and you can still write > or read after close(). This behavior is surprising to the user. > I like to change close() to set the internal fd attribute > to -1 (meaning close) but keep the fd open. Let take an example: --- passwd = open('/etc/

[Python-3000] email libraries: use byte or unicode strings?

2008-10-28 Thread Victor Stinner
ocol and so I'm unable to test it. But nntplib should also use byte strings only. Note: imaplib and nntplib have no test :-( -- What about smtplib or smtpd? -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 maili

Re: [Python-3000] No rc2 tonight

2008-10-17 Thread Victor Stinner
r is the commit fixing issue #3988. runtests.sh have to use the -bb flag! -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mai

Re: [Python-3000] Proposed Python 3.0 schedule

2008-10-07 Thread Victor Stinner
wait for Python 3.1 (maybe 3.0.1)? -- People wants to try the new Python version! Python3 introduces new amazing features like "keyword only arguments". The bytes/unicode problem is old and only affects broken systems Windows (90% of the computers in the world?) only uses characters

Re: [Python-3000] Issues about Python script encoding

2008-10-02 Thread Victor Stinner
rminal locale since IDLE uses a "locale encoding" (import IOBinding; IOBinding.encoding) which is marked as "deprecated" in IDLE source code. (We should use the bug tracker to discuss this issue) -- Victor Stinner aka haypo http://www.haypocalc.com/blog/

Re: [Python-3000] PEP: Python3 and UnicodeDecodeError

2008-10-02 Thread Victor Stinner
.org/moin/Python3UnicodeDecodeError -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-300

[Python-3000] Issues about Python script encoding

2008-10-02 Thread Victor Stinner
f a duplicate incomplete (eg. no UTF-8 BOM support) code to detect the encoding) -> reuse codecs.BOM_UTF8 in tokenize That's all for today :) -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python

Re: [Python-3000] PEP: Python3 and UnicodeDecodeError

2008-10-02 Thread Victor Stinner
Le Thursday 02 October 2008 14:07:50 M.-A. Lemburg, vous avez écrit : > On 2008-10-02 13:50, Victor Stinner wrote: > > This is a PEP (...) > > The PEP doesn't appear to address any potential changes. Wouldn't > it be better to add such information to the Python3 docume

[Python-3000] PEP: Python3 and UnicodeDecodeError

2008-10-02 Thread Victor Stinner
This is a PEP describing the behaviour of Python3 on UnicodeDecodeError. It's a *draft*, don't hesitate to comment it. This document suppose that my patch to allow bytes filenames is accept which is not the case today. While I was writing this document I found poential problems in Python3. So h

Re: [Python-3000] [Python-Dev] New proposition for Pyt hon3 bytes filename issue

2008-10-01 Thread Victor Stinner
I don't know if it would help the discussion, but Java uses its own modified UTF-8 encoding: * NUL byte is encoded as 0xc0 0x80 instead of 0x00 * Java doesn't support unicode > 0x (boh!) http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf

Re: [Python-3000] [Python-Dev] New proposition for Python3 bytes filename issue

2008-09-30 Thread Victor Stinner
r getcwd) and fix the test_unicode_file.py listdir() change (ignore invalid filenames) is important to avoid strange bugs in os.path.*(), glob.*() or on displaying a filename. I can generate a specific patch for these issues. It's just a subset of my last patch. -- Victor Stinner aka

[Python-3000] Filename: unicode normalization

2008-09-30 Thread Victor Stinner
No such file or directory: 'NFC-xäx' >>> open(normalize('NFD', 'NFD-xäx')).close() >>> open(normalize('NFC', 'NFD-xäx')).close() IOError: [Errno 2] No such file or directory: 'NFD-xäx' If the user chooses a result fro

Re: [Python-3000] [Python-Dev] New proposition for Python3 bytes filename issue

2008-09-30 Thread Victor Stinner
to change the existing code, but it doesn't fix the problem, it's just move problems which be raised later. I didn't get an answer to my question: what is the result + ? I guess that the result is instead of raising an error (invalid types). So again: why introducing a new type inste

Re: [Python-3000] [Python-Dev] Patch for an initia l support of bytes filename in Python3

2008-09-30 Thread Victor Stinner
ly as part of this patch, but somewhere related? I > don't know what they would do, but it does seem quite likely that code > which was previously correct under 2.6 (using bytes) would suddenly be > mixing bytes and unicode with these APIs. It looks like 2to3 convert all text '

[Python-3000] Patch for an initial support of bytes filename in Python3

2008-09-29 Thread Victor Stinner
Modules/posixmodule.c | 83 ++ 5 files changed, 62 insertions(+), 65 deletions(-) TODO: - review this patch :-) - support non-ASCII bytes in fnmatch.filter() - fix other functions, eg. posixpath.isabs() and fnmatch.fnmatchcase() - fix

Re: [Python-3000] [Python-Dev] Filename as byte string in python 2.6 or 3.0?

2008-09-29 Thread Victor Stinner
Le Tuesday 30 September 2008 01:31:45 Adam Olsen, vous avez écrit : > The alternative is not be valid unicode, but since we can't use such > objects with external libs, can't even print them, we might as well > call them something else. We already have a name for that: bytes. :-) __

Re: [Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Victor Stinner
coded in ISO-8859-1 whereas the second argument is encoding in Unicode. It's something like that: str(b'dossi\xc3\xa9', 'ISO-8859-1') + '/' + 'fichi\xe9' Whereas the correct (unicode) result should be: 'dossié

Re: [Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Victor Stinner
en(filename): ... We need an "if" to choose the directory. The second "if" is only needed to display the filename. Using bytes, it would be possible to write better code detect the real charset (eg. ISO-8859-1 in a UTF-8 file system) and so display correctly the filena

Re: [Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Victor Stinner
#x27;re right. So i wrote a new patch: os_getcwdb.patch With my patch we get (Python3): * os.getcwd() -> unicode * os.getcwdb() -> bytes Previously in Python2 it was: * os.getcwd() -> str (bytes) * os.getcwdu() -> unicode -- Victo

Re: [Python-3000] [Python-Dev] New proposition for Python3 bytes filename issue

2008-09-29 Thread Victor Stinner
Patches are already avaible in the issue #3187 (os.listdir): Le Monday 29 September 2008 14:07:55 Victor Stinner, vous avez écrit : > - listdir(unicode) -> unicode and raise an error on invalid filename Need raise_decoding_errors.patch (don't clear Unicode error > - listdir(b

Re: [Python-3000] [Python-Dev] Filename as byte string in python 2.6 or 3.0?

2008-09-29 Thread Victor Stinner
we don't choose the right solution. -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/o

[Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Victor Stinner
creen, he can uses: text = str(filename, fs_encoding, "replace") -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe:

Re: [Python-3000] issue 3187 and decoding filenames

2008-08-21 Thread Victor Stinner
es (nor str). class MyBuffer(bytes): def __new__(self, data): obj = bytes.__new__(self, data) obj.myattribute = 42 return obj -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ ___ Python-3000 mailing list Python-3000@pyth

Re: [Python-3000] Python, int/long and GMP

2007-09-30 Thread Victor Stinner
-long_gmp-v2.patch Victor -- Victor Stinner http://hachoir.org/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Re: [Python-3000] Python, int/long and GMP

2007-09-28 Thread Victor Stinner
one of the most important type! > I can vouch for that. Allocation can easily dominate performance. It > invalidates the rest of the benchmark. I may also use Python garbage collector for GMP memory allocations since GMP allows to use my own memory allocating functions. GMP also has its o

Re: [Python-3000] Unicode and OS strings

2007-09-19 Thread Victor Stinner
r-core/hachoir_core/tools.py#L225 Source code of function getTerminalCharset(): http://hachoir.org/browser/trunk/hachoir-core/hachoir_core/i18n.py#L23 Victor Stinner http://hachoir.org/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-19 Thread Victor Stinner
'xyz'[0] 'x' >>> b"xyz"[0] 120 This result is not symmetric. I would prefer what Guido proposes: >>> 'xyz'[0] 'x' >>> b"xyz"[0] b'x' And so be able to write such tests:

Re: [Python-3000] python 3 closes sys.stdout

2007-08-26 Thread Victor Stinner
gt;fd; > self->fd = -1; > Py_BEGIN_ALLOW_THREADS Hum, a before fix would be to add an option to choose if the file should be closed or not on object destruction. Victor Stinner aka haypo http://hachoir.org/ ___ Python-3000 mailing list Python

[Python-3000] format() method and % operator

2007-08-17 Thread Victor Stinner
ent ({0} != {1}), etc. I didn't read the PEP nor all email discussions. So can you tell me if it would be possible to write simply: "{} {}".format('Hello', 'World') Victor Stinner aka haypo http://hachoir.org/ ___ Pyth

Re: [Python-3000] Questions about email bytes/str (python 3000)

2007-08-15 Thread Victor Stinner
only one charset: latin-1. So I you use UTF-8, he will not understand conversion errors. Another argument: I like bidirectional codec: decode(encode(x)) == x encode(decode(x)) == x So if you mix bytes and str, these relations will be wrong. Victor Stinner aka haypo h

[Python-3000] Questions about email bytes/str (python 3000)

2007-08-13 Thread Victor Stinner
dule and Python 3000, please first contact me. When I will get a better patch, I will submit it. Victor Stinner aka haypo http://hachoir.org/ ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000

Re: [Python-3000] [Email-SIG] fix email module for python 3000 (bytes/str)

2007-08-13 Thread Victor Stinner
Hi, On Monday 13 August 2007 19:51:18 Guido van Rossum wrote: > Checked in. But next time please do use SF to submit patches (and feel > free to assign them to me and mail the list about it). Ah yes, you already asked to use SF. I will use it next time. > On 8/12/07, Victor Stinne

Re: [Python-3000] bytes regular expression?

2007-08-12 Thread Victor Stinner
backward compatibility. Why character string are "optimized" (cached) but not byte string? Since regex parsing is slow, it's a good idea to avoid recomputation in re.compile(). Regular expression for bytes are useful for file, network, picture, etc. manipulation.

Re: [Python-3000] [Email-SIG] fix email module for python 3000 (bytes/str)

2007-08-12 Thread Victor Stinner
in test_voc() - avoid division by zero - use startswith method: replace h[:2] == b'BM' by h.startswith(b'BM') - use aifc.open() instead of old aifc.openfp() - use ord(b'P') instead of ord('P') Victor Stinner aka haypo http://hachoir.org/ Index: Lib/im

Re: [Python-3000] bytes: compare bytes to integer

2007-08-12 Thread Victor Stinner
instead of b'xyz' it would be easier to understand that first value is an integer and not the *letter* X or the *string* X. I dislike b'xyz'[0:1] == b'x' since I want to check first item and not to compare substrings. Victor Stinner aka haypo http://hachoir.org/ _

[Python-3000] Fix sndhdr module for bytes

2007-08-10 Thread Victor Stinner
check division by zero in functions test_hcom and test_voc. I think that division by zero means that the file is invalid. I didn't want to fix these bugs in the same patch. So first I'm waiting your comments about this one :-) Victor Stinner http://hachoir.

[Python-3000] Fix imghdr module for bytes

2007-08-10 Thread Victor Stinner
uot;h[0] == 'P'". A shorter syntax would be "h[0] == 80" but I prefer explicit test. It's maybe stupid, we manipulate bytes and not character, so "h[0] == 80" is acceptable... maybe with a comment? imghdr is included in unit tests? Victor Stinner http:/

[Python-3000] bytes: compare bytes to integer

2007-08-10 Thread Victor Stinner
; False Two solutions: 1. b'xyz'[0] returns a new bytes object (b'x' instead of 120) like b'xyz'[0:1] does 2. allow to compare a bytes string of 1 byte with an integer I prefer (2) since (1) is wrong: bytes contains integers and not bytes! Victor Stinner ak

Re: [Python-3000] [Email-SIG] fix email module for python 3000 (bytes/str)

2007-08-10 Thread Victor Stinner
Hi, On Thursday 09 August 2007 02:41:08 Victor Stinner wrote: > I started to work on email module to port it for Python 3000, but I have > trouble to understand if a function should returns bytes or str (because I > don't know email module). It's really hard to convert ema

Re: [Python-3000] bytes regular expression?

2007-08-10 Thread Victor Stinner
On Thursday 09 August 2007 19:21:27 Thomas Heller wrote: > Victor Stinner schrieb: > > I prefer str8 which looks to be a good candidate for "frozenbytes" type. > > I love this idea! Leave str8 as it is, maybe extend Python so that it > understands the s"..."

Re: [Python-3000] bytes regular expression?

2007-08-09 Thread Victor Stinner
b'', b'')) is bytes assert type(re.sub(b'(x)', b'[\\1]', b'x')) is bytes My first patch mix bytes and str8 and so re.sub fails in some cases. So here is a new patch using str8 in dictionary key and str in regex parsing (sre_parse.py) (and t

Re: [Python-3000] bytes regular expression?

2007-08-09 Thread Victor Stinner
Python 3000, we should use new types like set (use a set for _alphanum instead of a dictionary) and functions like enumerate (in _escape for str block). Victor Stinner http://hachoir.org/ Index: Lib/re.py === --- Lib/re.py (révi

[Python-3000] bytes regular expression?

2007-08-08 Thread Victor Stinner
quot;, line 241, in _compile_repl p = _cache_repl.get(key) TypeError: unhashable type: 'bytes' Does "frozen bytes type" (immutable) exist to be able to use a cache? Victor Stinner aka haypo http://hachoir.org/ ___ Python-300

[Python-3000] fix email module for bytes/str

2007-08-08 Thread Victor Stinner
it requires an argument but I don't know the right value! Maybe b'\n\r\v\t '? - iterate on a bytes object gives number and not bytes object, eg. for c in b"small text": if re.match("(\n|\r)", c): ... Is it possible to 'bytes' regex?

Re: [Python-3000] tp_bytes and __bytes__ magic method

2007-08-08 Thread Victor Stinner
On Thursday 09 August 2007 00:54:47 Guido van Rossum wrote: > On 8/8/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > > Victor Stinner just made a good point at #python. The py3k has no magic > > method and type slot for bytes (...) > > I can think of a bunch of u

Re: [Python-3000] tp_bytes and __bytes__ magic method

2007-08-08 Thread Victor Stinner
On Thursday 09 August 2007 00:22:51 Christian Heimes wrote: > Hey Pythonistas! > > Victor Stinner just made a good point at #python. The py3k has no magic > method and type slot for bytes. And another problem: mix of __str__ and __unicode__ methods. class A: def __str__(self): ret

Re: [Python-3000] py3k-struni: proposition to fix ctypes bug, ctypes c_char creates bytes

2007-08-08 Thread Victor Stinner
On Wednesday 08 August 2007 18:45:38 you wrote: > Thanks! Would you mind submitting to SF and assigning to Thomas Heller > (theller I think)? > > And update the wiki (http://wiki.python.org/moin/Py3kStrUniTests) Thomas Heller did it. Thanks ;-) Victor Stinner aka haypo http:/

[Python-3000] py3k-struni: proposition to fix ctypes bug, ctypes c_char creates bytes

2007-08-08 Thread Victor Stinner
t;c_char(b'x')" instead of "c_char('x')" - bytes is mutable whereas str is not: this may break some modules based on ctypes Victor Stinner aka haypo http://hachoir.org/ Index: Modules/_ctypes/cfield.c ==