[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2007-12-12 Thread Mark Summerfield

Mark Summerfield added the comment:

On 2007-12-11, Guido van Rossum wrote:
> Guido van Rossum added the comment:
>
> This really is a feature request -- in Python 2.x there is no formatting
> code for complex numbers at all, and "%.5s" % complex(...) does the same
> thing.
>
> I agree it would be neat to have control over complex numbers using the
> same formatting language used for floats; but I note that it's easy
> enough to do this manually, e.g.
>
> >>> "{0.real:.5}+{0.imag:.5}j".format(z)
>
> '1+0.7j'

That's not quite right because it doesn't always handle the sign
correctly and doesn't force float output. So I think it should be this:

'1.0+0.7j'
>>> "{0.real:.5f}{0.imag:+.5f}j".format(complex(1, -2/3))
'1.0-0.7j'

__
Tracker <[EMAIL PROTECTED]>

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



[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)

2007-12-12 Thread Mark Summerfield

New submission from Mark Summerfield:

(1) IDLE starts up on Windows OK, but if I press Alt+F the file menu
comes up giant sized (i.e., each menu entry is almost as tall as the
screen).
(2) If I open a file using Ctrl+O, the Open dialog pops up fine, but
when I select a file and click Open, IDLE crashes.

Oh, and (no version of) IDLE respects the cursor blink setting on Windows.

--
components: IDLE
messages: 58486
nosy: mark
severity: normal
status: open
title: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Mark Summerfield

New submission from Mark Summerfield:

I don't know if this is a bug, but it is certainly a difference in
behavior between platforms:

Python 3.0a2 on linux2:
>>> "{0:.3e}".format(123.45678901)
'1.235e+02'

Python 3.0a2 on win32:
>>> "{0:.3e}".format(123.45678901)
'1.235e+002'

It seems to me that str.format() should produce consistent results
across platforms, but I don't think the PEP says anything either way.

--
components: Interpreter Core
messages: 58485
nosy: mark
severity: normal
status: open
title: str.format() produces different output on different platforms (Py30a2)
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1602] windows console doesn't print utf8 (Py30a2)

2007-12-12 Thread Mark Summerfield

New submission from Mark Summerfield:

I am not sure if this is a Python bug or simply a limitation of cmd.exe.

I am using Windows XP Home.
I run cmd.exe with the /u option and I have set my console font to
"Lucida Console" (the only TrueType font offered), and I run chcp 65001
to set the utf8 code page.
When I run the following program:

for x in range(32, 2000):
print("{0:5X} {0:c}".format(x))

one blank line is output.

But if I do chcp 1252 the program prints up to 7F before hitting a
unicode encoding error.

This is different behaviour from Python 2.5.1 which (with a suitably
modified print line) after chcp 65001 prints up to 7F and then fails
with "IOError: [Errno 0] Error".

--
components: Unicode, Windows
messages: 58487
nosy: mark
severity: normal
status: open
title: windows console doesn't print utf8 (Py30a2)
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1603] Wanted behaviour ?

2007-12-12 Thread Stefan Sonnenberg-Carstens

New submission from Stefan Sonnenberg-Carstens:

>>> a = {}
>>> a['a'] = [1,2,3,4,5]
>>> a['b'] = [1,2,3,4,5]
>>> a['c'] = [1,2,3,4,5]
>>> for k in a.keys():
... print a[k]
... for t in a[k]:
... del a[k][a[k].index(t)]
... print a[k]
...
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]

Does this make sense ?

--
messages: 58488
nosy: pythonmeister
severity: normal
status: open
title: Wanted behaviour ?
type: behavior
versions: Python 2.3

__
Tracker <[EMAIL PROTECTED]>

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



[issue1603] Wanted behaviour ?

2007-12-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is the expected behaviour.
See the "warning" paragraph at the bottom of
http://docs.python.org/ref/for.html

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1592] operations on closed shelves fail cryptically

2007-12-12 Thread Erno Kuusela

Erno Kuusela added the comment:

How about the following patch. With it, you get an IOError.

>>> s = shelve.open('/tmp/t', 'c')
>>> s.has_key('foo')
0
>>> s.close()
>>> s.has_key('foo')
Traceback (most recent call last):
  File "", line 1, in ?
  File "shelve.py", line 107, in has_key
return self.dict.has_key(key)
  File "shelve.py", line 94, in getdict
raise IOError, 'shelf has been closed'
IOError: shelf has been closed

Added file: http://bugs.python.org/file8930/shelve.diff

__
Tracker <[EMAIL PROTECTED]>

