[issue7883] CallTips.py _find_constructor does not work

2011-12-22 Thread Bernt Røskar Brenna

Bernt Røskar Brenna  added the comment:

Attached is Lib/test/test_idlelib.py, containing a unit test for the issue.

--
Added file: http://bugs.python.org/file24075/test_idlelib.py

___
Python tracker 

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



[issue13585] Add contextlib.ContextStack

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> with ContextStack() as stack:
> files = [stack.enter_context(open(fname)) for fname in filenames]

I find this a bit distasteful. Cleaning up resources now needs something called 
a "ContextStack" and an "enter_context" method call. There's a bit too much 
terminology, and it looks like a poor man's equivalent of Go's "defer" 
statement:
http://blog.golang.org/2010/08/defer-panic-and-recover.html

I like unittest's addCleanup mechanism better.

--
nosy: +pitrou

___
Python tracker 

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



[issue13636] Python SSL Stack doesn't have a Secure Default set of ciphers

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

For the record, here are the default ciphers in our Windows OpenSSL build:

Z:\openssl-1.0.0a>out64\openssl.exe ciphers -v
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
ECDHE-RSA-AES256-SHASSLv3 Kx=ECDH Au=RSA  Enc=AES(256)  Mac=SHA1
ECDHE-ECDSA-AES256-SHA  SSLv3 Kx=ECDH Au=ECDSA Enc=AES(256)  Mac=SHA1
DHE-RSA-AES256-SHA  SSLv3 Kx=DH   Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA  SSLv3 Kx=DH   Au=DSS  Enc=AES(256)  Mac=SHA1
DHE-RSA-CAMELLIA256-SHA SSLv3 Kx=DH   Au=RSA  Enc=Camellia(256) Mac=SHA1
DHE-DSS-CAMELLIA256-SHA SSLv3 Kx=DH   Au=DSS  Enc=Camellia(256) Mac=SHA1
ECDH-RSA-AES256-SHA SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(256)  Mac=SHA1
ECDH-ECDSA-AES256-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(256)  Mac=SHA1
AES256-SHA  SSLv3 Kx=RSA  Au=RSA  Enc=AES(256)  Mac=SHA1
CAMELLIA256-SHA SSLv3 Kx=RSA  Au=RSA  Enc=Camellia(256) Mac=SHA1
PSK-AES256-CBC-SHA  SSLv3 Kx=PSK  Au=PSK  Enc=AES(256)  Mac=SHA1
ECDHE-RSA-DES-CBC3-SHA  SSLv3 Kx=ECDH Au=RSA  Enc=3DES(168) Mac=SHA1
ECDHE-ECDSA-DES-CBC3-SHA SSLv3 Kx=ECDH Au=ECDSA Enc=3DES(168) Mac=SHA1
EDH-RSA-DES-CBC3-SHASSLv3 Kx=DH   Au=RSA  Enc=3DES(168) Mac=SHA1
EDH-DSS-DES-CBC3-SHASSLv3 Kx=DH   Au=DSS  Enc=3DES(168) Mac=SHA1
ECDH-RSA-DES-CBC3-SHA   SSLv3 Kx=ECDH/RSA Au=ECDH Enc=3DES(168) Mac=SHA1
ECDH-ECDSA-DES-CBC3-SHA SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=3DES(168) Mac=SHA1
DES-CBC3-SHASSLv3 Kx=RSA  Au=RSA  Enc=3DES(168) Mac=SHA1
PSK-3DES-EDE-CBC-SHASSLv3 Kx=PSK  Au=PSK  Enc=3DES(168) Mac=SHA1
ECDHE-RSA-AES128-SHASSLv3 Kx=ECDH Au=RSA  Enc=AES(128)  Mac=SHA1
ECDHE-ECDSA-AES128-SHA  SSLv3 Kx=ECDH Au=ECDSA Enc=AES(128)  Mac=SHA1
DHE-RSA-AES128-SHA  SSLv3 Kx=DH   Au=RSA  Enc=AES(128)  Mac=SHA1
DHE-DSS-AES128-SHA  SSLv3 Kx=DH   Au=DSS  Enc=AES(128)  Mac=SHA1
DHE-RSA-SEED-SHASSLv3 Kx=DH   Au=RSA  Enc=SEED(128) Mac=SHA1
DHE-DSS-SEED-SHASSLv3 Kx=DH   Au=DSS  Enc=SEED(128) Mac=SHA1
DHE-RSA-CAMELLIA128-SHA SSLv3 Kx=DH   Au=RSA  Enc=Camellia(128) Mac=SHA1
DHE-DSS-CAMELLIA128-SHA SSLv3 Kx=DH   Au=DSS  Enc=Camellia(128) Mac=SHA1
ECDH-RSA-AES128-SHA SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(128)  Mac=SHA1
ECDH-ECDSA-AES128-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(128)  Mac=SHA1
AES128-SHA  SSLv3 Kx=RSA  Au=RSA  Enc=AES(128)  Mac=SHA1
SEED-SHASSLv3 Kx=RSA  Au=RSA  Enc=SEED(128) Mac=SHA1
CAMELLIA128-SHA SSLv3 Kx=RSA  Au=RSA  Enc=Camellia(128) Mac=SHA1
PSK-AES128-CBC-SHA  SSLv3 Kx=PSK  Au=PSK  Enc=AES(128)  Mac=SHA1
ECDHE-RSA-RC4-SHA   SSLv3 Kx=ECDH Au=RSA  Enc=RC4(128)  Mac=SHA1
ECDHE-ECDSA-RC4-SHA SSLv3 Kx=ECDH Au=ECDSA Enc=RC4(128)  Mac=SHA1
ECDH-RSA-RC4-SHASSLv3 Kx=ECDH/RSA Au=ECDH Enc=RC4(128)  Mac=SHA1
ECDH-ECDSA-RC4-SHA  SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=RC4(128)  Mac=SHA1
RC4-SHA SSLv3 Kx=RSA  Au=RSA  Enc=RC4(128)  Mac=SHA1
RC4-MD5 SSLv3 Kx=RSA  Au=RSA  Enc=RC4(128)  Mac=MD5
PSK-RC4-SHA SSLv3 Kx=PSK  Au=PSK  Enc=RC4(128)  Mac=SHA1
EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH   Au=RSA  Enc=DES(56)   Mac=SHA1
EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH   Au=DSS  Enc=DES(56)   Mac=SHA1
DES-CBC-SHA SSLv3 Kx=RSA  Au=RSA  Enc=DES(56)   Mac=SHA1
EXP-EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=RSA  Enc=DES(40)   Mac=SHA1 export
EXP-EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=DSS  Enc=DES(40)   Mac=SHA1 export
EXP-DES-CBC-SHA SSLv3 Kx=RSA(512) Au=RSA  Enc=DES(40)   Mac=SHA1 export
EXP-RC2-CBC-MD5 SSLv3 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export

