[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1683368] object.__init__ shouldn't allow args/kwds

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1683368
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4100] xml.etree.ElementTree does not read xml-text over page bonderies

2008-10-13 Thread roland rehmnert

roland rehmnert [EMAIL PROTECTED] added the comment:

We had to be careful how we should handle this.

http://effbot.org/zone/element-iterparse.htm

A note on this site says following : 

Note: The tree builder and the event generator are not necessarily
synchronized; the latter usually lags behind a bit. This means that when
you get a “start” event for an element, the builder may already have
filled that element with content. You cannot rely on this, though — a
“start” event can only be used to inspect the attributes, not the
element content. For more details, see this
refhttp://mail.python.org/pipermail/xml-sig/2005-January/010838.html/ref.

I do understand that it might be so that elem.text is undefined at start.

I have not investigated how iterparse handle this situation over boundaries:

a text b text /b text /a

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4100
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1381] cmath is numerically unsound

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1381
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1685986] Method cache

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1685986
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1878] class attribute cache failure (regression)

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1878
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue214033] re incompatibility in sre

2008-10-13 Thread Jeffrey C. Jacobs

Jeffrey C. Jacobs [EMAIL PROTECTED] added the comment:

The duplicate zero-or-one repeat operator bug described in this issue 
originally no longer exists in python 2.6.

However, Trent Mick brings up a fair point in that expressions of the 
form (x*)? generate an error (issue 1456280) when internally the '?' 
should be passively stripped from the expression by the Python Regular 
Expression Compiler because it is redundant.  The same goes for 
expressions of the form (x*)* (issue 2537).  Also, there is a problem 
with expressions of the form (x*){n,m} (issue 1633953), since the x* 
matches as much as it can, and thus it sees the range repeat operation 
as redundant -- in this case I think the range repeat should have the 
effect of matching (x*)(x*)(x*)... n to m times, but since the first 
time matches everything, the subsequent matches all match zero-width 
expressions following the first one.  I am tracking all of these issues 
under Item 33 of Issue 2636.

The are the 3 known redundant repeat issues, but this one, the zero-or-
one followed by zero-or-one is AFAICT fixed in python 2.6 as the 
expression originally listed now passes compile.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue214033
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4018] for me installer problem on x64 Vista

2008-10-13 Thread Martin v. Löwis

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

Thanks for the confirmation. Committed as r66881, r66882, and r66883.

--
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4018
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1708652] Exact matching

2008-10-13 Thread Tom Lynn

Tom Lynn [EMAIL PROTECTED] added the comment:

Yes, that's right. The binary aspect of it was something of a red
herring, I'm afraid, although I still think that (or parsing in general)
is an important use case. The prime motivation it that it's easy to
either forget the '\Z' or to use '$' instead, which both cause subtle
bugs. An exact() method might help to avoid that.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1708652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue694374] Recursive regular expressions

2008-10-13 Thread Matthew Barnett

Matthew Barnett [EMAIL PROTECTED] added the comment:

Perl (?number) for calling numbered groups and (?name) for named groups
 (Perl also supports (?Pname)). (?R) is equivalent to (?0).

It's interesting that the documentation for both Perl and PCRE say that
they support (?Pname) because that's what Python uses!

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue694374
___
___
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-10-13 Thread Pernici Mario

Pernici Mario [EMAIL PROTECTED] added the comment:

In this patch I added to the patch by Mark in issue 3944 the code
in the previous patch, modified to release memory in case of exceptions.

Benchmark for division on Athlon 64 3800+  with respect to Python3.0:
(1)  Python with patch 30bit.patch
(2)  Python with this patch
up to 1000 digits (1) and (2) perform in the same way
digits(1)(2)
2000  4x 5x
4000  4x 7x
1 4x 10x
2 4x 13x
104x 27x

--
keywords: +patch
Added file: http://bugs.python.org/file11773/longobject2.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3451
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1456280] Traceback error when compiling Regex

2008-10-13 Thread Jeffrey C. Jacobs

Jeffrey C. Jacobs [EMAIL PROTECTED] added the comment:

This is another version of the redundant repeat issue defined in issues 
2537 and 1633953 and although not described by the original report for 
issue 214033, the comments further down that issue also describe a 
similar situation.

