Re: [Python-3000] Using memoryviews

2008-11-22 Thread Antoine Pitrou
le interested in more complex arrangements (that is, Scipy/Numpy people) have been completely absent from the python-dev community for many months now, and I don't think anyone else cares enough to do the job instead of them. Regards Antoine. ___ P

Re: [Python-3000] None in Comparisons: None vs. float("inf")

2008-11-12 Thread Antoine Pitrou
gt; math.tanh(f) 1.0 >>> math.exp(-f) 0.0 >>> 1 ** f 1.0 >>> 0 ** f 0.0 It is not complete though : >>> 2 ** f Traceback (most recent call last): File "", line 1, in OverflowError: (34, 'Numerical result out of range') >>> f ** 2 Traceb

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > >>> None > None > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: NoneType() > NoneType() > >>> None != None > False > > Two values that compare equal to each other (and are in fact identical), > yet cannot be comp

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Antoine Pitrou
ues before doing the complex calculation or query. Antoine. ___ 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] None in Comparisons

2008-11-11 Thread Antoine Pitrou
l, I think i would be cleaner and more explicit to add the Smallest and Largest constants suggested elsewhere, than reuse a very widely used constant (None) for half of the purpose. cheers Antoine. ___ Python-3000 mailing list Python-3000@python.org h

Re: [Python-3000] [python-committers] Proposed Python 3.0 schedule

2008-10-07 Thread Antoine Pitrou
Le mardi 07 octobre 2008 à 18:00 -0400, Barry Warsaw a écrit : > On Oct 7, 2008, at 4:28 PM, Guido van Rossum wrote: > > 15-Oct-2008 3.0 rc 2 > > 05-Nov-2008 3.0 rc 3 > > 19-Nov-2008 3.0 rc 4 > > 03-Dec-2008 3.0 final > > I'm okay with that too. It does seem odd to go back to beta then > re

Re: [Python-3000] [Python-Dev] Python3UnicodeDecodeError

2008-10-07 Thread Antoine Pitrou
Le mercredi 08 octobre 2008 à 00:00 +0200, "Martin v. Löwis" a écrit : > You seem to think that the notion of "file system encoding" > is also flawed - but do you infer from that that it also should be > removed? Under the condition we find something better, yes. Otherwise, let's keep the heuristi

Re: [Python-3000] [Python-Dev] Python3UnicodeDecodeError

2008-10-07 Thread Antoine Pitrou
pt in Python's simplified heuristics). There is one distinct encoding for each mounted filesystem. Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.o

Re: [Python-3000] Proposed Python 3.0 schedule (bytes/unicde again)

2008-10-07 Thread Antoine Pitrou
ould handle bytestrings on the path, and > should be populated using the bytes-version of os.environ so that > PYTHONPATH gets read in properly. Well, except on Windows where unicode paths are the Right Thing to do. But then we have a glaring incompatibility between major platforms. R

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

2008-10-01 Thread Antoine Pitrou
Stephen J. Turnbull sk.tsukuba.ac.jp> writes: > > It's usually not "hypothetical"; often, the user knows what it is. > Why not ask her? That's what web browsers do, in effect, by providing > View as Charset commands. The average user does not even /know/ what a charset is. Web browsers provide

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

2008-10-01 Thread Antoine Pitrou
Stephen J. Turnbull xemacs.org> writes: > > What makes you think the filenames are invalid? The file*names* are > probably perfectly valid in the intended encoding; they are simply > invalid in the encoding that Python wants to apply. Those filenames don't work today with Python 3, the problem

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

2008-10-01 Thread Antoine Pitrou
Greg Ewing canterbury.ac.nz> writes: > > Seems like what will fail is taking one of these utf-8b > decoded names and passing it to some external library > that uses it as a filename without knowing that it has > to use utf-8b to encode it. Then the funny characters > won't be encoded the way they

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

2008-09-30 Thread Antoine Pitrou
); we can't wait for > a PEP to resolve this issue for 3.0. Yes, I was thinking of a PEP for 3.1, with the solution for 3.0 being "it's a bug, don't use Python 3.0 on such broken systems" :-) Regards Antoine. ___ Python-30

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

