[issue6548] cmath documentation misleading: suggests existence of real() and imag() functions

2009-07-23 Thread Georg Brandl

Georg Brandl  added the comment:

Fixed the trivial stuff in r74184. Leaving open for the suggested rewrite.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue6525] Problem with string.lowercase in Windows XP

2009-07-23 Thread Peter Landgren

Peter Landgren  added the comment:

Obviously, 2.5 and 2.6 decode the "string.lowercase"  when print is used and 
2.6 seems to 
be the correct.

Yes. I get exactly the same result in both
Python 2.5.2 (r252:60911, Jan  8 2009, 12:17:37)
and
Python 2.6.2 (r262:71600, Jul 23 2009, 09:01:02)
showing that string.lowercase does NOT change with locale.

'sv_SE.UTF-8'
>>> a = string.lowercase
>>> len(a)
26
>>> a
'abcdefghijklmnopqrstuvwxyz'
>>> print a
abcdefghijklmnopqrstuvwxyz
>>> string.ascii_lowercase == string.lowercase
True
>>>

--

___
Python tracker 

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



[issue6548] cmath documentation misleading: suggests existence of real() and imag() functions

2009-07-23 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a proposed rewrite, as a patch against the trunk documentation.  
Comments welcome!

--
assignee: marketdickinson -> georg.brandl
keywords: +patch
Added file: http://bugs.python.org/file14551/cmath_rewrite.patch

___
Python tracker 

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



[issue6548] cmath documentation misleading: suggests existence of real() and imag() functions

2009-07-23 Thread Georg Brandl

Georg Brandl  added the comment:

Looks good to me.

--

___
Python tracker 

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



[issue6551] test_codecs fails when ran after test_zipimport and test_mailbox.

2009-07-23 Thread R. David Murray

R. David Murray  added the comment:

When the zipimport test is run, encodings.ascii is imported.  Then it is
removed from sys.modules by the test cleanup.  When the mailbox test is
run, it is reimported.  However, when the codecs test tries to use it,
the encodings.ascii module has been finalized (as if during interpreter
shutdown) by having all its globals set to None.  Thus the test failure.

I haven't figured out why this is happening yet, but it seems likely
that the issue is either with zipimport or with the zipimport test
cleanup.  I'm guessing that anything that triggers encodings.ascii to be
loaded before test_codecs tries to use it will trigger the bug, but I
haven't tested that theory yet.

--
nosy: +r.david.murray
versions: +Python 3.1

___
Python tracker 

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



[issue6106] read_until

2009-07-23 Thread irek

irek  added the comment:

Hi, 
I head same problem on 3.0 and 3.1 versions
This was because of incompatibility of types in comparison 

My solution is to modify 
Lib/telnetlib.py   
line  462
cmd = self.iacseq[1]
 to 
cmd = self.iacseq[1:2]

Irek

--
nosy: +irczan
versions: +Python 3.1

___
Python tracker 

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



[issue6551] test_codecs fails when ran after test_zipimport and test_mailbox.

2009-07-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

A simple solution could be to import encodings.ascii in regrtest.py,
before it saves the list of modules.

Or, since codecs are stored in a global cache dictionary that cannot be
cleared (interp->codec_search_cache), avoid unloading modules from the
encodings package.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue6553] cPickle "binunicode" segmentation fault

2009-07-23 Thread Patrick Strawderman

New submission from Patrick Strawderman :

When reading from a file-like object (like StringIO), cPickle uses the
read_other function, which doesn't check that the number of bytes
requested is the actual number of bytes read (like the read_cStringIO
function does).

Functions like load_binunicode falsely assume that the number of bytes
specified after the BINUNICODE instruction are the actual number of
bytes read.  This can eventually lead to a segmentation fault, as
demonstrated in the following example:

import cPickle, StringIO

cPickle.Unpickler(StringIO.StringIO("X''.")).load()


I have tested and reproduced this on Python 2.4.6 (OS X 32-bit), 2.5.1
(OS X 32-bit), and 2.6.2 (Linux 64-bit).