In this case, the problem arises from the '[(](?Pkey[^)]*)?[)]' 
portion of your regexp code because you have a zero-or-more repeat 
repeated zero-or-one times, which in the current version of python 
causes this error.  Technically, the outer zero-or-one operator ('?') is 
redundant and you can eliminate it, but this IMHO should not cause the 
error listed below and I will look into a solution in issue 2636.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1456280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4112] Subprocess: Popen'ed children hang due to open pipes

2008-10-13 Thread Boye Høverstad

New submission from Boye Høverstad [EMAIL PROTECTED]:

subprocess.Popen.wait() hangs if you have spawned multiple child
processes that do not terminate until their standard input is closed
('cat' is example of such a process).  This happens on POSIX platforms.
 I'm using Python 2.5.1, but I believe the issue is present in the SVN
trunk version of subprocess as well.

Here is a test program:
--
import subprocess, sys

p1 = subprocess.Popen(cat, bufsize=0, stdin=subprocess.PIPE)
p2 = subprocess.Popen(cat, bufsize=0, stdin=subprocess.PIPE)

p1.stdin.close()
ret = p1.wait()
print sys.stderr, Child 1 wait completed with ret, ret

p2.stdin.close()
ret = p2.wait()
print sys.stderr, Child 2 wait completed with ret, ret, Bye bye
--

The call to p1.wait() will never return.  If p2.wait is called first,
the program terminates cleanly.

p1 never terminates because p1.stdin is duplicated in the (second) child
process when the parent process forks as part of the call to p2 =
subprocess.Popen().  The line p1.stdin.close() thus has no effect.

I am not sure whether this is a bug or deliberate design, but the
behavior above seems a bit weird to me, and it took me quite some time
to figure out what happened.  However, the proposed fix below of course
has side effects that may be undesirable.

wait() will not hang if  the close on exec flag is set on the
subprocess pipes.  Conveniently, the method _set_cloexec_flag already
exists to do this, so the fix amounts to calling this from
Popen._get_handles:

elif stdin == PIPE:
p2cread, p2cwrite = os.pipe()
self._set_cloexec_flag(p2cwrite)

The last line is the added one, similar lines must be added for stdout
and stderr.

Alternatively, the test program above will terminate cleanly if
p1._set_cloexec_flag(p1.stdin) is added before the creation of p2.

--
components: Library (Lib)
messages: 74680
nosy: boye
severity: normal
status: open
title: Subprocess: Popen'ed children hang due to open pipes
type: behavior
versions: Python 3.1

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4112
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2819] Full precision summation

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2819
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4113] functools.partial(), no __name__; wrong __doc__

2008-10-13 Thread Andrew Stribblehill

New submission from Andrew Stribblehill [EMAIL PROTECTED]:

When I partially apply a function using functools.partial(), the
resultant function doesn't have the same name as the original function
(it has no __name__) and its docstring is that of functools.partial()
rather than that of the function that was partially applied.

Transcript:

Python 2.6 (r26:66714, Oct 13 2008, 10:32:02)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type help, copyright, credits or license for more information.
 import functools
 def sum(a,b,c):
...   return a+b+c
...
 functools.partial(sum,1)
functools.partial object at 0xf7efeb6c
 p = functools.partial(sum, 1)
 p.__name__
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'functools.partial' object has no attribute '__name__'
 p(2,3)
6
 sum.__name__
'sum'
 sum.__doc__
 p.__doc__
'partial(func, *args, **keywords) - new function with partial
application\n\tof the given arguments and keywords.\n'

--
components: Extension Modules
messages: 74682
nosy: stribb
severity: normal
status: open
title: functools.partial(), no __name__; wrong __doc__
type: behavior
versions: Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4113
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2751] Regression for executing packages

2008-10-13 Thread Nick Coghlan

Nick Coghlan [EMAIL PROTECTED] added the comment:

(Adding some additional details regarding the reasons why this became an
error again in 2.6)

The ImportError when attempting to execute a package was lost during the
conversion from the C-based implementation in 2.4 to the runpy module
based implementation as part of 2.5. Packages really aren't meant to be
executable with -m - it gets messy since__init__ is able to modify the
way module lookups work within the package, and there are various other
package specific details related to relative imports that don't apply
when dealing with normal modules.