2008-09-30 Thread Antoine Pitrou
Martin v. Löwis v.loewis.de> writes: > > True. I try to outweigh the need for simplicity in the API against the > need to support all cases. So I see two solutions: > > a) (...) > > b) (...) By the way, doesn't all this controversy yearn for a PEP? __

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

2008-09-30 Thread Antoine Pitrou
Le lundi 29 septembre 2008 à 17:50 -0600, Adam Olsen a écrit : > It's correct in the sense that it can roundtrip all filenames. UTF-8b > is lossy, so certain filenames are not roundtripped properly. Why do you say UTF-8b is lossy? From what I've read it claims to be lossless (i.e. the range of ch

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

2008-09-30 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > > The only way to display that file would be to transform it into some > other valid unicode string. However, as that string is already valid, > you've just made any files named after it impossible to open. Not if those valid sequences are also properly escaped t

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

2008-09-29 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > > UTF-8b doesn't work as intended. It produces an invalid unicode > object (garbage surrogates) that cannot be used with external APIs or > libraries that require unicode. At least it works with all Python operations supported by the unicode type (methods, concat

Re: [Python-3000] PyUnicodeObject implementation

2008-09-26 Thread Antoine Pitrou
So what would be the outcome of this discussion, and should a decision (and which one) be taken? Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http

Re: [Python-3000] How much should non-dict mappings behave like dict?

2008-09-12 Thread Antoine Pitrou
mpared to using items() anyway), but this will be my last comment on the issue as well :) Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailma

Re: [Python-3000] [Python-Dev] dbm.sqlite

2008-09-09 Thread Antoine Pitrou
Josiah Carlson gmail.com> writes: > > While the wrapper for sqlite to offer > a dbm-like interface is relatively untested (it does have testcases > thanks to Skip), dealing with a couple-hundred (at most) line wrapper > is far more reasonable for testing, verification, bugfixing, etc., > than the

Re: [Python-3000] PyUnicodeObject implementation