--

___
Python tracker 

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



[issue13626] Python SSL stack doesn't support DH ciphers

2011-12-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 33dea851f918 by Antoine Pitrou in branch 'default':
Issue #13626: Add support for SSL Diffie-Hellman key exchange, through the
http://hg.python.org/cpython/rev/33dea851f918

--
nosy: +python-dev

___
Python tracker 

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



[issue13626] Python SSL stack doesn't support DH ciphers

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thank you Meador. I've committed an updated patch.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue8604] Adding an atomic FS write API

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I'm not sure about the best module to host this, though: os.path ?

os.path is mostly about path manipulation functions, although it also performs 
directory I/O (e.g. realpath()).

--

___
Python tracker 

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



[issue5689] Support xz compression in tarfile module

2011-12-22 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

This failure seems to crop up often, but not on every run:

  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3941/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3940/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3937/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3929/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3921/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3916/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3914/steps/test/logs/stdio
  
http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/3906/steps/test/logs/stdio

I've been able to reproduce the failure on my own XP machine;
I'll investigate it over the weekend.

--

___
Python tracker 

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



[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-22 Thread akira

Changes by akira <4kir4...@gmail.com>:


--
nosy: +akira

___
Python tracker 

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



[issue13636] Python SSL Stack doesn't have a Secure Default set of ciphers

2011-12-22 Thread naif

naif  added the comment:

Regarding the mainteneance i expect that, if we make a future-proof choice, it 
would take at least 5 years before that someone will need to have other ciphers 
added.

Consider that a new cipher is standardized once every X year, and typically, if 
it get diffused/adopted (and not abbandoned or marginally used), it will happen 
in few other years.

The new ciphers will get into OpenSSL, so the proposed approach to:
- Start from default
- Disable anything that's
  - Unsecure/Weak
  - Not used/widely used

Would still means that, when OpenSSL library will add a new cipher because a 
new RFC will get out, for sure it will not be unsecure/weak. There are chance 
that it will not get used/widely used, in that case in some other year, we'll 
update the default disabled ciphers.

But such approach would provide very "low maintenance" because "not doing 
anything" can only create a situation where "more ciphers" get added by default 
(included in newer OpenSSL / new TLS RFC).

But those new ciphers will not be weak, even if not maintained.

--

___
Python tracker 

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



[issue8604] Adding an atomic FS write API

2011-12-22 Thread Charles-François Natali

Charles-François Natali  added the comment:

> I prefer to write a "best-effort" function

I disagree. People who explicitely use an atomic file API want 
atomicity/persistency, otherwise they wouldn't use it. Exposing a function that 
may, or may not, be atomic is just plain wrong.
IMHO, the right thing to do on OSes that don't provide atomic rename (and I 
doubt there are many of them, see below) is to raise an exception, so that the 
user can fall back to whatever he thinks is best (bail out, rollback, etc).

> and so I consider that shutil is the best place for such function.

As noted by Jean-Paul, shutil stands for "shell utils": that would be a rather 
poor choice: atomicfile fits in shutil as much as tempfile would :-)

> Some OS don't provide atomic rename.

Which one?
See Antoine's message:
http://bugs.python.org/issue8828#msg146274

Apparently, Windows >= XP does have an atomic rename(), and every POSIX 
compliant OS rename(2) should be atomic.

> os.path is mostly about path manipulation functions

I agree.
I wish we had something like:
io.file
io.file.tempfile
io.file.path
io.file.atomicfile

Thoughts?

--

___
Python tracker 

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



[issue5689] Support xz compression in tarfile module

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Perhaps Paul can try to reproduce and diagnose the issue directly on the 
buildbot?

--
nosy: +pmoore

___
Python tracker 

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



[issue13644] Python 3 crashes (segfaults) with this code.

2011-12-22 Thread maniram maniram