That said, executing -m pkg.__init__ with Python 2.6 will generally
have the same effect as doing -m pkg with Python 2.5 (it keeps the
import machinery happy since the package gets imported normally first,
and so long as pkg.__init__ can cope with being first imported normally
for the package initialisation and then run as '__main__' it should also
work as a script).

Anyone that would like to see the ability to execute packages restored
should feel free to create a RFE issue for it, but it would take a
fairly detailed analysis of the import system to convince me that doing
so doesn't break any of the interpreter internals.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2751
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread TD22057

TD22057 [EMAIL PROTECTED] added the comment:

That's not my code - it's an example ;)

My code reads binary data from a hardware system that is encoding 32 bit
floats.  The numbers I get back from struct.decode have garbage appended
on the end of the floating point numbers beyond the 32 bit range.

There is no 32 bit float type in python that I can allocate.  If you
want a 32 bit type as an input, try this:

 v=123456789
 struct.unpack(fmt,struct.pack(fmt,v))
(123456792.0,)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3863] 2.6rc1: test_threading hangs on FreeBSD 6.3 i386

2008-10-13 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Apparently this can be merged in py3k. 

(in
http://www.python.org/dev/buildbot/trunk/x86%20FreeBSD%20trunk/builds/1589/step-test/0
:

[...]
test_threading
[18218 refs]
[18576 refs]
[17539 refs]
[17539 refs]
[17539 refs]
Skipping test_3_join_in_forked_from_thread due to known OS bugs on freebsd6
[...])

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3863
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2898] Add memory footprint query

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2898
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3487] sre bytecode verifier

2008-10-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión [EMAIL PROTECTED]:


--
nosy: +jcea

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3487
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

I don't understand your problem/question. It's not a bug of Python, 
it's a problem of conversion between the types float (32 bits) and 
double (64 bits).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2819] Full precision summation

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2819
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread TD22057

TD22057 [EMAIL PROTECTED] added the comment:

I'm receiving a 32 bit floating point number encoded in binary format. 
The correct value for that number is 1.8183e-7 which can be expressed in
single precision just fine.  Given that the number in the binary
encoding is 1.8183e-7, I expected to get that back, not
1.818300034983622e-07 (which is NOT the closest double precision number
to the actual single precision number).

After doing some experiments, I think the problem is a basic fact of
life in C code which is that casting that single precision value to a
double precision one does not specify what happens in the extra digits.
 So I'm getting garbage in the extra digits when the struct module C
code casts the single to a double.  The problem is that C doesn't assume
that the non-precise digits are zero.

Since this is a function of the underlying C language, I'll withdraw the
bug.  (Hmm - I don't seem to have permission to do that)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

The problem is not from Python but from your FPU during the conversion 
from 64 bits float to 32 float (made by struct.pack). Example in C:

#include stdio.h
int main()
{
float f;
double d;
d = 1.8183;
printf(d=%.20f\n, d);
f = (float)d;
d = (double)f;
printf(f=%.20f\n, f);
printf(d=%.20f\n, d);
return 0;
}

Result:
d=1.81832736   # ok
f=1.8183877380371094   # 64-32: loose precision
d=1.8183877380371094   # 32-64: no change

--
resolution:  - invalid
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2956] 2to3 should have a way to disable some fixers

2008-10-13 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Done in r66885.

--
nosy: +benjamin.peterson
resolution:  - accepted
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2956
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread Martin v. Löwis

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

I think the complaint is that presumably, when expanding the float to
double in unpacking, the result is not zero-padded. I cannot reproduce
the problem, though:

py
hexlify(struct.pack(d,struct.unpack(f,struct.pack(f,1.8183e-7))[0]))
'3e8867a1a000'

Seems to me that the zero-padding works just well.

TD22057, why do you say that 1.818300034983622e-07 is not the closest
number. AFAICT, this is not true: this *is* the closest number.

--
nosy: +loewis

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Here is a patch proposition:
 - a socket uses bytes
 - makefile() creates an unicode file using 'r' mode
 - default encoding ISO-8859-1 because I guess that most servers use 
this encoding, but you can change the encoding using encoding 
constructor optioan argument
 - read unicode and write unicode: convert convert from/to bytes at 
the last moment (just after/before reading/writing the socket)
 - cosmetic: use .startswith() instead of for example b[:2] == '..'