2008-09-09 Thread Antoine Pitrou
better to tweak the parameters that we have > in the Unicode implementation (e.g. raise the KEEPALIVE_SIZE_LIMIT > to 32, see the ticket for details) and to improve > the memory allocator for storage of small memory chunks or > improve the free list management (which Antoine did with hi

Re: [Python-3000] [Python-Dev] dbm.sqlite

2008-09-09 Thread Antoine Pitrou
Nick Coghlan gmail.com> writes: > > Given that the *API* is fixed though, it is probably better to have the > module present in 3.0 and bring it back to the main line in 2.7. > > If any absolute clangers from a performance/stability point of view get > past Raymond (and everyone else with an int

[Python-3000] os.write accepts unicode strings

2008-09-08 Thread Antoine Pitrou
Hello, I thought I'd mention the following issue before it's too late to possibly fix it in 3.0. Basically, os.write() accepts str as well as bytes object, which doesn't sound right. http://bugs.python.org/issue3782 Regards Antoine. ___

Re: [Python-3000] PyUnicodeObject implementation

2008-09-08 Thread Antoine Pitrou
Stefan Behnel behnel.de> writes: > > cdef class MyListSubType(PyListObject): > cdef int some_additional_int_field > cdef my_struct* some_struct > > def __init__(self): > self.some_struct = get_the_struct_pointer(...) > self.some_additional_int_

Re: [Python-3000] PyUnicodeObject implementation

2008-09-07 Thread Antoine Pitrou
Stefan Behnel behnel.de> writes: > > From a Cython perspective, I find the lack of efficient subclassing after such > a change particularly striking. That seriously bit me in Py2 when I tried > making XML text content a bit more intelligent in lxml (i.e. make it remember > what XML element it ori

Re: [Python-3000] PyUnicodeObject implementation

2008-09-06 Thread Antoine Pitrou
Marc-André Lemburg (one of the authors of the unicode implementation) is opposed to that change. See the discussion in the bug tracker issue for the details. Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.o

Re: [Python-3000] About "daemon" in threading module

2008-09-04 Thread Antoine Pitrou
t be passed as one of the constructor arguments. It would make code shorter, and avoid the mistyping risk mentioned by Jesus. It also sounds saner, since you shouldn't change the flag after the thread is started anyway. Regards Antoine. ___ Py

[Python-3000] 3.0: smaller than 2.6

2008-08-31 Thread Antoine Pitrou
Hi, Just a bunch of simple statistics between the current py3k branch and the trunk. Compilation was done with all default values (bare "./configure") on a Linux machine with gcc, in non-debug mode. The fact that 3.0 is measurably smaller than 2.6 (for various meanings of the "size" metric) is n

Re: [Python-3000] io deadlock, use of RLock, issues 3618 & 3001 thoughts

2008-08-21 Thread Antoine Pitrou
ons. Are there cases of reentrancy apart from tracing? signals and other asynchronous stuff perhaps? Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.pyt

Re: [Python-3000] Beta 3 planned for this Wednesday

2008-08-20 Thread Antoine Pitrou
nly problem is that our testing types must themselves conform to the intended behaviour - do you think you have sufficient understanding of the spec to be able to do that? Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail

Re: [Python-3000] Beta 3 planned for this Wednesday

2008-08-19 Thread Antoine Pitrou
some things will be either not implemented, or perhaps defective (since there isn't anything to test with). Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://

[Python-3000] Slight cleanup of the PyMemoryView API

2008-08-19 Thread Antoine Pitrou
Hi, Would anybody object to the slight cleanup of the C PyMemoryView API that I proposed in http://bugs.python.org/issue3560 ? It's better to do this now before any third party extension starts relying on it. Regards Antoine. ___ Python

Re: [Python-3000] Beta 3 planned for this Wednesday

2008-08-19 Thread Antoine Pitrou
Barry, could you please take a look at http://bugs.python.org/issue2834 ? It's not marked as release blocker but if it doesn't integrate beta3 it will probably not make it at all into 3.0 (unless you are fine with such a change before an rc). Thank

Re: [Python-3000] XML as bytes or unicode?

2008-08-18 Thread Antoine Pitrou
Benjamin Peterson gmail.com> writes: > > Well, unless the parser decodes explicitly, I believe this should be true. XML documents have an encoding declaration... the parser's should be able to handle it, no? Actually, I've just checked and ElementTree does support bytes input, including with no

[Python-3000] XML as bytes or unicode?

2008-08-18 Thread Antoine Pitrou
I took a look at test_sax and it seems sax.parser expects all (XML) input as unicode rather than bytes. Apparently ElementTree does the same. Is there any rationale for this decision? cheers Antoine. ___ Python-3000 mailing list Python-3000

Re: [Python-3000] python -S

2008-08-14 Thread Antoine Pitrou
s added). Thanks a lot for the suggestion. Works perfectly. Regards Antoine. ___ 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 -S

2008-08-14 Thread Antoine Pitrou
Christian Heimes cheimes.de> writes: > > Couldn't you use "from _thread import allocate_lock as Lock" instead? I feel stupid for not thinking of such an obvious solution. (by the way, is _thread always available?) ___ Python-3000 mailing list Python-

Re: [Python-3000] python -S

2008-08-14 Thread Antoine Pitrou
. Antoine. ___ 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

[Python-3000] python -S

2008-08-14 Thread Antoine Pitrou
Hello, I have a problem with "python -S". When python is launched from its build dir, the extension build dir is not added to sys.path, and thus importing some modules fails: $ ./python -S -c "import threading" Traceback (most recent call last): File "", line 1,

Re: [Python-3000] Providing compress/uncompress functions in gzip

2008-08-01 Thread Antoine Pitrou
gzip.decompress() would be an useful addition. Regards Antoine. ___ 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] MemoryError oddities

2008-07-31 Thread Antoine Pitrou
Amaury Forgeot d'Arc gmail.com> writes: > > I corrected this with r65341. > But this prebuilt MemoryError has another nasty consequence: > when PyErr_NoMemory is raised, the traceback is attached to the > prebuilt object, > and all local variables of the failing procedure are still referenced > a

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Antoine Pitrou
://bugs.python.org/issue2690 (« Precompute range length », which has the - positive, IMHO - side effect that range objects of length greater than sys.maxsize cannot be created at all) is still awaiting a resolution. Regards Antoine. ___ Python-300

Re: [Python-3000] Bytes and unicode conversion in C extensions

2008-07-29 Thread Antoine Pitrou
NLY* "bytes" in the bsddb API > (when working under Python 3.0), and do the proxy thing *ONLY* in the > testsuite, to be able to reuse it. You needn't do any proxy thing in the testsuite. Just use b"..." literals, they also work in 2.6. > PPS: In dbm (gdb

[Python-3000] Signature of RawIOBase.read() ?

2008-07-28 Thread Antoine Pitrou
egards Antoine. ___ 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

[Python-3000] Review needed: regular expressions and unicode

2008-07-28 Thread Antoine Pitrou
I think we should leave that to a later patch. The status of re.LOCALE is another issue again. The issue is at http://bugs.python.org/issue2834 and the patch can be reviewed at http://codereview.appspot.com/2439 Thanks Antoine. ___ Python-3000 mailin

Re: [Python-3000] PEPs

2008-07-21 Thread Antoine Pitrou
h (see test case: http://hg.pitrou.net/public/py3k/py3k/file/184db4b87529/Lib/test/test_raise.py#l100 ) (3) "Open Issue: Garbage Collection" has been resolved as part of PEP 3110 (see "semantic changes" in the latter) (4) "Open Is

[Python-3000] Review desired for 2523: binary buffered reading is quadratic

2008-07-17 Thread Antoine Pitrou
Hi, it would be nice if someone could take a look at the patch for issue 2523. Right now it takes py3k 30 seconds at 100% CPU to read a 10MB binary file. Thanks Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org

Re: [Python-3000] Bug 3139

2008-07-16 Thread Antoine Pitrou
this one? We don't have much time left > to fix things like this. > I think it's definitely too short. Martin has outlined a clean solution to this but it's a lot of changes. Let's wait for beta 3. Regards Antoine. ___ Py

Re: [Python-3000] Reminder: beta 2's schedule for tomorrow

2008-07-15 Thread Antoine
> I can do that for you. OTOH, I think it's time we gave Antoine commit > access; we've gotten nothing but great things out of him so far. :) Part of the reason Benjamin says this is probably that I've been bugging him quite a few times to commit some pending patches (he wa

Re: [Python-3000] commit access request

2008-07-15 Thread Antoine Pitrou
Hey, My previous mail to the list apparently lost itself somewhere... > > I can do that for you. OTOH, I think it's time we gave Antoine commit > > access; we've gotten nothing but great things out of him so far. :) > > Antoine just needs to ask himself and

Re: [Python-3000] Reminder: beta 2's schedule for tomorrow

2008-07-15 Thread Antoine Pitrou
om/2448 (PEP 3134 exception reporting), Guido said: « I think it's time to check this in, before beta 2 gets released! » Unfortunately I don't have commit privileges, so someone has to do it for me. cheers Antoine. ___ Python-3000 mailing

[Python-3000] PEP 3134 exception reporting

2008-07-13 Thread Antoine Pitrou
Right now we don't know whether the new chained tracebacks will appear useful in practice, and whether long traceback chains will be frequent or not (although intuitively they shouldn't). Regards Antoine. ___ Python-3000 mailing list Python-