__--- shelve.py.orig  2007-12-12 12:27:07.0 +0200
+++ shelve.py   2007-12-12 12:44:15.0 +0200
@@ -73,6 +73,7 @@
 
 __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"]
 
+
 class Shelf(UserDict.DictMixin):
 """Base class for shelf implementations.
 
@@ -81,13 +82,21 @@
 """
 
 def __init__(self, dict, protocol=None, writeback=False):
-self.dict = dict
+self._dict = dict
 if protocol is None:
 protocol = 0
 self._protocol = protocol
 self.writeback = writeback
 self.cache = {}
 
+def getdict(self):
+if self._dict is None:
+raise IOError, 'shelf has been closed'
+else:
+return self._dict
+
+dict = property(getdict)
+
 def keys(self):
 return self.dict.keys()
 
@@ -136,7 +145,8 @@
 self.dict.close()
 except AttributeError:
 pass
-self.dict = 0
+
+self._dict = None
 
 def __del__(self):
 if not hasattr(self, 'writeback'):
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-12 Thread Andreas Hasenack

Andreas Hasenack added the comment:

At the least it should be made clear in the documentation that the
hostname is not checked against the commonName nor the subjectAltName
fields of the server certificate. And add some sample code to the
documentation for doing a simple check. Something like this, to illustrate:

def get_subjectAltName(cert):
if not cert.has_key('subjectAltName'):
return []
ret = []
for rdn in cert['subjectAltName']:
if rdn[0].lower() == 'dns' or rdn[0][:2].lower() == 'ip':
ret.append(rdn[1])
return ret

def get_commonName(cert):
if not cert.has_key('subject'):
return []
ret = []
for rdn in cert['subject']:
if rdn[0][0].lower() == 'commonname':
ret.append(rdn[0][1])
return ret


def verify_hostname(cert, host):
cn = get_commonName(cert)
san = get_subjectAltName(cert)
return (host in cn) or (host in san)

__
Tracker <[EMAIL PROTECTED]>

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



[issue1590] "make altinstall" installs pydoc, idle, smtpd.py

2007-12-12 Thread David Ripton

David Ripton added the comment:

Here's a patch, against the 3.0a2 tarball.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1590] "make altinstall" installs pydoc, idle, smtpd.py

2007-12-12 Thread David Ripton

David Ripton added the comment:

Same patch appears to work fine against the 2.5.1 tarball.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1590] "make altinstall" installs pydoc, idle, smtpd.py

2007-12-12 Thread David Ripton

Changes by David Ripton:


Added file: http://bugs.python.org/file8931/altinstall.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1577] shutil.move() does not use os.rename() if dst is a directory

2007-12-12 Thread Raghuram Devarakonda

Raghuram Devarakonda added the comment:

Then, a small change in  the doc might clarify the usage (as OP suggested);

"If the destination is on our current filesystem, then simply use
rename." can be replaced with:

"If the destination is a fiile and is on same filesystem as that of
src, then simply use rename."

__
Tracker <[EMAIL PROTECTED]>

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



[issue1577] shutil.move() does not use os.rename() if dst is a directory

2007-12-12 Thread Ingemar Nilsson

Ingemar Nilsson added the comment:

> If you want a way to do the "mv" semantics, propose
> a new API.

shutil.mv()?

__
Tracker <[EMAIL PROTECTED]>

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



[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

> I thought Python 3 was meant to be an _improvement_:-)

That's why I didn't close the issue but reclassified it.

Or did you expect me to implement it overnight? :-)

__
Tracker <[EMAIL PROTECTED]>

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



[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)

2007-12-12 Thread Guido van Rossum

Changes by Guido van Rossum:


--
assignee:  -> kbk
nosy: +kbk

__
Tracker <[EMAIL PROTECTED]>

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



[issue1294] Management of KeyboardInterrupt in cmd.py

2007-12-12 Thread Raghuram Devarakonda

Raghuram Devarakonda added the comment:

"Tomorrow" took a while to come by :-)

With out the patch, pdb prints this on Ctrl-C:

"KeyboardInterrupt
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program"

With the patch, pdb prompt appears again. Ctrl-D change doesn't effect
pdb because do_EOF() is already implemented. My test was on SuSE 10 Linux.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

Again, a (not unreasonable) feature request.  AFAIK %e behaves the same
way.  I'm sure if you submitted a patch it would be accepted happily.

--
nosy: +gvanrossum
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Mark Summerfield

Mark Summerfield added the comment:

On 2007-12-12, Guido van Rossum wrote:
> Guido van Rossum added the comment:
>
> Again, a (not unreasonable) feature request.  AFAIK %e behaves the same
> way.  I'm sure if you submitted a patch it would be accepted happily.