Test updates:
 - replace localhost by HOST
 - write a test for a logging (user + password)

Missing: no SSL unit test. I tested SSL on my personal POP3 account, 
but only the login.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file11775/poplib_unicode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread TD22057

TD22057 [EMAIL PROTECTED] added the comment:

Martin is correct.  I expected (naively) that struct would zero pad the
digits beyond the significant digits of a float.  As to whether it's
exact or not, see my first message:
 v=1.8183e-7
 v
1.81830001e-07

Since 32 bit floats only have ~7 digits of precision, I expected to get
the same thing back.  Not 7 digits + garbage.

Like I said, you can mark this bug as invalid since Python is just
reflecting what C is doing.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue214033] re incompatibility in sre

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


--
components: +Regular Expressions -Extension Modules

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue214033
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4115] split() method

2008-10-13 Thread Terry Scott

New submission from Terry Scott [EMAIL PROTECTED]:

x = Four score  and seven
x.split() = [Four, score, and, seven] 
x.split( ) = [Four, score,  , and, seven] 

Probably not a big deal but it seems that it should be consistent. One
of my students spotted it.

--
components: Windows
messages: 74701
nosy: terry.scott
severity: normal
status: open
title: split() method
type: behavior
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Since 32 bit floats only have ~7 digits of precision, I expected to 
get the same thing back. Not 7 digits + garbage.

This problem is a well known problem of conversion from base 2 (IEEE 
float) to base 10 (Python unicode string). Search for any programming 
FAQ, eg.
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate

Python is just reflecting what C is doing: the problem is deeper in 
the silicium. If you want a better precision, use an arbitrary 
precision float type like decimal.Decimal() or the GMP library 
(Python: gmpy)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4115] split() method

2008-10-13 Thread Tim Gordon

Tim Gordon [EMAIL PROTECTED] added the comment:

This is the intended behaviour.  See 
http://www.python.org/doc/2.5.2/lib/string-methods.html for details.

--
nosy: +QuantumTim

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4115] split() method

2008-10-13 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
resolution:  - invalid
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread Martin v. Löwis

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

 Python is just reflecting what C is doing: the problem is deeper in 
 the silicium. If you want a better precision, use an arbitrary 
 precision float type like decimal.Decimal() or the GMP library 
 (Python: gmpy)

The problem is indeed deeper, however, I doubt GMP is an answer here:
we are talking about the struct module, which, *by design* gives access
to 32-bit (inprecise) floating point numbers - not because people
deliberately want to perform computations inaccurately, but because
there is often a need to interface with this specific representation
(which originally probably was created for its own reasons, such as
to save space, or because some hardware didn't support double
precision).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

@loewis: Yes, the initial problem is about unpack(f, bytes). It's 
not possible to exact original 32 bits float value because Python 
forces a conversion to 64 bits float. The behaviour should be 
documented. Don't hesitate to reopen the bug if you consider that 
something should be fixed in Python.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4115] split() method

2008-10-13 Thread Terry Scott

Terry Scott [EMAIL PROTECTED] added the comment:

Benjamin,

Thanks. The documentation cleared this up for me. Thanks.

Terry

On Mon, 13 Oct 2008, Benjamin Peterson wrote:


 Changes by Benjamin Peterson [EMAIL PROTECTED]:


 --
 resolution:  - invalid
 status: open - closed

 ___
 Python tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue4115
 ___


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4115] split() method

2008-10-13 Thread Terry Scott

Terry Scott [EMAIL PROTECTED] added the comment:

Tim,

Duh, thanks sorry I didn't check the documentation. Thanks.

Terry

On Mon, 13 Oct 2008, Tim Gordon wrote:


 Tim Gordon [EMAIL PROTECTED] added the comment:

 This is the intended behaviour.  See
 http://www.python.org/doc/2.5.2/lib/string-methods.html for details.

 --
 nosy: +QuantumTim

 ___
 Python tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue4115
 ___


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4114] struct returns incorrect 4 byte float

2008-10-13 Thread Martin v. Löwis

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

 Don't hesitate to reopen the bug if you consider that
 something should be fixed in Python.

I agree that it should be closed; people should read general CS
introductory material to learn how floating point numbers work.

 @loewis: Yes, the initial problem is about unpack(f, bytes). It's 
 not possible to exact original 32 bits float value