Re: [Python-3000] Is this a bug with list comprehensions or not?

2008-07-13 Thread Antoine Pitrou
Greg Ewing canterbury.ac.nz> writes: > > This seems like a lot of trouble to go to in order to > fix a rather obscure problem. Is it really a serious > enough problem in practice? Anyone have any real-life > stories about this? Agreed. I think it is ok for some behaviours to be unspecified and s

Re: [Python-3000] Is this a bug with list comprehensions or not?

2008-07-10 Thread Antoine Pitrou
o maintain code. (if you want to stop an iterator based on some predicate you can use itertools.takewhile()) Regards Antoine. ___ 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] Second betas tomorrow

2008-07-01 Thread Antoine Pitrou
her strange because it can lead you to override the exception's __traceback__ attribute) By the way, Barry, did you read the thread about regexps behaviour vis-à-vis bytes and unicode? Your advice was requested :-) See http://mail.python.org/pipermail/python-3000/2008-June/01424

[Python-3000] re.LOCALE

2008-06-29 Thread Antoine Pitrou
Another question, about re.LOCALE. Its utility is dubious, and it's never used in the stdlib (apart from the re tests themselves). What should we do: - drop it entirely - only allow it on bytes patterns (it doesn't make sense on unicode strings) - leave it as-is ?