maniram maniram  added the comment:

Well, I expect Python 3 to raise RuntimeError about recursion not to segfault.

--

___
Python tracker 

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



[issue13585] Add contextlib.ContextStack

2011-12-22 Thread Nick Coghlan

Nick Coghlan  added the comment:

ContextStack is intended to be a building block that makes it easy to compose 
context managers and other callbacks, not necessarily an API you'd regularly 
use directly. For example, given ContextStack (as currently implemented in 
contextlib2), it's trivial to write your own higher level cleanup API:

@contextmanager
def cleanup(cb=None, *args, **kwds):
with ContextStack() as stack:
if cb is not None:
stack.register(cb, *args, **kwds):
yield stack

If you only have one callback, you could supply it directly as an argument to 
cleanup(), otherwise you could make multiple register() calls on the returned 
stack object.

The idea is to implement the necessary __exit__() logic that makes it feasible 
to compose context managers and other callbacks just once, then let people 
explore the possibilities in terms of the higher level APIs that it makes easy.

--

___
Python tracker 

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



[issue10296] ctypes catches BreakPoint error on windows 32

2011-12-22 Thread Sacha Brants-Menard

Changes by Sacha Brants-Menard :


--
nosy: +Sacha.Brants-Menard

___
Python tracker 

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



[issue9922] subprocess.getstatusoutput can fail with utf8 UnicodeDecodeError

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, getoutput and getstatusoutput are arguably ugly.

However, since they are very high-level functions meant to quickly execute 
commands, returning str makes sense. You can't do anything smart with the 
output anyway, since stdout and stderr are intermingled: any binary data will 
be ruined by accompanying stderr output (e.g. warnings).

If you want to process the output data instead of displaying it to the user, 
use check_call() instead.

We could perhaps use the "surrogateescape" error handler in getoutput and 
getstatusoutput, but that's really putting lipstick on a pig.

--
nosy: +ncoghlan, pitrou

___
Python tracker 

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



[issue13585] Add contextlib.ContextStack

2011-12-22 Thread Nick Coghlan

Nick Coghlan  added the comment:

The comparison to Go's defer statement is interesting, though: 
ContextStack.register basically *is* the same as defer. While a nested with 
statement is a better option in Python, if we ignore that for the moment, you 
*could* write that simply copying example:

with ContextStack() as stack:
src = open(source)
stack.register(src.close)
dest = open(destination, 'w')
stack.register(dest.close)
copy(src, dest)

However, since ContextStack is just an ordinary context manager class, you have 
a lot of flexibility in what you do with it (particularly once I add the 
preserve() API to let you deliberately *skip* the cleanup steps by transferring 
them to a new ContextStack object)

--

___
Python tracker 

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



[issue9922] subprocess.getstatusoutput can fail with utf8 UnicodeDecodeError

2011-12-22 Thread Nick Coghlan

Nick Coghlan  added the comment:

It is indeed unfortunate that these two functions weren't killed off in the 
Py3k transition instead of being migrated from the commands module to 
subprocess (their current implementation runs counter to the entire subprocess 
security design by implicitly invoking the shell).

Probably the most straightforward way to make them better behaved is to move 
them over to being based on subprocess.Popen:

def getstatusoutput(cmd):
try:
data = check_output(cmd, shell=True, universal_newlines=True, 
stderr=STDOUT)
status = 0
except CalledProcessError as ex:
data = ex.output
status = ex.returncode
return status, data

def getoutput(cmd):
return getstatusoutput(cmd)[1]

--

___
Python tracker 

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



[issue13647] Python SSL stack doesn't securely validate certificate (as client)

2011-12-22 Thread naif

New submission from naif :

It has been noticed by the well known security researcher Dan Kaminsky (
http://dankaminsky.com/) that Python SSL binding doesn't securely validate a 
digital certificate while used.

There is a new 
"match_hostname"http://pypi.python.org/pypi/backports.ssl_match_hostname/ that 
doesn't implement all the required, standard SSL/TLS Client security checks 
that should be done.

Dan suggestion to properly implement implement default SSL/TLS Client security 
check is as follow:

===
Encryption without authentication offers little value; it is the canonical 
"secure in the absence of an attacker" state.  
Python's SSL/TLS code presently does not authenticate the connection by 
default.  

There are of course reasons for this:

1) Collecting and maintaining the appropriate SSL/TLS roots is difficult, 
assuming people are even connecting to globally trusted resources
2) Changing authentication policy silently threatens to break production apps

These are real problems that can't just be waved away.  
In the long run, a more scalable trust distribution system needs to be 
supported (DNSSEC, most likely) but the present state of affairs remain ugly.  

This is what I would recommend:

A) Integrate the Mozilla CA pack into Python, updating it with each security 
release.

B) Make certificate validation tristate.  B
y default, it merely emits to stderr an error similar to what happens if 
deprecated content is included.  
This is vaguely heretical but whatever.  
Then add a couple of API calls:
   a) ValidateCerts, a single call that enables the Mozilla CA pack
   b) AddCert, a single call that declares a particular cert as trusted
   c) AddRoot, a single call that declares a particular root as trusted
   d) DisableValidation, a single call that removes the error
C) Integrate a hooking mechanism to add or replace the certificate validation 
process.  
Please send this API the name of the host you're attempting to validate, and be 
sure to allow it to return "I don't know, try your normal validation procedure".