I have not tested Python 3.x, but I believe this problem may be akin to
the one in issue4298.

--
messages: 90847
nosy: boogenhagn
severity: normal
status: open
title: cPickle "binunicode" segmentation fault
versions: Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue5103] ssl.SSLSocket timeout not working correctly when remote end is hanging

2009-07-23 Thread jan matejek

Changes by jan matejek :


--
nosy: +matejcik

___
Python tracker 

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



[issue6553] cPickle "binunicode" segmentation fault

2009-07-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Attached patch fixes the problem.

--
assignee:  -> amaury.forgeotdarc
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file14552/pickle_badinput.patch

___
Python tracker 

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



[issue6106] read_until

2009-07-23 Thread Pal Subbiah

Pal Subbiah  added the comment:

Thanks Irek. It works so well now after I modified the telnetlib.py as
you suggested. I also added decode('ascii') with read_until.

Pal Subbiah

--

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Patricio Mariano Molina

New submission from Patricio Mariano Molina :

I couldn't find anything like os.pid_exists() in Python 2.5/2.6, neither
in bugs.python.org (this *could* be a dupe)

Do we have something like that?

Right now I'm doing this:

try:
os.kill(int(pid), 0)
return True
except OSError:
return False

I'd love to do the same without catching an exception (they're
expensive!), maybe in C?

Thanks!

--
components: Library (Lib)
messages: 90850
nosy: pmolina
severity: normal
status: open
title: Do we have something like os.pid_exists()?
type: feature request
versions: Python 2.5, Python 2.6

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

This is quite a microoptimization.  Why do you think you need to avoid
the exception here?

--
nosy: +exarkun

___
Python tracker 

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