Re: [Python-3000] Regular expressions, py3k and unicode

2008-06-29 Thread Antoine Pitrou
Mark Dickinson gmail.com> writes: > > In any case, it seems to me that having something like re.ASCII > would be useful. Should an inline flag "(?a)" also be introduced to mirror the existing "(?u)" to set the unicode flag inside a pattern? ___ Pyth

Re: [Python-3000] Regular expressions, py3k and unicode

2008-06-29 Thread Antoine Pitrou
Mark Dickinson gmail.com> writes: > > Is there a quick way to convert a general Unicode digit to its > ascii equivalent? Having to run str(int(c)) on each numeric character > sounds painful, and the Decimal constructor doesn't need to > be any slower right now. In C it looks like PyUnicode_Enco

Re: [Python-3000] Regular expressions, py3k and unicode

2008-06-29 Thread Antoine Pitrou
('\uff11') 1 >>> int('\uff11') == 1 True >>> float('\uff11') 1.0 >>> float('\uff11') == 1.0 True >>> decimal.Decimal('\uff11') Traceback (most recent call last): File "", line 1, in File "/home

Re: [Python-3000] Regular expressions, py3k and unicode

2008-06-29 Thread Antoine Pitrou
Nick Coghlan gmail.com> writes: > > Would there be any reason (I do not know) to replace that with an > > re.ASCII flag to have the reverse effect (assuming there is not now)? > > I'd be inclined to have it implied by the type of the argument - a str > argument implies re.UNICODE is set, a byte

[Python-3000] Regular expressions, py3k and unicode

2008-06-28 Thread Antoine Pitrou
6c60> pat = re.compile('Á'.encode('latin1'), re.IGNORECASE | re.UNICODE) pat.match('á') # gives <_sre.SRE_Match object at 0xb7c66c60> Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http:/

Re: [Python-3000] PEP 3134 exception reporting

2008-06-27 Thread Antoine Pitrou
lmost zero overhead in the common case where context chains are trivially short) Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/op

Re: [Python-3000] stdlib as .zip by default, pydoc to view source?

2008-06-23 Thread Antoine
> Antoine Pitrou <[EMAIL PROTECTED]> wrote: > > That is for a warm cache. > > If you drop your caches first (like this under linux) you get quite a > different story... > > $ sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches' > $ time python -c &q

[Python-3000] PyException_Set{Traceback,Cause,C ontext}

2008-06-22 Thread Antoine Pitrou
ight thing? Regards Antoine. ___ 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

[Python-3000] PEP 3134 exception reporting

2008-06-21 Thread Antoine Pitrou
e "", line 1, in File "f.py", line 22, in raise_cause inner_raise_cause() File "f.py", line 13, in inner_raise_cause raise KeyError from e KeyError Thanks in advance for your advice Antoine. ___ Python-300

Re: [Python-3000] stdlib as .zip by default, pydoc to view source?

2008-06-21 Thread Antoine Pitrou
Neil Schemenauer arctrix.com> writes: > I wonder if it would make sense to start installing the Python > standard library as a .zip file by default. Some benefits would be > a tidier and more compact install and slightly faster startup times. Are any users complaining about Python's install size

[Python-3000] Implicit exception chaining (patch)

2008-06-13 Thread Antoine Pitrou
ption messages for you). Interested people can read at: http://bugs.python.org/issue3108 Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/ma

Re: [Python-3000] Betas today - I hope

2008-06-13 Thread Antoine Pitrou
k to storing __exit__ in a temporary variable. That's because "finally" blocks have gotten more complex semantics, and it is too quirky to try to find out the stack level where we stored __exit__. cheers Antoine. ___ Python-3000 mailing

Re: [Python-3000] Betas today - I hope

2008-06-13 Thread Antoine Pitrou
ldn't be hard to have a WITH_SETUP opcode (along with the already > existing WITH_CLEANUP) that would make the bytecode read like: It's not really a change in behaviour, just an optimization, isn't it? Antoine. ___ Python-3000 mailin

Re: [Python-3000] Betas today - I hope