Interestingly enough, it is possible - using the OPs approach.
If you want to truncate a 64-bit floating point number to a
32-bit one, pack it as float in the struct module, then unpack it.
Python will automatically pad the mantissa bytes with null bytes.

 because Python 
 forces a conversion to 64 bits float. The behaviour should be 
 documented. 

I think it's documented somewhere that a Python float is represented
with a C double. That should suffice, IMO.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4114
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4116] name conflict in ScrolledCanvas.__init__() in Lib/turtle.py

2008-10-13 Thread Gregor Lingl

New submission from Gregor Lingl [EMAIL PROTECTED]:

In ScrolledCanvas.__init__()  there's a name conflict with a methodname
of the parentclass Frame: _root. The bugfix consists in renaming this
attribute, which occurs only twice. No change in behaviour at all.

Regards,
Gregor

--
components: Library (Lib)
files: ScrolledCanvas.__init__.diff
keywords: patch
messages: 74709
nosy: gregorlingl, loewis
severity: normal
status: open
title: name conflict in ScrolledCanvas.__init__() in Lib/turtle.py
versions: Python 3.0
Added file: http://bugs.python.org/file11776/ScrolledCanvas.__init__.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4116
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11775/poplib_unicode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4117] missing update() in _Screen.setup() of Lib/turtle.py

2008-10-13 Thread Gregor Lingl

New submission from Gregor Lingl [EMAIL PROTECTED]:

In Lib/turtle.py

_Screen.setup() needs a final update() call in order
to ensure, that immediately following calls of window_width() or
window_height() return correct values.

Consequently the setup() method call in _Screen.__init__()
has to take place only after the call of TurtleScreen.__init__()

--
components: Library (Lib)
files: _Screen.setup.diff
keywords: patch
messages: 74710
nosy: gregorlingl, loewis
severity: normal
status: open
title: missing update() in _Screen.setup() of Lib/turtle.py
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file11777/_Screen.setup.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Ooops, my previous patch was wrong (startswith = not startswith).