Be sure you include all the necessary checks, including:
A) Expiration
B) SAN/CN
C) Basic Constraints checking
D) Name Constraints

Possibly a future version of Python should _actually_ deprecate non-validating 
SSL/TLS, but certainly not a security patch.
Too high a risk of breakage.
===

It would be valuable to provide the default SSL/TLS Client verification exactly 
like Mozilla/Chrome/Curl/Wget does.

--
components: Library (Lib)
messages: 150094
nosy: naif
priority: normal
severity: normal
status: open
title: Python SSL stack doesn't securely validate certificate (as client)
type: security
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue13644] Python 3 crashes (segfaults) with this code.

2011-12-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

There is no place for it to raise a RuntimeError which will continue to 
propogate!

--

___
Python tracker 

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



[issue13648] xml.sax.saxutils.escape does not escapes \x00

2011-12-22 Thread Alexey

New submission from Alexey :

function xml.sax.saxutils.escape('\x00qweqwe<') returns '\x00qweqwe<'

\x00 did not escaped to �

is this is a correct behavior?

this is influences tools like xmpppy, which sends \x00 not encoded and leads to 
xmpp error.

--
messages: 150096
nosy: Animus
priority: normal
severity: normal
status: open
title: xml.sax.saxutils.escape does not escapes \x00
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue13648] xml.sax.saxutils.escape does not escapes \x00

2011-12-22 Thread Alexey

Changes by Alexey :


--
components: +XML

___
Python tracker 

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



[issue13648] xml.sax.saxutils.escape does not escapes \x00

2011-12-22 Thread Alexey

Alexey  added the comment:

sorry, xmpppy uses it's own escape method, but anyway... :)

--

___
Python tracker 

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



[issue13649] termios.ICANON is not documented

2011-12-22 Thread anatoly techtonik

New submission from anatoly techtonik :

http://docs.python.org/library/termios.html is missing documentation for ICANON 
flag used to put terminal to "raw" mode.

It is also worth to place `termios` raw/canonical mode equivalent on `tty` 
pages, so that people porting C code to Python could understand the hidden 
magic.

--
assignee: docs@python
components: Documentation, IO, Library (Lib)
messages: 150098
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: termios.ICANON is not documented
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



[issue13443] wrong links and examples in the functional HOWTO

2011-12-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c6880edaf6f3 by Senthil Kumaran in branch '2.7':
Issue13443 - Remove the functional module examples from 2.7 (as module is
http://hg.python.org/cpython/rev/c6880edaf6f3

--
nosy: +python-dev

___
Python tracker 

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



[issue13443] wrong links and examples in the functional HOWTO

2011-12-22 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed this in 2.7.

--
nosy: +orsenthil
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



[issue13644] Python 3 crashes (segfaults) with this code.

2011-12-22 Thread Roger Serwy

Roger Serwy  added the comment:

With Python 2, I can inspect the error to see where it occurred using 
traceback. With Python 3, I'd need to use gdb.

--
nosy: +serwy

___
Python tracker 

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



[issue13650] urllib HTTPRedirectHandler does not implement documented behavior

2011-12-22 Thread tom kel

New submission from tom kel :

Python 3.2.2, 
Here is a blokck of code from the HTTPRedirectHandler:

m = req.get_method()
if (not (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
or code in (301, 302, 303) and m == "POST")):
raise HTTPError(req.full_url, code, msg, headers, fp)

# Strictly (according to RFC 2616), 301 or 302 in response to
# a POST MUST NOT cause a redirection without confirmation
# from the user (of urllib.request, in this case).  In practice,
# essentially all clients do redirect in this case, so we do
# the same.

As you can see, the documentation and the implementation are contradictory.

--
components: Library (Lib)
messages: 150102
nosy: tom.kel
priority: normal
severity: normal
status: open
title: urllib HTTPRedirectHandler does not implement documented behavior
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue13650] urllib HTTPRedirectHandler does not implement documented behavior

2011-12-22 Thread tom kel

Changes by tom kel :


--
status: open -> closed

___
Python tracker 

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



[issue13651] Improve redirection in urllib

2011-12-22 Thread tom kel

New submission from tom kel :

refer to patch for improvements

--
components: Library (Lib)
files: http-redirect-3.2.diff
keywords: patch
messages: 150103
nosy: tom.kel
priority: normal
severity: normal
status: open
title: Improve redirection in urllib
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file24076/http-redirect-3.2.diff

___
Python tracker 

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



[issue13651] Improve redirection in urllib

2011-12-22 Thread Brian Curtin

Brian Curtin  added the comment:

Can you explain the patch and state why you would like that change included?

This would require a test.

--
nosy: +brian.curtin

___
Python tracker 

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



[issue13651] Improve redirection in urllib

2011-12-22 Thread tom kel

tom kel  added the comment:

I created this patch to further the functionality of redirection using the 
"location" header in the HTTPRedirectHandler class under urllib/request.py

Currently, the method http_error_302, which will handle code 302 redirection 
will parse the location header and build a Request accordingly. I encountered a 
website that only returned "index.php" as the Location header. When 
http_error_302 called on urlparse, it returned the following tuple: 
ParseResult(scheme='', netloc='', path='index.php', params='', query='', 
fragment='')