Unfortunately, I can't---I haven't programmed C in more than a decade,
and don't know Python's C API, so I doubt I could write anything in C
that would actually work! Nowadays I only program in Python and C++:-)

__
Tracker <[EMAIL PROTECTED]>

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



[issue1457] IDLE - configDialog - new layout for key config

2007-12-12 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser:


--
assignee:  -> kbk
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1567] Patch for new API method _PyImport_ImportModuleNoLock(char *name)

2007-12-12 Thread Kurt B. Kaiser

Kurt B. Kaiser added the comment:

Doesn't seem to be IDLE related, removed IDLE tag.

--
components:  -IDLE
nosy: +kbk

__
Tracker <[EMAIL PROTECTED]>

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



[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)

2007-12-12 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser:


--
keywords: +py3k

__
Tracker <[EMAIL PROTECTED]>

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



[issue1604] collections.deque.__init__ doesn't initialize

2007-12-12 Thread Neil Cerutti

New submission from Neil Cerutti:

Passing an interable to the __init__ method of an existing deque 
appends those elements, rather than reinitializing the deque with the 
items. This is contrary to how list.__init__ works.

test_deque.py verifies the (possibly) incorrect behavior.

--
components: Library (Lib)
messages: 58501
nosy: Horpner, rhettinger
severity: normal
status: open
title: collections.deque.__init__ doesn't initialize
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>

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



[issue1604] collections.deque.__init__ doesn't initialize

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

I agree, I put the list behavior in on purpose.

Should be fixed in 2.6, not 2.5 though, since it's a feature.

--
assignee:  -> rhettinger
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue1597] running test_ctypes 25 times in a row causes it to fail

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks!  (I agree with Eric Smith that this is mysterious for the
innocent bystander.)

Also, what about the -33/+33 leaks?  I suppose these are harmless, but
it would be better if the test reliably didn't report leaks...

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1597] running test_ctypes 25 times in a row causes it to fail

2007-12-12 Thread Thomas Heller

Thomas Heller added the comment:

Guido van Rossum schrieb:
> Thanks!  (I agree with Eric Smith that this is mysterious for the
> innocent bystander.)

I have added a comment.

> Also, what about the -33/+33 leaks?  I suppose these are harmless, but
> it would be better if the test reliably didn't report leaks...

I am using my own definition of leaking:  a test is leaking if references
grow without bounds ;-).

Ok, I found that the test in charge is Lib/ctypes/test/test_loading.py,
LoaderTest.test_find.  This test uses the ctypes.util.find_library function,
which contains several calls to os.popen(...).read().

The minimal code reporting the -33/+33 leaks that I found is simply this:

   os.popen('ls').read()

Is there a problem in "os.popen(...)", or do I something wrong here?

__
Tracker <[EMAIL PROTECTED]>

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



[issue1597] running test_ctypes 25 times in a row causes it to fail

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

> The minimal code reporting the -33/+33 leaks that I found is simply this:
>
>os.popen('ls').read()
>
> Is there a problem in "os.popen(...)", or do I something wrong here?

Try this instead:

 p = os.popen('ls')
 try:
   x = p.read()
 finally:
   p.close()

IOW close the pipe explicitly. That should make the code execute in a
more reproducible fashion. I've fixed this in ctypes/util.py now:
r59477.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-12 Thread Bill Janssen

Bill Janssen added the comment:

Yes, I think that's reasonable.  And for pseudo-standards like https, which
calls for this, the implementation in the standard library should attempt to
do it automatically.  Unfortunately, that means that client-side certificate
verification has to be done (it's pointless to look at the data in
unverified certificates), and that means that the client software has to
have an appropriate collection of root certificates to verify against.  I
think there's an argument for adding a registry of root certificates to the
SSL module, just a module-level variable that the application can bind to a
filename of a file containing their collection of certificates.  If it's
non-None, the https code would use it to verify the certificate, then use
the commonName in the subject field to check against the hostname in the
URL.  If it's None, the check would be skipped.

Bill

On Dec 12, 2007 4:48 AM, Andreas Hasenack <[EMAIL PROTECTED]> wrote:

>
> Andreas Hasenack added the comment:
>
> At the least it should be made clear in the documentation that the
> hostname is not checked against the commonName nor the subjectAltName
> fields of the server certificate. And add some sample code to the
> documentation for doing a simple check. Something like this, to
> illustrate:
>
> def get_subjectAltName(cert):
>if not cert.has_key('subjectAltName'):
>return []
>ret = []
>for rdn in cert['subjectAltName']:
>if rdn[0].lower() == 'dns' or rdn[0][:2].lower() == 'ip':
>ret.append(rdn[1])
>return ret
>
> def get_commonName(cert):
>if not cert.has_key('subject'):
>return []
>ret = []
>for rdn in cert['subject']:
>if rdn[0][0].lower() == 'commonname':
>ret.append(rdn[0][1])
>return ret
>
>
> def verify_hostname(cert, host):
>cn = get_commonName(cert)
>san = get_subjectAltName(cert)
>return (host in cn) or (host in san)
>
> __
> Tracker <[EMAIL PROTECTED]>
> 
> __
>

Added file: http://bugs.python.org/file8933/unnamed

__
Tracker <[EMAIL PROTECTED]>

__Yes, I think that's reasonable.  And for pseudo-standards like https, 
which calls for this, the implementation in the standard library should attempt 
to do it automatically.  Unfortunately, that means that client-side 
certificate verification has to be done (it's pointless to look at the data 
in unverified certificates), and that means that the client software has to 
have an appropriate collection of root certificates to verify against.  I 
think there's an argument for adding a registry of root certificates to the 
SSL module, just a module-level variable that the application can bind to a 
filename of a file containing their collection of certificates.  If 
it's non-None, the https code would use it to verify the certificate, then 
use the commonName in the subject field to check against the hostname in the 
URL.  If it's None, the check would be skipped.
BillOn Dec 12, 2007 4:48 AM, Andreas 
Hasenack [EMAIL PROTECTED]> 
wrote:
Andreas Hasenack added the comment:At the least it should be made 
clear in the documentation that thehostname is not checked against the 
commonName nor the subjectAltNamefields of the server certificate. And add 
some sample code to the
documentation for doing a simple check. Something like this, to 
illustrate:def get_subjectAltName(cert):       
 if not cert.has_key('subjectAltName'):       
         return []        ret 
= []
        for rdn in cert['subjectAltName']: 
               if rdn[0].lower() == 
'dns' or rdn[0][:2].lower() == 'ip':       
                
 ret.append(rdn[1])        return ret
def get_commonName(cert):        if not 
cert.has_key('subject'):             
   return []        ret = []   
     for rdn in cert['subject']:     
           if rdn[0][0].lower() == 
'commonname':
                     
   ret.append(rdn[0][1])        return 
retdef verify_hostname(cert, host):       
 cn = get_commonName(cert)        san = 
get_subjectAltName(cert)        return (host in cn) or 
(host in san)
__Tracker [EMAIL PROTECTED]>http://bugs.python.org/issue1589
>__

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



[issue1597] running test_ctypes 25 times in a row causes it to fail

2007-12-12 Thread Thomas Heller

Thomas Heller added the comment:

> more reproducible fashion. I've fixed this in ctypes/util.py now:
> r59477.

Cool!  And the 'leak' is gone.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1604] collections.deque.__init__ doesn't initialize

2007-12-12 Thread Raymond Hettinger

Changes by Raymond Hettinger:


--
versions: +Python 2.6 -Python 2.5

__
Tracker <[EMAIL PROTECTED]>

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



[issue1580] Use shorter float repr when possible

2007-12-12 Thread Noam Raphael

Noam Raphael added the comment:

Ok, so if I understand correctly, the ideal thing would be to
implement decimal to binary conversion by ourselves. This would make
str <-> float conversion do the same thing on all platforms, and would
make repr(1.1)=='1.1'. This would also allow us to define exactly how
floats operate, with regard to infinities and NaNs. All this is for
IEEE-754 platforms -- for the rare platforms which don't support it,
the current state remains.

However, I don't think I'm going, in the near future, to add a decimal
to binary implementation -- the Tcl code looks very nice, but it's
quite complicated and I don't want to fiddle with it right now.

If nobody is going to implement the correctly rounding decimal to
binary conversion, then I see three options:
1. Revert to previous situation
2. Keep the binary to shortest decimal routine and use it only when we
know that the system's decimal to binary routine is correctly rounding
(we can check - perhaps Microsoft has changed theirs?)
3. Keep the binary to shortest decimal routine and drop repr(f) == f
(I don't like that option).

If options 2 or 3 are chosen, we can check the 1e5 bug.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1580] Use shorter float repr when possible

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

> Ok, so if I understand correctly, the ideal thing would be to
> implement decimal to binary conversion by ourselves. This would make
> str <-> float conversion do the same thing on all platforms, and would
> make repr(1.1)=='1.1'. This would also allow us to define exactly how
> floats operate, with regard to infinities and NaNs. All this is for
> IEEE-754 platforms -- for the rare platforms which don't support it,
> the current state remains.