I tested python trunk test for poplib: with minor changes, all tests 
are ok except tests using SSL. I get a select.error: (9, 'Bad file 
descriptor') from asyncore. So I tried to synchronize python3 ssl 
with python2 trunk, but it depends on python2 trunk version of the 
socket module and this module is very complex and hard to port to 
python3.

About EBADF error from select(), it may comes from missing makefile() 
method of the ssl socket wrapper.

Added file: http://bugs.python.org/file11778/poplib_unicode-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4118] Built-in compile() and ast module doc issues

2008-10-13 Thread Terry J. Reedy

New submission from Terry J. Reedy [EMAIL PROTECTED]:

From docs.python.org
2.6: Compile the source into a code or AST object.
3.0: Compile the source into a code object.
Add 'or AST ' to the latter.

Both: Refer to the _ast module documentation
there is none, docs only for the ast module, but see below

Both: for information on how to compile into and from AST objects.

This sentence should at least have 'and from AST ' deleted. The
information on 'from' is given in the previous sentence.
Both: source can either be a string or an AST object.

The ast doc adds nothing.  A modified abstract syntax tree can be
compiled into a Python code object using the built-in compile() function.

The remainder of the sentence could be replaced by the shorter
To compile into an AST object, import ast and pass ast.PyCF_ONLY_AST as
a flag.

This could be followed by See ast module documentation for more.


In the ast doc, both say: An abstract syntax tree can be generated by
passing _ast.PyCF_ONLY_AST ...

That should be ast, not _ast; the existence of the shadow C version is a
CPython implementation detail.

In the parse() doc lines, 'PyCF_ONLY_AST' should, I think, have the
'ast' prefix as the former will not work unless one does 'from ast
import PyCF_ONLY_AST' (or '... import *').


Back to compile():
2.6 (and before): When compiling a string with multi-line statements...
3.0 Caveats missing

The first, about '\n' versus '\r\n' still applies.
print (compile(def f():\r\n  pass #haha,'','exec')) #fails
print (compile(def f():\n  pass #haha,'','exec')) # succeeds

The second, at least for 2.5.2 and 3.0c1 (and I presume for 2.6), only
applies, it seems, based on testing, if the last line consists only of a
comment.  In the second example above, putting '#haha' on a separate
line fails.

See: 'compile' built-in function failures when missing EOL
http://bugs.python.org/issue1479099

I am not sure what to suggest, but a warning that is nearly always a
false alarm confuses and lulls.

--
assignee: georg.brandl
components: Documentation
messages: 74712
nosy: georg.brandl, tjreedy
severity: normal
status: open
title: Built-in compile() and ast module doc issues
versions: Python 2.6, Python 2.7, Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4118
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1479099] 'compile' built-in function failures when missing EOL

2008-10-13 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

As near as I can tell, for 2.5.2 and 3.0c1, the limitation on compile
only applies when the last line only contains a comment.

 print (compile(def f():\n  pass #haha,'','exec'))
code object module at 00AADAD0, file , line 1

 print (compile(def f():\n  pass\n#haha,'','exec')) # or
 print (compile(def f():\n  pass\n  #haha,'','exec'))
Traceback (most recent call last):
  File stdin, line 1, in module
  File , line 3
#haha

I would prefer more consistent behavior.  I have opened a separate doc
issue that includes the documentation of this issue.
http://bugs.python.org/issue4118

--
nosy: +tjreedy
versions: +Python 2.6, Python 2.7, Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1479099
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4119] ssl wrapper: add makefile() method

2008-10-13 Thread STINNER Victor

New submission from STINNER Victor [EMAIL PROTECTED]:

ssl module of Python 2.6 has a makefile() method whereas Python3 has 
not. Attached patch fix this issue. There a just a difference between 
Python2 and Python3 makefile() method: Python3 has not bufsize 
optional argument because SocketIO() is unbuffered.

--
components: Library (Lib)
files: ssl_makefile.py
messages: 74714
nosy: haypo
severity: normal
status: open
title: ssl wrapper: add makefile() method
versions: Python 3.0
Added file: http://bugs.python.org/file11779/ssl_makefile.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4119
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

New version:
 - fix SSL: self.file contains the SSL socket and not the raw socket!
 - upgrade test_poplib.py from Python trunk

poplib should be refactored to reuse the new IO library. But I don't 
know how to build a TextIO wrapper for a socket. Using TextIO, it 
would be possible to remove newline (CR/LF) and unicode 
encoding/decoding code.

Added file: http://bugs.python.org/file11780/poplib_unicode-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread Giampaolo Rodola'

Giampaolo Rodola' [EMAIL PROTECTED] added the comment:

I haven't tried the patch but I think that encoding should be a class
attribute as it is in ftplib and similar py3k network related modules.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

New version:
 - remove duplicate methods of POP3_SSL()
 - use makefile('r', encoding=self.encoding) to get a nice text 
wrapper with universal newline
 - remove newline conversion (done by TextIOWrapper)

Finally my patch removes more code in poplib.py than it adds :-D I 
like such patch.

Python3 new I/O library rocks!

Added file: http://bugs.python.org/file11781/poplib_unicode-4.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11778/poplib_unicode-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11780/poplib_unicode-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4119] ssl wrapper: add makefile() method

2008-10-13 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
assignee:  - janssen
nosy: +janssen

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4119
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

@giampaolo.rodola: Right, I also prefer encoding as a class attribute. 
So I wrote a new patch:
 - encoding is now a class attribute
 - continue SSL code factorization: SSL code is now around 10 lines 
instead of 70 lines!

Added file: http://bugs.python.org/file11782/poplib_unicode-5.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-10-13 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11781/poplib_unicode-4.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4119] ssl wrapper: add makefile() method

2008-10-13 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Ooops, ssl already has a makefile() method from socket object! I was 
confused because of the Python 2.6 version of socket module...

--
resolution:  - invalid
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4119
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4116] name conflict in ScrolledCanvas.__init__() in Lib/turtle.py

2008-10-13 Thread Gregor Lingl

Gregor Lingl [EMAIL PROTECTED] added the comment:

This patch applies to Python 2.6 as well
Gregor

--
versions: +Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4116
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4117] missing update() in _Screen.setup() of Lib/turtle.py

2008-10-13 Thread Gregor Lingl

Gregor Lingl [EMAIL PROTECTED] added the comment:

This patch applies to Python 2.6 as well
Gregor

--
versions: +Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com