Then, http_error_302 will check if the scheme is equal to either http, https, 
or ftp. This is the part I changed in the patch. If it does not pass, an 
exception is thrown.

Afterwards, http_error_302 builds the target url. As long as the url passes the 
scheme check, the program will succeed.

--

___
Python tracker 

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



[issue5492] Error on leaving IDLE with quit() or exit() under Linux

2011-12-22 Thread Roger Serwy

Roger Serwy  added the comment:

The attached patch fixes the problem. The close method does not need to wait 
for poll_subprocess rescheduling to stop. The subprocess will be killed, which 
would cause the socket to timeout. With closing=True, poll_subprocess will 
return and not reschedule.

--
keywords: +patch
Added file: http://bugs.python.org/file24077/issue5492.patch

___
Python tracker 

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



[issue13652] Creating lambda functions in a loop has unexpected results when resolving variables used as arguments

2011-12-22 Thread WIl Hall

New submission from WIl Hall :

When creating lambda functions in a loop, variables involved in the lambda 
statements appear to not resolve until the loop finishes. This results in all 
of the defined lambda functions using the same variable to resolve to the last 
value of that variable.

For example, in my test program attached, I loop through a list of words: 
["one", "two", "three", "four"] and create a function for each word, I.e: 
lambda: print_word(word). This results in every function having the word "four" 
as their argument. This doesn't seem like intended behavior.

Im my example program attached, I demonstrate both the intended and not 
intended behavior - creating the lambda functions in another function, versus 
creating them in a loop.

--
components: Interpreter Core
files: lambda_tests.py
messages: 150107
nosy: wilhall
priority: normal
severity: normal
status: open
title: Creating lambda functions in a loop has unexpected results when 
resolving variables used as arguments
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file24078/lambda_tests.py

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Matthew Barnett

Matthew Barnett  added the comment:

I'm just adding this to the regex module and I've come up against a possible 
issue. The regex module supports named lists, which could be very big. Should 
the entire contents of those lists also be shown in the repr?They would have to 
be if the repr is to be a eval-able.

--

___
Python tracker 

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



[issue13652] Creating lambda functions in a loop has unexpected results when resolving variables used as arguments

2011-12-22 Thread Matthew Barnett

Matthew Barnett  added the comment:

That's not a bug.

This might help to explain what's going on:

What do (lambda) function closures capture in Python?
http://stackoverflow.com/questions/2295290/what-do-lambda-function-closures-capture-in-python

--
nosy: +mrabarnett

___
Python tracker 

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



[issue13652] Creating lambda functions in a loop has unexpected results when resolving variables used as arguments

2011-12-22 Thread Benjamin Peterson

Changes by Benjamin Peterson :


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

___
Python tracker 

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



[issue13652] Creating lambda functions in a loop has unexpected results when resolving variables used as arguments

2011-12-22 Thread WIl Hall

WIl Hall  added the comment:

Makes sense. Misunderstanding on my part, then. Closing as invalid (not a bug).

--

___
Python tracker 

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



[issue5689] Support xz compression in tarfile module

2011-12-22 Thread Paul Moore

Paul Moore  added the comment:

A simple rebuild and test run of that test in debug mode didn't fail...

I'll run the full test suite as a check, but that could take some time - that 
buildslave isn't the fastest in the world...

--

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I'm just adding this to the regex module and I've come up against a
> possible issue. The regex module supports named lists, which could be
> very big. Should the entire contents of those lists also be shown in
> the repr?They would have to be if the repr is to be a eval-able.

I don't see how eval()able repr is a big deal. Most reprs aren't, and I
think a readable and informative representation is the real goal.

--

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

"I don't see how eval()able repr is a big deal. Most reprs aren't, ..."

Sometimes, I wonder if we're even talking about the same programming language.  
Historically, a good deal of effort has gone into creating evalable reprs, if 
only because they accurately describe an object and because they teach users 
how to create similar objects.  