Does doubledigits.c not work for non-754 platforms?

> However, I don't think I'm going, in the near future, to add a decimal
> to binary implementation -- the Tcl code looks very nice, but it's
> quite complicated and I don't want to fiddle with it right now.

Fair enough. And the glibc code is better anyway, according to Tim.
(Although probably even more complex.)

> If nobody is going to implement the correctly rounding decimal to
> binary conversion, then I see three options:
> 1. Revert to previous situation

That would be sad since we're so close.

> 2. Keep the binary to shortest decimal routine and use it only when we
> know that the system's decimal to binary routine is correctly rounding
> (we can check - perhaps Microsoft has changed theirs?)

Tim says you can't check (test) for this -- you have to prove it from
source, or trust the vendor's documentation. I would have no idea
where to find this documented.

> 3. Keep the binary to shortest decimal routine and drop repr(f) == f
> (I don't like that option).

It would mean that on platforms with unknown-correct rounding *input*
the *output* would be ugly again. I wouldn't mind so much if this was
only VAX or Cray; but if we had to do this on Windows it'd be a real
shame.

> If options 2 or 3 are chosen, we can check the 1e5 bug.

First you'll have to reproduce it -- I can't afford to spend much
quality time with gdb, especially since I don't understand the source
code at all. Though you may be able to pinpoint a possible candidate
based on the characteristics of the error -- it seems to have to do
with not placing the decimal point correctly when there are trailing
zeros.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1251] ssl module doesn't support non-blocking handshakes

2007-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola':


--
nosy: +giampaolo.rodola

__
Tracker <[EMAIL PROTECTED]>

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



[issue953599] asyncore misses socket closes when poll is used

2007-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola':


--
nosy: +giampaolo.rodola


Tracker <[EMAIL PROTECTED]>


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



[issue1469] SSL tests leak memory

2007-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola':


--
nosy: +giampaolo.rodola

__
Tracker <[EMAIL PROTECTED]>

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



[issue909005] asyncore fixes and improvements

2007-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola':


--
nosy: +giampaolo.rodola


Tracker <[EMAIL PROTECTED]>


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



[issue1605] Semi autogenerated _types module

2007-12-12 Thread Christian Heimes

New submission from Christian Heimes:

A while ago I've experimented with the pyvm module and a semi
auto-generated types list. The patch adds a script that reads
Include/*.h and adds all available PyTypeObjects to Modules/_typesmodule.c.

The patch or script may be useful in the future.

--
components: Interpreter Core
files: py3k_autogen_types.patch
keywords: patch, py3k
messages: 58511
nosy: tiran
priority: low
severity: normal
status: open
title: Semi autogenerated _types module
type: rfe
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file8934/py3k_autogen_types.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Tools/scripts/update_types.py
===
--- Tools/scripts/update_types.py	(Revision 0)
+++ Tools/scripts/update_types.py	(Revision 0)
@@ -0,0 +1,62 @@
+"""Script to update the list of types for _types from Include/*.h
+"""
+
+import os
+import glob
+import sys
+import re
+
+BASE = ''
+RE_PYTYPE = re.compile("PyAPI_DATA\(PyTypeObject\) (Py[A-Za-z_]*)")
+HEADERS = os.path.join(BASE, "Include", "*.h")
+CFILE = os.path.join(BASE, "Modules", "_typesmodule.c")
+TEMPLATE = "\t\t&%s,\n"
+IGNORE = {"PySTEntry_Type"}
+
+def find_pytype(fp):
+types = set() 
+for line in fp:
+match = RE_PYTYPE.match(line)
+if match:
+name = match.group(1)
+if name not in IGNORE:
+types.add(match.group(1))
+return types
+
+def read_headerfiles():
+types = set()
+files = glob.glob(HEADERS)
+for file in files:
+with open(file) as fp:
+types.update(find_pytype(fp))
+return types
+
+def modify():
+start = []
+middle = []
+end = []
+cur = start
+
+with open(CFILE) as fp:
+for line in fp:
+if line.startswith("/*** START"):
+cur.append(line)
+cur = middle
+continue
+if line.startswith("/*** END"):
+cur = end
+cur.append(line)
+
+types = read_headerfiles()
+middle = []
+for t in sorted(types):
+middle.append(TEMPLATE % t)
+
+with open(CFILE, 'w') as fp:
+fp.write(''.join(start))
+fp.write(''.join(middle))
+fp.write(''.join(end))
+
+if __name__ == "__main__":
+modify()
+

Eigenschaftsänderungen: Tools/scripts/update_types.py
___
Name: svn:keywords
   + 'Id Revision'
Name: svn:eol-style
   + native

Index: Lib/types.py
===
--- Lib/types.py	(Revision 59478)
+++ Lib/types.py	(Arbeitskopie)
@@ -43,8 +43,8 @@
 except ImportError:
 pass
 else:
-GetSetDescriptorType = type(_types.Helper.getter)
-MemberDescriptorType = type(_types.Helper.member)
+GetSetDescriptorType = _types.getset_descriptor
+MemberDescriptorType = _types.member_descriptor
 del _types
 
 del sys, _f, _g, _C,  # Not for export
Index: Modules/_typesmodule.c
===
--- Modules/_typesmodule.c	(Revision 59478)
+++ Modules/_typesmodule.c	(Arbeitskopie)
@@ -5,89 +5,97 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "frameobject.h"
 
-typedef struct
-{
-PyObject_HEAD
-int member;
-} Helper;
-
-static PyMemberDef helper_members[] = {
-{ "member", T_INT,  offsetof(Helper, member), READONLY,
-  PyDoc_STR("A member descriptor")
-},
-{ NULL }
-};
-
-static PyObject *
-helper_getter(Helper *self, void *unused) 
-{
-Py_RETURN_NONE;
-}
-
-static PyGetSetDef helper_getset[] = {
-{ "getter", (getter)helper_getter, NULL,
-  PyDoc_STR("A getset descriptor"),
-},
-{ NULL }
-};
-
-static PyTypeObject HelperType = {
-PyVarObject_HEAD_INIT(NULL, 0)
-"_types.Helper",/* tp_name */
-sizeof(Helper), /* tp_basicsize */
-0,		/* tp_itemsize */
-0,		/* tp_dealloc */
-0,		/* tp_print */
-0,		/* tp_getattr */
-0,		/* tp_setattr */
-0,		/* tp_compare */
-0,  /* tp_repr */
-0,  /* tp_as_number */
-0,		/* tp_as_sequence */
-0,		/* tp_as_mapping */
-0,  /* tp_hash */
-0,  /* tp_call */
-0,  /* tp_str */
-0,  /* tp_getattro */
-0,		/* tp_setattro */
-0,		/* tp_as_buffer */
-Py_TPFLAGS_DEFAULT, /* tp_flags */
-0,  	/* tp_doc */
-0,		/* tp_traverse */
-0,		/* tp_clear */
-0,  /* tp_richcompare */
-0,		/* tp_weaklistoffset *

[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)

2007-12-12 Thread Christian Heimes

Christian Heimes added the comment:

We are aware of several Windows related bugs with IDLE. I assume they
are related to our Tcl/Tk build.

--
nosy: +tiran

__
Tracker <[EMAIL PROTECTED]>

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



[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2007-12-12 Thread Josiah Carlson

Josiah Carlson added the comment:

The patches that giampaolo sent you were for 2.x, not 3.x .  Arguably
they should be applied to 2.6 first, tested, etc., then be run through
the 2.6 to 3.0 converter, then adjusted for str/bytes stuff.

One of my concerns with your changes (which are hard to work out because
the diff is so huge, could you attach your actual files?) is that they
seem to change asyncore/asynchat for no other reason than to be different.

The changes that giampaolo sent you (that were from some earlier work
that I did) preserved compatibility while adding better error handling, etc.

But maybe I'm just not reading the diff correctly.

--
nosy: +josiah.carlson

__
Tracker <[EMAIL PROTECTED]>

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



[issue1606] Doc: subprocess wait() may lead to dead lock

2007-12-12 Thread Christian Heimes

New submission from Christian Heimes:

The subprocess docs need a warning that code like

p = subprocess.Popen(..., stdout=STDOUT)
p.wait()
p.stdout.read()

can block indefinitely if the program fills the stdout buffer. It needs
an example how to do it right but I don't know the best way to solve the
problem.

--
components: Documentation
messages: 58514
nosy: tiran
priority: normal
severity: normal
status: open
title: Doc: subprocess wait() may lead to dead lock
versions: Python 2.6, Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1606] Doc: subprocess wait() may lead to dead lock

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

Why not simply reverse the wait() and read() calls?

--
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue1605] Semi autogenerated _types module

2007-12-12 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
> But what about static type objects that nevertheless may be exposed to
> Python (e.g. dict_keyview?).

I took care of the views a few weeks ago when I added all views and
iterators to the header files.

['PyCObject',
 'bool',
 'builtin_function_or_method',
 'bytearray',
 'bytearray_iterator',
 'bytes',
 'bytes_iterator',
 'callable_iterator',
 'cell',
 'classmethod',
 'classmethod_descriptor',
 'cmpwrapper',
 'code',
 'complex',
 'dict',
 'dict_itemiterator',
 'dict_items',
 'dict_keyiterator',
 'dict_keys',
 'dict_proxy',
 'dict_valueiterator',
 'dict_values',
 'enumerate',
 'float',
 'frame',
 'frozenset',
 'function',
 'generator',
 'getset_descriptor',
 'imp.NullImporter',
 'instancemethod',
 'int',
 'iterator',
 'list',
 'list_iterator',
 'list_reverseiterator',
 'longrange_iterator',
 'member_descriptor',
 'memoryview',
 'method',
 'method_descriptor',
 'module',
 'object',
 'property',
 'range',
 'range_iterator',
 'reversed',
 'set',
 'set_iterator',
 'slice',
 'sortwrapper',
 'staticmethod',
 'stderrprinter',
 'str',
 'str_iterator',
 'super',
 'traceback',
 'tuple',
 'tuple_iterator',
 'type',
 'wrapper_descriptor',
 'zip_iterator']

__
Tracker <[EMAIL PROTECTED]>

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



[issue1605] Semi autogenerated _types module

2007-12-12 Thread Guido van Rossum

Guido van Rossum added the comment:

But what about static type objects that nevertheless may be exposed to
Python (e.g. dict_keyview?).

--
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue1606] Doc: subprocess wait() may lead to dead lock

2007-12-12 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
> Why not simply reverse the wait() and read() calls?

I don't think it is sufficient if the user uses more than one pipe. The
subprocess.communicate() and _communicate() methods are using threads
(Windows) or select (Unix) when multiple pipes for stdin, stderr and
stderr are involved.

The only safe way with multiple pipes is communicate([input]) unless the
process returns *lots* of data. The subprocess module is buffering the
data in memory if the user uses PIPE or STDIN.

The subprocess module also contains a XXX comment in the unix version of
_communicate()

   # XXX Rewrite these to use non-blocking I/O on the
   # file objects; they are no longer using C stdio!

Should I create another bug entry for it?

Christian

__
Tracker <[EMAIL PROTECTED]>

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



[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)

2007-12-12 Thread Joseph Armbruster

Joseph Armbruster added the comment:

Tiran, agreed.  You can reproduce this issue quickly outside of IDLE
with this snippet:

from Tkinter import *
import tkMessageBox

class App(Frame):
  def __init__(self, master):
Frame.__init__(self,master)
self.master.title("Wierd Menu")
self.configure(height=200,width=200)
self.grid(padx=15, pady=15,sticky=N+S+E+W)   
self.menu = Menu(self)
self.master.config(menu=self.menu)
self.tkMenu = Menu(self.menu)
self.menu.add_cascade(label="MenuItem", menu=self.tkMenu)
self.tkMenu.add_command(label="Test", command=self.Test)
  def Test(self):
tkMessageBox.showinfo("Test", "Test")
if __name__ == "__main__":
  root = Tk()
  app = App(root)
  root.mainloop()

--
nosy: +JosephArmbruster

__
Tracker <[EMAIL PROTECTED]>

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



[issue1586] IDLE no longer shows colour syntax highlighting in the Shell (Py30a2)

2007-12-12 Thread Kurt B. Kaiser

Kurt B. Kaiser added the comment:

r59479, thanks for the report!

--
assignee:  -> kbk
nosy: +kbk
resolution:  -> fixed
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue1777398] IDLE Freezes After Running Scripts

2007-12-12 Thread Kurt B. Kaiser

Kurt B. Kaiser added the comment:

What happens when you run this using idle -n  (i.e. without the 
subprocess?)

--
nosy: +kbk

_
Tracker <[EMAIL PROTECTED]>

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



[issue1604] collections.deque.__init__ doesn't initialize

2007-12-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Checked in. See rev 59478.

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1607] Patch for TCL 8.5 support

2007-12-12 Thread Christian Heimes

New submission from Christian Heimes:

I've tested Tcl 8.5b3, Tk 8.5b3 and Tix 8.4.2 on Windows. IDLE
complained at multiple places that it could not add a Tcl_Obj to a
string (index + "...") or convert it to a float int(float(index)).
Therefor I added an __add__ and __float__ number slot to the C code. I
also had to add two str() calls.

--
assignee: kbk
components: IDLE
files: py3k_tcltk85.patch
keywords: patch, py3k
messages: 58523
nosy: kbk, tiran
priority: normal
severity: normal
status: open
title: Patch for TCL 8.5 support
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file8935/py3k_tcltk85.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Lib/idlelib/CallTipWindow.py
===
--- Lib/idlelib/CallTipWindow.py	(revision 59479)
+++ Lib/idlelib/CallTipWindow.py	(working copy)
@@ -60,7 +60,7 @@
 
 self.widget.mark_set(MARK_RIGHT, parenright)
 self.parenline, self.parencol = map(
-int, self.widget.index(parenleft).split("."))
+int, str(self.widget.index(parenleft)).split("."))
 
 self.tipwindow = tw = Toplevel(self.widget)
 self.position_window()
Index: Lib/idlelib/EditorWindow.py
===
--- Lib/idlelib/EditorWindow.py	(revision 59479)
+++ Lib/idlelib/EditorWindow.py	(working copy)
@@ -301,7 +301,7 @@
 self.text.after_idle(self.set_line_and_column)
 
 def set_line_and_column(self, event=None):
-line, column = self.text.index(INSERT).split('.')
+line, column = str(self.text.index(INSERT)).split('.')
 self.status_bar.set_label('column', 'Col: %s' % column)
 self.status_bar.set_label('line', 'Ln: %s' % line)
 
Index: Modules/_tkinter.c
===
--- Modules/_tkinter.c	(revision 59479)
+++ Modules/_tkinter.c	(working copy)
@@ -807,7 +807,62 @@
 	return PyUnicode_FromString(obj->value->typePtr->name);
 }
 
+static PyObject *
+PyTclObject_float(PyObject *self)
+{
+	PyObject *str, *result;
+	
+	str = PyTclObject_str((PyTclObject*)self, NULL);
+	if (str == NULL) {
+		return NULL;
+	}
+	result = PyFloat_FromString(str);
+	Py_DECREF(str);
+	return result;
+}
 
+static PyObject *
+PyTclObject_add(PyObject *a, PyObject *b)
+{
+	PyObject *str, *result;
+
+	if (!PyTclObject_Check(a) || !PyUnicode_Check(b)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+	str = PyObject_Str(a);
+	if (str == NULL) {
+		return NULL;
+	}
+	result = PyNumber_Add(str, b);
+	Py_DECREF(str);
+	return result;
+}
+
+static PyNumberMethods PyTclObject_as_number = {
+	(binaryfunc)PyTclObject_add,	/*nb_add*/
+	0,/*nb_subtract*/
+	0,/*nb_multiply*/
+	0,/*nb_remainder*/
+	0,/*nb_divmod*/
+	0,/*nb_power*/
+	0,/*nb_negative*/
+	0,/*tp_positive*/
+	0,/*tp_absolute*/
+	0,/*tp_bool*/
+	0,/*nb_invert*/
+	0,/*nb_lshift*/
+	0,/*nb_rshift*/
+	0,/*nb_and*/
+	0,/*nb_xor*/
+	0,/*nb_or*/
+	0,/*nb_reserved*/
+	0,/*nb_int*/
+	0,/*nb_long*/
+	PyTclObject_float,		/*nb_float*/
+	0,
+};
+
 static PyGetSetDef PyTclObject_getsetlist[] = {
 	{"typename", (getter)get_typename, NULL, get_typename__doc__},
 	{"string", (getter)PyTclObject_string, NULL,
@@ -827,7 +882,7 @@
 	0,			/*tp_setattr*/
 	(cmpfunc)PyTclObject_cmp,	/*tp_compare*/
 	(reprfunc)PyTclObject_repr,	/*tp_repr*/
-	0,			/*tp_as_number*/
+	&PyTclObject_as_number,	/*tp_as_number*/
 	0,			/*tp_as_sequence*/
 	0,			/*tp_as_mapping*/
 	0,			/*tp_hash*/
Index: PCbuild9/_tkinter.vcproj
===
--- PCbuild9/_tkinter.vcproj	(revision 59479)
+++ PCbuild9/_tkinter.vcproj	(working copy)
@@ -56,7 +56,7 @@
 			/>
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			
 			http://svn.python.org
 os.chdir(os.path.join(ROOT, TIX, "win"))
 if clean:
Index: PCbuild9/pyproject.vsprops
===
--- PCbuild9/pyproject.vsprops	(revision 59479)
+++ PCbuild9/pyproject.vsprops	(working copy)
@@ -68,4 +68,12 @@
 		Name="tcltk64Dir"
 		Value="..\..\tcltk64"
 	/>
+	
+	
 
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com