[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

For what it's worth, here are some timings from my system.  First,
os.kill without raising an exception:

exar...@boson:~$ python -m timeit -s 'import os; pid = os.getpid()' '
os.kill(pid, 0)
'
100 loops, best of 3: 0.413 usec per loop
exar...@boson:~$ 

Next, os.kill without raising an exception, but with exception handling:

exar...@boson:~$ python -m timeit -s 'import os; pid = os.getpid()' '
> try:
> os.kill(pid, 0)
> except OSError, e:
> pass
> '
100 loops, best of 3: 0.42 usec per loop

Finally, os.kill with exception handling and raising an exception:

exar...@boson:~$ python -m timeit -s 'import os; pid = os.getpid()' '
try:
os.kill(pid + 1, 0)
except OSError, e:
pass
'
10 loops, best of 3: 2.58 usec per loop

The slowest case is almost 7x slower than the fastest case.  However,
this is only triggered when os.kill raises an exception (ie, if the pid
does exist, it's still fast).  Plus, this "slow" case still only takes
two and a half microseconds.  That's pretty fast.

--

___
Python tracker 

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2009-07-23 Thread Nir Soffer

Nir Soffer  added the comment:

The patch is tested with release26-maint and trunk.

--
versions: +Python 2.7

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Patricio Mariano Molina

Patricio Mariano Molina  added the comment:

Hey Jean-Paul, thanks for the quick reply!

You're right, but I wasn't thinking too much about optimization: I think
it would be useful to have that simple function, returning True or False.

I use to search for active PIDs *a lot* with Python

Do you think is a "YAGNI" case?

--

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

It might be better to pick a better (but probably platform-specific) API
for such a use-case.  os.kill has a problem with false positives (on
Linux it will tell you a process exists even when it doesn't).  Looking
in /proc/ or using a Windows API to enumerate all existing processes
might be better.  These have the advantage of giving you a bunch of PID
information all at once which you can then check against, rather than
repeatedly making syscalls.

--

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Patricio Mariano Molina

Patricio Mariano Molina  added the comment:

Sounds good. And what do you think about os.pid_exists() using /proc/ or
a Windows API?

--

___
Python tracker 

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



[issue5262] PythonLauncher considered harmfull

2009-07-23 Thread Nir Soffer

Nir Soffer  added the comment:

I also think it should be removed. Opening a file should run it only if it 
is executable.

--
nosy: +nirs

___
Python tracker 

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



[issue5262] PythonLauncher considered harmfull

2009-07-23 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

At the very least PythonLauncher should not be the default for opening 
python files, and should actively warn against being the default 
(basicly reversing the current default).

When PythonLauncher is the default application for .py files double-
clicking a .py file, or opening it from Mail.app will run the script. 
This is not what I'd expect when opening a source file and is risky when 
this happens accidently.

There are several ways for running python scripts by double-clicking on 
them. Two examples:

* Use py2app to create an .app bundle

* Give the script a ".command" suffix and a '#!/usr/bin/python' prefix.

Both result in "files" where it is clear that opening them will result 
in code execution.

--
versions: +Python 3.2 -Python 3.1

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

The os module is mostly for wrappers around native platform APIs.  So at
the very least, I don't think such an API belongs there.  It would fit
in to a general process-related module, perhaps.

--

___
Python tracker 

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



[issue6555] distutils config file should have the same name on both platforms and all scopes

2009-07-23 Thread Zooko O'Whielacronx

New submission from Zooko O'Whielacronx :

Currently we have this:

http://docs.python.org/install/#location-and-names-of-config-files

The distutils config file can have one of four different names depending
on which platform and which location.  This makes it harder for people
to remember the file's name and location, and more complicated for
programs that want to detect it.  Why not give it the same name on both
platforms and all locations?

--
assignee: tarek
components: Distutils
messages: 90860
nosy: tarek, zooko
severity: normal
status: open
title: distutils config file should have the same name on both platforms and 
all scopes

___
Python tracker 

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



[issue6556] "HOME" is not a standard environment variable on Windows

2009-07-23 Thread Zooko O'Whielacronx

New submission from Zooko O'Whielacronx :

The distutils looks in an environment variable named "HOME" on Windows:

http://docs.python.org/install/#location-and-names-of-config-files

Windows does not by default create such a variable, so only if a user
has manually configured one will it work.  The standard variable for
this purpose on Windows appears to be spelled "USERPROFILE":

http://en.wikipedia.org/wiki/Environment_variable

--
assignee: tarek
components: Distutils
messages: 90861
nosy: tarek, zooko
severity: normal
status: open
title: "HOME" is not a standard environment variable on Windows

___
Python tracker 

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



[issue6555] distutils config file should have the same name on both platforms and all scopes

2009-07-23 Thread Zooko O'Whielacronx

Zooko O'Whielacronx  added the comment:

I was spurred to write this ticket today because of a conversation with
J.P. Calderone:

 but, I have no clue where distutils.cfg goes on Windows

--

___
Python tracker 

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



[issue6549] ttk.Style not translating some Tcl options

2009-07-23 Thread Guilherme Polo

Guilherme Polo  added the comment:

Hi Mark,

I don't think I remember very well where those element options are used.
For instance, where can you use the 'embossed' option ? Would it be only
when using style.configure/style.map with '.' as the style name ?

Knowing that would help to know if the proposed change will affect
something else (and if different/new tests should be added).

--
versions: +Python 2.7

___
Python tracker 

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



[issue6557] urllib.urlopen creates bad requests when location header of 301 redirects contain spaces

2009-07-23 Thread Till Maas

New submission from Till Maas :

If urllib.urlopen is pointed to an url that returns a redirection with a
location header that points to a url containing spaces, that are
properly urlencoded, then it creates a bad request with the spaces not
encoded in the url. Here is an example/test case:

In [1]: import urllib

In [2]:
u=urllib.urlopen("http://sourceforge.net/project/showfiles.php?group_id=16847&package_id=13374";)

In [3]: u.url
Out[3]: 'http://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c Super
Stable/download'

In [4]: u.read()
Out[4]: '\r\n400 Bad Request\r\n\r\n400 Bad
Request\r\nnginx/0.7.60\r\n\r\n\r\n'

In [5]:
u=urllib.urlopen("http://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/download";)

In [6]: u.read()[0:100]
Out[6]: '\n\nhttp://www.w3.org/TR/xhtml1/DTD/xh'

In [7]:

--
components: Library (Lib)
messages: 90864
nosy: till
severity: normal
status: open
title: urllib.urlopen creates bad requests when location header of 301 
redirects contain spaces
versions: Python 2.5

___
Python tracker 

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



[issue6553] cPickle "binunicode" segmentation fault

2009-07-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Fixed in r74189 (trunk) and r74190 (2.6)
Thanks for the report!

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

___
Python tracker 

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



[issue6554] Do we have something like os.pid_exists()?

2009-07-23 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> I'd love to do the same without catching an exception (they're
> expensive!)

Why do you say that? I don't believe that exceptions are expensive
(e.g. compared to the system call)

--
nosy: +loewis
title: Do we have something like os.pid_exists()? -> Do we have something like  
os.pid_exists()?

___
Python tracker 

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



[issue1590864] Function-level import in os triggering an threaded import deadlock

2009-07-23 Thread Thomas Wouters

Thomas Wouters  added the comment:

Here's a preliminary fix (also see
http://codereview.appspot.com/96125/show )

--
assignee:  -> twouters
keywords: +patch
nosy: +twouters
Added file: http://bugs.python.org/file14553/import_lock_fork_deadlock.diff

___
Python tracker 

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



[issue6558] #ifdef linux is incorrect; should be #ifdef __linux__ (preferred standard)

2009-07-23 Thread Garrett Cooper

New submission from Garrett Cooper :

The following files are looking for the `linux' constant, when it fact
they should be looking for `__linux__' (from 2.6.2 release's sources):

Modules/_ctypes/libffi/src/mips/ffitarget.h:#ifdef linux
Modules/socketmodule.c:#ifdef linux
Modules/socketmodule.c:#ifdef linux

The correct check is being made for FreeBSD (__FreeBSD__), for instance.

This is a defacto standard set by gcc, as discussed here:
. You can
dump out all of the available constants for any given gcc compiler via:

[garrc...@sjc-lds-102 ~/Python-2.6.2]$ echo "" | gcc -E -dM -c - | grep
linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1

I point this out because one of our compilers, doesn't have this
definition and it's tossing up errors with the linuxaudiodev and oss
modules periodically when cross-compiling, as shown below :(:

/nobackup/shujagan/tmp/contrib/python/Modules/linuxaudiodev.c:31: error:
conflicting types for 'uint32_t'
/nobackup/shujagan/tmp/linkfarm/mips32/usr/include/stdint.h:52: error:
previous declaration of 'uint32_t' was here

/nobackup/shujagan/tmp/contrib/python/Modules/ossaudiodev.c:37: error:
conflicting types for 'uint32_t'
/nobackup/shujagan/tmp/linkfarm/mips32/usr/include/stdint.h:52: error:
previous declaration of 'uint32_t' was here

We've suggested using --without-audio, but this is a standard which
should be adhered to as __linux__ is the constant of choice when looking
for the Linux compiler...

Thanks!
-Garrett

--
assignee: theller
components: Build, Extension Modules, ctypes
messages: 90868
nosy: theller, yaneurabeya
severity: normal
status: open
title: #ifdef linux is incorrect; should be #ifdef __linux__ (preferred 
standard)
type: compile error
versions: Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue5511] zipfile - add __exit__ attribute to make ZipFile object compatible with with_statement

2009-07-23 Thread Brian Curtin

Brian Curtin  added the comment:

Submitted a patch against trunk. Let me know if you need anything else
(doc patch?).

--
keywords: +patch
nosy: +briancurtin
Added file: http://bugs.python.org/file14554/zipfile_issue_5511.patch

___
Python tracker 

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



[issue5511] zipfile - add __exit__ attribute to make ZipFile object compatible with with_statement

2009-07-23 Thread Ezio Melotti

Ezio Melotti  added the comment:

It would be nice if you could provide unit tests.
If you can also provide a patch for the doc, it's even better.

--
keywords: +needs review
nosy: +ezio.melotti
priority:  -> normal
stage: needs patch -> test needed

___
Python tracker 

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