But it only takes one committer who doesn't care about evalable reprs to 
permanently break the pattern for everyone :-(

--

___
Python tracker 

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



[issue13619] Add a new codec: "locale", the current locale encoding

2011-12-22 Thread STINNER Victor

STINNER Victor  added the comment:

+ encoding = locale.getpreferredencoding()

It should be locale.getpreferredencoding(False).

--

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Alex Gaynor

Alex Gaynor  added the comment:

Raymond, Antoine: I don't see your claims as contradictory, it's definitely 
true that the Python standardlib has historically tried to keep reprs as being 
eval-able, I think Antoine's correct that the vast majority of 3rd-party code 
does not keep with that trend.

--
nosy: +alex

___
Python tracker 

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



[issue13078] IDLE: Python Crashes When Saving Or Opening

2011-12-22 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Python Crashes When Saving Or Opening -> IDLE: Python Crashes When 
Saving Or Opening

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> But it only takes one committer who doesn't care about evalable reprs
> to permanently break the pattern for everyone :-(

So 95% of our datatypes were committed by a single person? :)

--

___
Python tracker 

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



[issue13555] cPickle MemoryError when loading large file (while pickle works)

2011-12-22 Thread Charles-François Natali

Charles-François Natali  added the comment:

Here's a new version with a test (untested).
Note that I'm absolutely not sure that the 'memsize' argument to
bigmemtest is correct.

--
Added file: http://bugs.python.org/file24079/pickle_overflow-2.diff

___
Python tracker 

___diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -6,7 +6,8 @@
 import pickletools
 import copy_reg
 
-from test.test_support import TestFailed, have_unicode, TESTFN
+from test.test_support import (TestFailed, have_unicode, TESTFN, _2G,
+   precisionbigmemtest)
 
 # Tests that try a number of pickle protocols should have a
 # for proto in protocols:
@@ -14,6 +15,8 @@
 assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2
 protocols = range(pickle.HIGHEST_PROTOCOL + 1)
 
+ascii_char_size = 1
+
 # Copy of test.test_support.run_with_locale. This is needed to support Python
 # 2.4, which didn't include it. This is all to support test_xpickle, which
 # bounces pickled objects through older Python versions to test backwards
@@ -1280,3 +1283,21 @@
 f.write(pickled2)
 f.seek(0)
 self.assertEqual(unpickler.load(), data2)
+
+class BigmemPickleTests(unittest.TestCase):
+
+# All protocols use 1-byte per printable ASCII character; we add another
+# byte because the encoded form has to be copied into the internal buffer.
+
+@precisionbigmemtest(size=_2G, memuse=3 + ascii_char_size)
+def test_huge_str_32b(self, size):
+data = "abcd" * (size // 4)
+try:
+for proto in protocols:
+try:
+pickled = self.dumps(data, proto)
+self.loads(pickled)
+finally:
+pickled = None
+finally:
+data = None
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py
--- a/Lib/test/test_cpickle.py
+++ b/Lib/test/test_cpickle.py
@@ -1,7 +1,9 @@
 import cPickle, unittest
 from cStringIO import StringIO
-from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests
-from test.pickletester import AbstractPicklerUnpicklerObjectTests
+from test.pickletester import (AbstractPickleTests,
+   AbstractPickleModuleTests,
+   AbstractPicklerUnpicklerObjectTests,
+   BigmemPickleTests)
 from test import test_support
 
 class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
@@ -101,6 +103,16 @@
 pickler_class = cPickle.Pickler
 unpickler_class = cPickle.Unpickler
 
+class cPickleBigmemPickleTests(BigmemPickleTests):
+
+def dumps(self, arg, proto=0, fast=0):
+# Ignore fast
+return cPickle.dumps(arg, proto)
+
+def loads(self, buf):
+# Ignore fast
+return cPickle.loads(buf)
+
 
 class Node(object):
 pass
@@ -133,6 +145,7 @@
 cPickleFastPicklerTests,
 cPickleDeepRecursive,
 cPicklePicklerUnpicklerObjectTests,
+cPickleBigmemPickleTests,
 )
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -3,10 +3,11 @@
 
 from test import test_support
 
-from test.pickletester import AbstractPickleTests
-from test.pickletester import AbstractPickleModuleTests
-from test.pickletester import AbstractPersistentPicklerTests
-from test.pickletester import AbstractPicklerUnpicklerObjectTests
+from test.pickletester import (AbstractPickleTests,
+   AbstractPickleModuleTests,
+   AbstractPersistentPicklerTests,
+   AbstractPicklerUnpicklerObjectTests,
+   BigmemPickleTests)
 
 class PickleTests(AbstractPickleTests, AbstractPickleModuleTests):
 
@@ -66,6 +67,16 @@
 pickler_class = pickle.Pickler
 unpickler_class = pickle.Unpickler
 
+class PickleBigmemPickleTests(BigmemPickleTests):
+
+def dumps(self, arg, proto=0, fast=0):
+# Ignore fast
+return pickle.dumps(arg, proto)
+
+def loads(self, buf):
+# Ignore fast
+return pickle.loads(buf)
+
 
 def test_main():
 test_support.run_unittest(
@@ -73,6 +84,7 @@
 PicklerTests,
 PersPicklerTests,
 PicklerUnpicklerObjectTests,
+PickleBigmemPickleTests,
 )
 test_support.run_doctest(pickle)
 
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -139,15 +139,15 @@
 
 typedef struct {
 PyObject_HEAD
-int length; /* number of initial slots in data currently used */
-int size;   /* number of slots in data allocated */
+Py_ssize_t length;  /* number of initial slots in data currently used */

[issue13647] Python SSL stack doesn't securely validate certificate (as client)

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> There is a new "match_hostname" that doesn't implement all the 
> required, standard SSL/TLS Client security checks that should be done.

Indeed, as the name indicates, it just checks the hostname.
Please detail what the other security checks are (bonus points if you provide a 
patch + tests).

> It has been noticed by the well known security researcher Dan Kaminsky

What's the URL for this?

> A) Integrate the Mozilla CA pack into Python, updating it with each
> security release.

I suggest you discuss this on python-dev:
http://mail.python.org/mailman/listinfo/python-dev

--
nosy: +pitrou

___
Python tracker 

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



[issue5689] Support xz compression in tarfile module

2011-12-22 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Not to worry - as I said in my previous message, I can reproduce the error
on my own XP machine.

I also noticed that running test_tarfile alone doesn't trigger the errors,
which leads me to suspect that the failure is due to some interaction with
another test getting run before test_tarfile. I'm currently trying to
determine what this test is.

I suspect that the problem is at least partially caused by the fact that
tarfile uses a default compresslevel of 9 for .tar.xz archives (rather
than the recommended value of 6). According to the man page for the xz
tool , using a
compresslevel of 9 can result in memory usage of up to 800MB during
compression, which is a significant fraction of the bot's 2GB of RAM.
(I suppose it would be a good idea to mention this in the documentation
for the lzma module, so users won't get bitten by this...)

--

___
Python tracker 

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



[issue13565] test_multiprocessing.test_notify_all() hangs on "AMD64 Snow Leopard 02 03.x"

2011-12-22 Thread Charles-François Natali

Charles-François Natali  added the comment:

Victor, could you try the attached script on FreeBSD, to see if you get 
ECONNREFUSED?

--

___
Python tracker 

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



[issue13052] IDLE: replace ending with '\' causes crash

2011-12-22 Thread Roger Serwy

Roger Serwy  added the comment:

issue13052.patch against 3.3a0 fixes the replace dialog. It also stops "Replace 
All" from closing the dialog. (What other application actually does this?)

When 'Regular Expression' is not checked, the find and the replace dialogs 
treat the fields as raw strings. This is consistent with Terry's description of 
"Normal".

When checked, the find field is treated as a RE and the replace field has 
"expand" applied.

I think this behavior is a good compromise as it allows for the basic effect of 
"Extended" when 'Regular Expression' is checked.

Also, I can not reproduce the beeping issue as being exclusive to '\'. I know 
it's caused by "text.bell()", but the bell occurs at appropriate times based on 
where it's located in the code (i.e. no more search results, find-again returns 
previous match, etc).

--
Added file: http://bugs.python.org/file24080/issue13052.patch

___
Python tracker 

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



[issue13619] Add a new codec: "locale", the current locale encoding

2011-12-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I'm not sure I like this idea. I think it would be nice to see it discussed on 
python-dev.

--
nosy: +pitrou

___
Python tracker 

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



[issue9039] IDLE and module Doc

2011-12-22 Thread Roger Serwy

Roger Serwy  added the comment:

Is this still an issue?

--
nosy: +serwy
type: crash -> behavior

___
Python tracker 

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



[issue13653] reorder set.intersection parameters for better performance

2011-12-22 Thread Andrew Dalke

New submission from Andrew Dalke :

In Issue3069, Arnaud Delobelle proposed support for multiple values to 
set.intersection() and set.union(), writing "Intersection is optimized by 
sorting all sets/frozensets/dicts in increasing order of size and only 
iterating over elements in the smallest."

Raymond Hettinger commented therein that he had just added support for multiple 
parameters. However, he did not pick up the proposed change in the attached 
patch which attempts to improve the intersection performance.

Consider the attached benchmark, which constructs an inverted index mapping a 
letter to the set of words which contain that letter. (Rather, to word index.) 
Here's the output:

## Example output:
# a has 144900 words
# j has 3035 words
# m has 62626 words
# amj takes 5.902/1000 (verify: 289)
# ajm takes 0.292/1000 (verify: 289)
# jma takes 0.132/1000 (verify: 289)


Searching set.intersection(inverted_index["j"], inverted_index["m"], 
inverted_index["a"]) is fully 44 times faster than searching "a", "m", "j"!

Of course, the set.intersection() supports any iterable, so would only be an 
optimization for when all of the inputs are set types.

BTW, my own experiments suggest that sorting isn't critical. It's more 
important to find the most anti-correlated set to the smallest set, and the 
following does that dynamically by preferentially choosing sets which are 
likely to not match elements of the smallest set:

def set_intersection(*input_sets):
N = len(input_sets)
min_index = min(range(len(input_sets)), key=lambda x: len(input_sets[x]))
best_mismatch = (min_index+1)%N

new_set = set()
for element in input_sets[min_index]:
# This failed to match last time; perhaps it's a mismatch this time?
if element not in input_sets[best_mismatch]:
continue

# Scan through the other sets
for i in range(best_mismatch+1, best_mismatch+N):
j = i % N
if j == min_index:
continue
# If the element isn't in the set then perhaps this
# set is a better rejection test for the next input element
if element not in input_sets[j]:
best_mismatch = j
break
else:
# The element is in all of the other sets
new_set.add(element)
return new_set


Using this in the benchmark gives

amj takes 0.972/1000 (verify: 289)
ajm takes 0.972/1000 (verify: 289)
jma takes 0.892/1000 (verify: 289)

which clearly shows that this Python algorithm is still 6 times faster (for the 
worst case) than the CPython code.

However, the simple sort solution:


def set_intersection_sorted(*input_sets):
input_sets = sorted(input_sets, key=len)
new_set = set()
for element in input_sets[0]:
if element in input_sets[1]:
if element in input_sets[2]:
new_set.add(element)
return new_set

gives times of 

amj takes 0.492/1000 (verify: 289)
ajm takes 0.492/1000 (verify: 289)
jma takes 0.422/1000 (verify: 289)

no doubt because there's much less Python overhead than my experimental 
algorithm.

--
components: Interpreter Core
files: set_intersection_benchmark.py
messages: 150124
nosy: dalke
priority: normal
severity: normal
status: open
title: reorder set.intersection parameters for better performance
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file24081/set_intersection_benchmark.py

___
Python tracker 

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



[issue13653] reorder set.intersection parameters for better performance

2011-12-22 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue13654] IDLE: Freezes and/or crash on SyntaxWarning... is used prior to global declaration

