[issue3443] crash on badly initialised AttributeError

2008-07-27 Thread Stefan Behnel

Stefan Behnel <[EMAIL PROTECTED]> added the comment:

Thanks a lot for the analysis. I was considering that this was a problem
with Cython, but since this was the first time I got a crash on this
(even Py3.0b1 didn't expose this), I wanted to ask here first.

Your explanation sounds like the right thing to do would be to clear the
exception state when a function exists cleanly but an exception was
raised and caught during its execution. So the exception state would
only stay available within the function itself. We could also try to
emulate the Py3 behaviour as outlined in PEP 3110. But we'll have to
discuss that on the Cython mailing list.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3451] Asymptotically faster divmod and str(long)

2008-07-27 Thread Fredrik Johansson

Fredrik Johansson <[EMAIL PROTECTED]> added the comment:

> Yes, definitely!  Though it depends a little bit how much complication
is involved.

Not that much, I think, the pure Python version being just a few lines
of code (plus a few more lines of boilerplate). But I'm not too familiar
with converting Python to C myself, so I may underestimate the
difficulties. It might get a little more complicated if you want to
minimize temporary allocations, for example.

> Now I'm just waiting for you to propose an implementation of integer
square root  :-).

Yes, there is also code for fast (O(M(n)) integer square roots in
libarith.py. This function would be much less useful overall as a
builtin, though.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2819] Full precision summation

2008-07-27 Thread Mark Dickinson

Mark Dickinson <[EMAIL PROTECTED]> added the comment:

Tests related to overflow, special-values, intermediate overflow, and
results at or near the boundary of the floating-point range have been
removed in r65258.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] functools.update_wrapper bug

2008-07-27 Thread Georg Brandl

Changes by Georg Brandl <[EMAIL PROTECTED]>:


--
assignee:  -> ncoghlan
nosy: +ncoghlan

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3443] crash on badly initialised AttributeError

2008-07-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

> So the exception state would only stay available 
> within the function itself.
AFAIK That's what python does for caught exceptions.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3139] bytearrays are not thread safe

2008-07-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

With the patch the following script crashes the 2.6 interpreter on Windows:

import sys, io, threading
stdout2 = io.open(sys.stdout.fileno(), mode="w")
def f(i):
for i in range(10):
stdout2.write(unicode((x, i)) + '\n')
for x in range(10):
t = threading.Thread(target=f, args=(x,))
t.start()

(with py3k, replace "stdout2.write" with a simple "print")

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] functools.update_wrapper bug

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

I think what you want is

functools.update_wrapper(myWrapper, str.split, ('__name__', '__doc__'))

--
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3452] subprocess.Popen description unclear.

2008-07-27 Thread lregebro

New submission from lregebro <[EMAIL PROTECTED]>:

In the documentation of subprocess.Popen the docs say:

"args should be a string, or a sequence of program arguments. The
program to execute is normally the first item in the args sequence or
string, but can be explicitly set by using the executable argument. "

The statement that the program to exectute is the "first item in the
args sequence or string" indicates that the first item in a string like
"ls -l", i.e. the "ls" will be the program. The next paragraph however
makes it clear that this is not the case, but by then the damage is
done, and you think that passing in "ls -l" will work.

Rewording this, perhaps by saying "The program to execute is normally
the first item in the args sequence, or the string if a string a given",
would make this clear.

--
assignee: georg.brandl
components: Documentation
messages: 70321
nosy: georg.brandl, lregebro
severity: normal
status: open
title: subprocess.Popen description unclear.
versions: Python 2.5, Python 2.6, Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3453] PyType_Ready doesn't ensure that all bases are ready

2008-07-27 Thread Roger Upole

New submission from Roger Upole <[EMAIL PROTECTED]>:

If a type's tp_base has not been initialized yet, PyType_Ready calls 
itself for tp_base.  However, it doesn't do the same for members of 
tp_bases.  The inheritance determinations assume that all bases are 
ready, in particular that tp_mro is not null.

--
components: Interpreter Core
messages: 70322
nosy: rupole
severity: normal
status: open
title: PyType_Ready doesn't ensure that all bases are ready
versions: Python 2.4, Python 2.5, Python 2.6

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3452] subprocess.Popen description unclear.

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

Thanks for the report. Fixed in r65259.

--
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3452] subprocess.Popen description unclear.

2008-07-27 Thread Benjamin Peterson

Changes by Benjamin Peterson <[EMAIL PROTECTED]>:


--
resolution:  -> fixed
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3453] PyType_Ready doesn't ensure that all bases are ready

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

I believe that's because the bases are supposed to be ready at the time
a subclass is created.

--
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3451] Asymptotically faster divmod and str(long)

2008-07-27 Thread Fredrik Johansson

Fredrik Johansson <[EMAIL PROTECTED]> added the comment:

For your convenience, I have split the division and numeral code off to
a standalone .py file which I'm attaching here.

I also updated the remainder logic to use the default divmod instead of
repeated subtraction, which ensures worst-case performance similar to
the builtin divmod in the very unlikely case that div_newton would
return junk.

Added file: http://bugs.python.org/file10990/div.py

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3451] Asymptotically faster divmod and str(long)

2008-07-27 Thread Fredrik Johansson

Fredrik Johansson <[EMAIL PROTECTED]> added the comment:

And here some timings on my laptop.

Both int->str and balanced division become faster somewhere between 1000
and 2000 digits. This is after editing the division benchmark to use
random numbers instead of exact powers of ten (interestingly causing a
bit of slowdown). String conversion might be a little slower for lengths
that aren't close to powers of two.

Added file: http://bugs.python.org/file10991/div_timings.txt

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2771] test issue

2008-07-27 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