2008-06-12 Thread Antoine Pitrou
methods whose behaviour they want to special-case. Another potential (but perhaps far-fetched) motivation is that a proxy implementation in the stdlib could be tweaked or rewritten in C, and thus be much quicker that the naive implementation most people (including me :-)) might come up

[Python-3000] PEP 3134 status ? (Exception Chaining)

2008-06-07 Thread Antoine Pitrou
likes to muck around with the interpreter stack). In any case, both versions of the patch are available: the one which also implies exception stacking in "finally" blocks, and the one which doesn't. Regards Antoine. ___ Python-

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Antoine Pitrou
;t mention the with_traceback() method of exception objects. Antoine. ___ 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] Exception re-raising woes

2008-06-01 Thread Antoine Pitrou
Hello, A patch is now at http://bugs.python.org/issue3021 . Antoine. ___ 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

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
n. At the expense of a performance hit for operations which currently use tstate->exc_* (sys.exc_info() itself, bare "raise"...). Right now I have a patch using my original implementation proposal. I'll post it soon. regards Antoine. _

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
te and the calling frame's own exception state. They will have no useful meaning for outside code so I suggest they are not accessible from Python code anymore. Regards Antoine. ___ Python-3000 mailing list Python-3000@python.org http://

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > > By the way, another interesting sys.exc_info() case: > > > > def except_yield(): > >try: > >raise TypeError > >except: > >yield 1 > > > > def f(): > >for i in except_yield(): > >return sys.exc_info() > > > > Right now, running f

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
for i in except_yield(): return sys.exc_info() Right now, running f() returns (None, None, None). But with rewritten exception stacking, it may return the 3-tuple for the TypeError raised in except_yield(). Regards Antoine. ___ Python-3000

Re: [Python-3000] Exception re-raising woes

2008-05-30 Thread Antoine Pitrou
# Albert likes his exceptions uncooked raise else: logging.exception("an exception occurred") def f(): try: raise KeyError except: handle_exception() Antoine. ___ Python-3000 mailing list Python

Re: [Python-3000] Exception re-raising woes

2008-05-30 Thread Antoine Pitrou
will continue relying on these values. regards Antoine. ___ 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] Exception re-raising woes

2008-05-30 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > I'd like if a bare "raise" became purely lexical (as Guido just > suggested), ditching all the magic. > > However, things such as pdb.pm() still need access to the last > exception. Maybe we can pare it down the bare minimum, a per-thread > last_exception? That'd

Re: [Python-3000] Exception re-raising woes

2008-05-30 Thread Antoine Pitrou
ass > raise Please note as well that: def f(): try: 1/0 except: pass return sys.exc_info() would return (None, None, None). Actually, it already does with the patch I proposed for #2507, and the test suite runs fine after fixing a problem in doctest.py. Regards Antoine. _

Re: [Python-3000] urllib.quote/unquote behavior?

2008-05-30 Thread Antoine Pitrou
ng part (after the ? sign). The file path percent-encoding may depend on the actual filesystem encoding, or the Web server configuration. The query string percent-encoding may depend on the actual Web application being queried, or the programming language in which it's written, or anything else al

Re: [Python-3000] Exception re-raising woes

2008-05-30 Thread Antoine Pitrou
proposal looks fine - we must fix both #2507 and #2833 in a clean way, but your proposal is completely bogus cheers Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://m

Re: [Python-3000] PEP 3138- String representation in Python 3000

2008-05-22 Thread Antoine Pitrou
eplace all occurrences of repr() by ascii(), to err on the safe side. Regards Antoine. ___ 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] PEP 3138- String representation in Python 3000

2008-05-22 Thread Antoine Pitrou
Unicode. Of course you can encode to UTF-8, UTF-16, etc. - which /are/ encodings (and, in this case, Python returns you a bytes object :-)). Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/pyt

Re: [Python-3000] Special offer! Ten code reviews

2008-05-02 Thread Antoine Pitrou
Guido van Rossum python.org> writes: > > I'd like to get some more people trying out codereview.appspot.com, so > I'm offering the first 10 people to submit a new patch there for my > review to do the review by Monday. I just tried to submit a patch using the Web form, and got a 500 Server Error

Re: [Python-3000] [OT] sizeof(size_t) < sizeof(l ong)