2011-12-22 Thread Marco Scataglini

New submission from Marco Scataglini :

Writing the following code in the IDLE module/scriptneditor and then running it 
(F5) will momentarily freeze without giving the expected warning message 
("SyntaxWarning: name 'GLOBAL1' is used prior to global declaration") and it 
will crash all IDLE windows instances if ran multiple times after it.

--
start code snippet:
--
GLOBAL1=10

def test_chnge_val_1(a=1):
##global GLOBAL1
b=GLOBAL1
print GLOBAL1, b
global GLOBAL1
GLOBAL1 += a
b= 100
print GLOBAL1, b
 

if __name__ == '__main__':
test_chnge_val_1()

end code snippet:


The desired behavior is to not crash but run the code with output and shoot the 
expected message to STOUT/shell console like regular python shell would.


-
Notes:
-
issue_global_crash.py code-file attached.

--
components: IDLE
files: issue_global_crash.py
messages: 150125
nosy: marco
priority: normal
severity: normal
status: open
title: IDLE: Freezes and/or crash on SyntaxWarning... is used prior to global 
declaration
versions: Python 2.7
Added file: http://bugs.python.org/file24082/issue_global_crash.py

___
Python tracker 

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-12-22 Thread Michael P. Reilly

Michael P. Reilly  added the comment:

I'm seeing that shutdown does have a race condition just using 
BaseHTTPServer.HTTPServer.  See the attached simple script.  Then access 
http://localhost:8081.  This is using both Python 2.6.6 (r266:84292, May 22 
2011, 16:47:42) on Oracle Linux Server 6.1 and Python 2.7.2+ (default, Oct 4, 
2011, 20:03:08) on Ubuntu 11.10.  I have applied the socketserver.patch dated 
2011-07-25 18:43, with the same result.

The problem is that shutdown() waits for the event, which is never triggered 
since there is no thread to set the event.  I'll see if I can come up with a 
patch myself later this weekend.  I suspect the same might happen with 
ForkingMixIn.

--
nosy: +Arcege
versions: +Python 2.6 -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file24083/simple.py

___
Python tracker 

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



[issue9039] IDLE and module Doc

2011-12-22 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> works for me
status: open -> closed

___
Python tracker 

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



[issue8313] message in unittest tracebacks

2011-12-22 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

http://pypi.python.org/pypi/unittest2 says 

"There are several places in unittest2 (and unittest) that call str(...) on 
exceptions to get the exception message. This can fail if the exception was 
created with non-ascii unicode. This is rare and I won't address it unless it 
is actually reported as a problem for someone."

It is a problem for us now that we've re-rooted all our TestCases on top of 
unittest2 at work. :)

The solution I'm leaning towards is monkey-patching the new traceback._some_str 
implementation in at unittest2 import time.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue8313] message in unittest tracebacks

2011-12-22 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

We're on python 2.6, otherwise this would be a moot point.  but you might want 
to include something like that in a new unittest2 backport release.

--

___
Python tracker 

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



[issue12798] Update mimetypes documentation

2011-12-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset aef79ff1bc9b by Senthil Kumaran in branch '3.2':
Issue12798 - Update mimetypes documentation. Correct the doc section where
http://hg.python.org/cpython/rev/aef79ff1bc9b

New changeset 4b306aee21a4 by Senthil Kumaran in branch 'default':
Merge changes from 3.2
http://hg.python.org/cpython/rev/4b306aee21a4

--
nosy: +python-dev

___
Python tracker 

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



[issue12798] Update mimetypes documentation

2011-12-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset cfa3fe9d7b1f by Senthil Kumaran in branch '2.7':
porting mimetype doc changes from 3.2.
http://hg.python.org/cpython/rev/cfa3fe9d7b1f

--

___
Python tracker 

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



[issue12798] Update mimetypes documentation

2011-12-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9c19df6c8ea0 by Senthil Kumaran in branch '3.2':
News entry for Issue12798
http://hg.python.org/cpython/rev/9c19df6c8ea0

--

___
Python tracker 

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



[issue13654] IDLE: Freezes and/or crash on SyntaxWarning... is used prior to global declaration

2011-12-22 Thread Roger Serwy

Roger Serwy  added the comment:

I ran IDLE with a console and then ran your script against the latest release. 
The error message is due to a bug in idle_showwarning. 

Your script works with the development version, however. This is a duplicate of 
issue12438 which was fixed in e9c406a53972, but not yet released.

--
nosy: +serwy

___
Python tracker 

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



[issue12798] Update mimetypes documentation

2011-12-22 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Updated the doc with Sandro Tosi's suggested changes in all the codelines.

--
nosy: +orsenthil
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



[issue13654] IDLE: Freezes and/or crash on SyntaxWarning... is used prior to global declaration

2011-12-22 Thread Ned Deily

Ned Deily  added the comment:

The fix has been released in Python 3.2.2.  It will be in Python 2.7.3 when 
released.

--
nosy: +ned.deily
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> IDLE problem displaying warning message

___
Python tracker 

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



[issue13653] reorder set.intersection parameters for better performance

2011-12-22 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks guys.  I'll look at this in detail when I get a chance.  Offhand, it 
seems like a good idea though it may rarely be of benefit.  The only downsides 
I see are that it overrides the user's ability to specify the application order 
and that it would be at odds with proposals to implement ordered sets 
(including a guaranteed order of application in intersection, union, 
difference, etc).

--
priority: normal -> low

___
Python tracker 

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