Testing authorage

--
nosy: +loewis

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] functools.update_wrapper bug

2008-07-27 Thread Nick Coghlan

Nick Coghlan <[EMAIL PROTECTED]> added the comment:

The problem actually has to do with trying to use update_wrapper on a
method instead of a function - bound and unbound methods don't have all
the same attributes that actual functions do.

>>> import functools
>>> functools.WRAPPER_ASSIGNMENTS
('__module__', '__name__', '__doc__')
>>> functools.WRAPPER_UPDATES
('__dict__',)
>>> def f(): pass
...
>>> class C:
...   def m(): pass
...
>>> set(dir(f)) - set(dir(C.m))
set(['func_closure', 'func_dict', '__module__', 'func_name',
'func_defaults', '__dict__', '__name__', 'func_code', 'func_doc',
'func_globals'])

Is an exception the right response when encountering a missing
attribute? Given that the error can be explicitly silenced by writing
"functools.update_wrapper(g, str.split,
set(functools.WRAPPER_ASSIGNMENTS) & set(dir(str.split)))", I'm inclined
to think the current behaviour is the correct option.

Since this is an issue that doesn't come up with the main intended use
case for update_wrapper (writing decorators), and since it can be
handled easily by limiting the set of attributes copied to those the
object actually has, I'm converting this tracker item to an enhancement
request asking for a shorter way of spelling "ignore missing attributes"
(e.g. a keyword-only flag).

--
assignee: ncoghlan -> 
priority:  -> normal
type: behavior -> feature request
versions: +Python 2.7, Python 3.1 -Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] Ignore missing attributes in functools.update_wrapper

2008-07-27 Thread Nick Coghlan

Changes by Nick Coghlan <[EMAIL PROTECTED]>:


--
title: functools.update_wrapper bug -> Ignore missing attributes in 
functools.update_wrapper

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3454] __getitem__() doesn't capture all slices if class inherits from list, tuple or str

2008-07-27 Thread John Firestone

Changes by John Firestone <[EMAIL PROTECTED]>:


--
components: Interpreter Core
files: getitem_problem.py
nosy: johnf
severity: normal
status: open
title: __getitem__() doesn't capture all slices if class inherits from list, 
tuple or str
type: performance
versions: Python 2.5
Added file: http://bugs.python.org/file10992/getitem_problem.py

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3454] __getitem__() doesn't capture all slices if class inherits from list, tuple or str

2008-07-27 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc <[EMAIL PROTECTED]>:

When executing self[i:j], the __getslice__(self,i,j) method is called
first, if it exists. See
http://docs.python.org/ref/sequence-methods.html

Yes, the __(get|set|del)slice__ methods are deprecated since 2.0, but
for compatibility the built-in types must keep defining them. You may
want to override them as well if your class inherit from such a type.

With python 3.0 the __getslice__ slots were removed, and __getitem__ is
called in all cases.

--
nosy: +amaury.forgeotdarc
resolution:  -> wont fix
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3358] 2to3 Iterative Wildcard Matching

2008-07-27 Thread Collin Winter

Collin Winter <[EMAIL PROTECTED]> added the comment:

One option would be to use the faster recursive version, falling back to
the iterative version if you hit a "RuntimeError: maximum recursion
depth exceeded" error. This would keep the speed for most files, but
would allow 2to3 to parse files like the one in issue 2532.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] Ignore missing attributes in functools.update_wrapper

2008-07-27 Thread Antoine d'Otreppe

Antoine d'Otreppe <[EMAIL PROTECTED]> added the comment:

Thank you for considering this report :)

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3358] 2to3 Iterative Wildcard Matching

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

On Sun, Jul 27, 2008 at 6:07 PM, Collin Winter <[EMAIL PROTECTED]> wrote:
>
> Collin Winter <[EMAIL PROTECTED]> added the comment:
>
> One option would be to use the faster recursive version, falling back to
> the iterative version if you hit a "RuntimeError: maximum recursion
> depth exceeded" error. This would keep the speed for most files, but
> would allow 2to3 to parse files like the one in issue 2532.

Sounds fine to me. I think we should provide a command line switch, too

>
> ___
> Python tracker <[EMAIL PROTECTED]>
> 
> ___
>

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3358] 2to3 Iterative Wildcard Matching

2008-07-27 Thread Collin Winter

Collin Winter <[EMAIL PROTECTED]> added the comment:

Why include a command-line flag? Would you know when to use it? In what
cases would you want to second-guess the app like that?

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3455] os.remove()method document error

2008-07-27 Thread 香槟酒

New submission from 香槟酒 <[EMAIL PROTECTED]>:

in Python 2.5 document, os.remove() explain: On Windows, attempting to
remove a file that is in use causes an exception to be raised. but, i
run it in IDLE.it deletes my file that in use without any exception.

--
assignee: georg.brandl
components: Documentation
messages: 70334
nosy: georg.brandl, zkfarmer
severity: normal
status: open
title: os.remove()method document error
type: performance
versions: Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3455] os.remove()method document error

2008-07-27 Thread 香槟酒

Changes by 香槟酒 <[EMAIL PROTECTED]>:


--
type: performance -> resource usage

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3455] os.remove()method document error

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

What do you mean by "in use"?

--
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3358] 2to3 Iterative Wildcard Matching

2008-07-27 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

Never mind. I had thought it would take a while for the RuntimeError to
be generated, but it only took about 7 seconds; I have no need for a
command line switch.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2620] Multiple buffer overflows in unicode processing

2008-07-27 Thread Neal Norwitz

Neal Norwitz <[EMAIL PROTECTED]> added the comment:

Committed revision 65261 for 2.5
Committed revision 65262 for 2.4.

--
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com