2008-04-17 Thread Antoine Pitrou
8 bits. > > Nope. Everyone understands "octet" to be 8 bits. And in French, the only word for "byte" is... "octet" ;-) Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/li

Re: [Python-3000] sizeof(size_t) < sizeof(long)

2008-04-15 Thread Antoine Pitrou
Mark Dickinson gmail.com> writes: > Fair enough. My twisted mind was trying to find ways that size_t > might be something other than long or long long, but that > seems unlikely... There has been a report where sizeof(size_t) < sizeof(long). It breaks things in the dict implementation: http://bu

Re: [Python-3000] Recursive str

2008-04-13 Thread Antoine Pitrou
Greg Ewing canterbury.ac.nz> writes: > > It might not be a serious problem when most of the chars in > the string are ascii, but what about e.g. a Japanese user > whose strings consist almost entirely of non-ascii, but are > for the most part what constitutes perfectly readable text > to them? Th

[Python-3000] r62195 - in python/trunk: Doc/c-api/file.rst Include/fileobject.h Lib/test/test_file.py Misc/NEWS Objects/fileobject.c

2008-04-09 Thread Antoine Pitrou
Christian wrote: > > Make file objects as thread safe as the underlying libc FILE* > > implementation. > > close() will now raise an IOError if any operations on the file object > > are currently in progress in other threads. > > > > Most code was written by

Re: [Python-3000] readinto annotation

2008-04-07 Thread Antoine Pitrou
Gregory P. Smith krypto.org> writes: > > yes bytearray makes more sense to me given that its hard to read into an immutable bytes object ;) It seems to me that readinto accepts any object providing a writeable buffer interface. I don't know how to express that as an annotation, though. __

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Antoine Pitrou
st): File "", line 1, in RuntimeError: dictionary changed size during iteration The "problem" here is that while d.keys() returns the view, enumerate() in turn calls iter() on the view and that iterator fails on you when dictionary changed size (as iterkeys() alread

Re: [Python-3000] problems with the 3to2 converter

2008-04-01 Thread Antoine Pitrou
Steve Howell yahoo.com> writes: > >line 673234: lambda cannot be renamed in ANY > temporal dimension > [...] > >line 913975: parens not removed from print(), > please use 3to4 converter instead Mmmh... "3to2" was released on April 1st right ? :) _

Re: [Python-3000] Exception tracebacks living too long in 3.0

2008-03-29 Thread Antoine Pitrou
> The explanation seems to be that, while exc_info is cleared immediately, the > thread state exception fields are only cleaned up at the end of > PyEval_EvalFrameEx. Patch and test in http://bugs.python.org/issue2507 ___ Python-3000 mailing list Pyth

Re: [Python-3000] Exception tracebacks living too long in 3.0

2008-03-29 Thread Antoine Pitrou
Py_DECREF(v); break; Regards Antoine. ___ 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

[Python-3000] Allocation of unicode objects

2008-02-10 Thread Antoine Pitrou
.3 msec per loop -> PyVarObject patch: 17.8 msec per loop Even if the patch is rejected, I think it is important to remember that implementation characteristics of the unicode type will be crucial for Py3k performance :-) Regards Antoine. ___ Python-3000 mail

Re: [Python-3000] Who wants to help me reorganize the stdlib?

2007-12-06 Thread Antoine Pitrou
s thread. I might have time to give some help, and the subject does not seem too frightening for someone not expert in Python internals (please correct me if it is :-)), so don't hesitate to add me to your list. Regards Antoine. ___ Python-3000 ma

[Python-3000] PEP: Eliminate __del__

2007-05-07 Thread Antoine Pitrou
enable_finalizer() method with the list of attributes to keep alive on the "ghost object". Antoine. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.o

Re: [Python-3000] interpolated strings

2006-12-06 Thread Antoine
> (people who do interpolation tend to expect dynamic lexical scoping, not > static > object binding...) After thinking a bit about it, you are right. Or more precisely, "inline" interpolation with literals is mainly useful for quick-and-dirty scripts rather than full-blown apps. (this "quick-an

Re: [Python-3000] interpolated strings

2006-12-06 Thread Antoine
> Or perhaps simpler, a new kind of string literal would construct an > Interpolation object: Hmm, so Jan proposed something similar in the meantime. Sorry for the noise. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mail

  1   2   >