[issue16088] http.server's send_error could set the content-length of the error body

2012-10-10 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I took the privilege of testing, adding news and docs and committing it.

Thank you!

--
resolution:  -> fixed
stage:  -> 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



[issue16088] http.server's send_error could set the content-length of the error body

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ee34cb049a10 by Senthil Kumaran in branch 'default':
Issue #16088: BaseHTTPRequestHandler's send_error method includes a
http://hg.python.org/cpython/rev/ee34cb049a10

--
nosy: +python-dev

___
Python tracker 

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



[issue16193] display full e-mail name in hg.python.org annotate pages

2012-10-10 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to configure hg.python.org to display the full e-mail name on the 
"annotate" pages.  Currently, instead of displaying everything before the "@" 
symbol, the pages display only the portion of e-mail addresses up to the first 
"." or "@", for example "tim@19837".

Information on how to configure hgweb this way is here:

http://bz.selenic.com/show_bug.cgi?id=2276

--
messages: 172621
nosy: chris.jerdonek, ezio.melotti, georg.brandl, pitrou
priority: normal
severity: normal
status: open
title: display full e-mail name in hg.python.org annotate pages
type: enhancement

___
Python tracker 

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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Christian Heimes

Christian Heimes added the comment:

I'm closing the issue as suggested.

I created #16190 in the hope that a documentation update is going to raise 
awareness.

--
resolution:  -> rejected
stage:  -> 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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Yury

Yury added the comment:

Thank you, you are right. Please close the issue.

--

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I looked at
http://docs.python.org/py3k/library/doctest.html#directives
and the examples with directives looked fine to me, with directive, syntax 
markup, and 'hide prompt' box. I also checked the next section and saw the one 
example that needed to have the directive visible. Really nice.

--
stage: commit review -> committed/rejected
status: pending -> closed

___
Python tracker 

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



[issue16160] subclassing types.SimpleNamespace does not work

2012-10-10 Thread Eric Snow

Eric Snow added the comment:

Here's an updated patch that addresses Éric's review comments.

--
Added file: http://bugs.python.org/file27524/issue16160.diff

___
Python tracker 

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



[issue16160] subclassing types.SimpleNamespace does not work

2012-10-10 Thread Eric Snow

Changes by Eric Snow :


Removed file: http://bugs.python.org/file27512/issue16160.diff

___
Python tracker 

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



[issue16192] ctypes - documentation example

2012-10-10 Thread Brian Thorne

New submission from Brian Thorne:

The Python docs for ctypes have embedded examples including:

>>> c_int()
c_long(0)

But on my machine I get the (more expected?):

>>> c_int()
c_int(0)

Perhaps if some machines expect otherwise that should be documented, otherwise 
might we change them.

--
components: ctypes
files: ctypes_doc.diff
keywords: patch
messages: 172616
nosy: Thorney, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: ctypes - documentation example
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file27523/ctypes_doc.diff

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

This seems to look good now.  Can this be closed, or is there something else 
that needed to be done as well?

--
resolution:  -> fixed
stage: needs patch -> commit review
status: open -> pending

___
Python tracker 

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



[issue16187] incoming.irker hook raised an exception: [Errno 111] Connection refused

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

It's working now, thanks.

--
status: pending -> closed

___
Python tracker 

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



[issue16076] xml.etree.ElementTree.Element is no longer pickleable

2012-10-10 Thread Santoso Wijaya

Santoso Wijaya added the comment:

This is because, in Python 3.3, xml.etree.ElementTree.Element is overridden by 
the C accelerator version, _elementtree.Element.

If you remove the statement, 

1708from _elementtree import *

the behavior from Python 3.2 comes back.

--
nosy: +santa4nt

___
Python tracker 

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



[issue16088] http.server's send_error could set the content-length of the error body

2012-10-10 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Looks good.

--
nosy: +jcea

___
Python tracker 

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



[issue16115] test the executable arg to Popen() and improve related docs

2012-10-10 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
resolution:  -> fixed
stage:  -> 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



[issue16115] test the executable arg to Popen() and improve related docs

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 41ffed580eef by Chris Jerdonek in branch '3.2':
Issue #16115: Make further improvements to subprocess.Popen() documentation.
http://hg.python.org/cpython/rev/41ffed580eef

New changeset bae644e46556 by Chris Jerdonek in branch '3.3':
Issue #16115: Merge subprocess.Popen() documentation improvements from 3.2.
http://hg.python.org/cpython/rev/bae644e46556

New changeset 178ba363af1c by Chris Jerdonek in branch 'default':
Issue #16115: Merge subprocess.Popen() documentation improvements from 3.3.
http://hg.python.org/cpython/rev/178ba363af1c

New changeset f051e37ac11d by Chris Jerdonek in branch '2.7':
Issue #16115: Backport subprocess.Popen() documentation improvements from 3.2.
http://hg.python.org/cpython/rev/f051e37ac11d

--

___
Python tracker 

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



[issue16191] ceval cleanup

2012-10-10 Thread Benjamin Peterson

New submission from Benjamin Peterson:

The attached patch

- Puts every opcode in its own block
- Removes the infamous one variable names "x, v, w, u" and replaces them with 
local variables.
- forces every opcode to end in DISPATCH() or "goto error"
- cleans up a few minor other things

--
files: ceval-better.patch
keywords: patch
messages: 172610
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: ceval cleanup
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file27522/ceval-better.patch

___
Python tracker 

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



[issue16135] Removal of OS/2 support

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e3e43287ad48 by Jesus Cea in branch 'default':
Closes #16135: Removal of OS/2 support (distutils) (II)
http://hg.python.org/cpython/rev/e3e43287ad48

--

___
Python tracker 

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



[issue16135] Removal of OS/2 support

2012-10-10 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Arfrever, thanks for telling me about "distutils".

Leaving "zlib" and "libffi" alone.

--

___
Python tracker 

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



[issue16135] Removal of OS/2 support

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 147b9d530dd0 by Jesus Cea in branch 'default':
Closes #16135: Removal of OS/2 support (distutils)
http://hg.python.org/cpython/rev/147b9d530dd0

--
resolution:  -> fixed
stage:  -> 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



[issue15111] Wrong ImportError message with importlib

2012-10-10 Thread Brett Cannon

Changes by Brett Cannon :


--
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



[issue15111] Wrong ImportError message with importlib

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 09b5158d5284 by Brett Cannon in branch '3.3':
Closes issue #15111: Calling __import__ with a module specified in
http://hg.python.org/cpython/rev/09b5158d5284

New changeset 31db8e3272f1 by Brett Cannon in branch 'default':
Merge fix for issue #15111.
http://hg.python.org/cpython/rev/31db8e3272f1

--

___
Python tracker 

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



[issue16188] Windows C Runtime Library Mismatch

2012-10-10 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2012-10-10 Thread Éric Araujo

Éric Araujo added the comment:

I was addressing the author of the patch :)

--

___
Python tracker 

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



[issue13440] Explain the "status quo wins a stalemate" principle in the devguide

2012-10-10 Thread Mike Hoy

Mike Hoy added the comment:

Would this be the appropriate place for the links to the two essays: 
http://docs.python.org/devguide/#proposing-changes-to-python-itself

--

___
Python tracker 

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




[issue12319] [http.client] HTTPConnection.putrequest not support "chunked" Transfer-Encodings to send data

2012-10-10 Thread Piotr Dobrogost

Changes by Piotr Dobrogost :


--
nosy: +piotr.dobrogost

___
Python tracker 

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



[issue4696] email module does not unfold headers

2012-10-10 Thread Evan Jones

Changes by Evan Jones :


--
nosy: +evanj

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2012-10-10 Thread Mike Hoy

Mike Hoy added the comment:

>>> Cool!  Can you add tests?

Nope, I can't add tests.

--

___
Python tracker 

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



[issue16061] performance regression in string replace for 3.3

2012-10-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +loewis

___
Python tracker 

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



[issue16061] performance regression in string replace for 3.3

2012-10-10 Thread STINNER Victor

STINNER Victor added the comment:

> The code is now using the heavily optimized findchar() function.

I compared performances of the two methods: dummy loop vs find. Results with a 
string of 100,000 characters:

 * Replace 100% (rewrite all characters): find is 12.5x slower than a loop
 * Replace 50%: find is 3.3x slower
 * Replace only 2 characters (0.001%): find is 10.4x faster

In practice, I bet that the most common case is to replace only a few 
characters. Replace all characters is a rare usecase.

Use attached "unicode.patch" on Python 3.4 with the following commands to 
reproduce my benchmark:

python -m timeit -s "a='a'; b='b'; text=a*10" "text.replace(a, b)"
python -m timeit -s "a='a'; b='b'; text=(a+' ')*(10//2)" "text.replace(a, 
b)"
python -m timeit -s "a='a'; b='b'; text=a+' '*10+a" "text.replace(a, b)"

--

An option is to use the find method, and then switch to the dummy loop method 
if there are too much characters to replace. I don't know if it's necessary to 
develop such complex algorithm. It would be better to have a benchmark 
extracted from a real world application like a template engine.

--
keywords: +patch
Added file: http://bugs.python.org/file27521/unicode.patch

___
Python tracker 

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



[issue14313] zipfile should raise an exception for unsupported compression methods

2012-10-10 Thread Stephen McInerney

Stephen McInerney added the comment:

I visually reviewed the patch, it's fine by me. (Am not set up to compile it.)

When is 2.7.3.x release planned?

--

___
Python tracker 

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



[issue16119] Python 2.7 _socket DLL import error on Windows Vista

2012-10-10 Thread Spiros K.

Spiros K. added the comment:

I found out that I had intalled an other program which used an obsolete version 
of python that generated a "conflict" with the current version. By removing 
this program everything worked fine.

--

___
Python tracker 

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



[issue15233] atexit: guarantee order of execution of registered functions?

2012-10-10 Thread Charles-François Natali

Charles-François Natali added the comment:

Ping.
Like Raymond, I think there's no reason to leave ambiguity in 2.7 and 3.2,  so 
this doc patch is probably worth backporting.

--

___
Python tracker 

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



[issue16189] ld_so_aix not found

2012-10-10 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +trent

___
Python tracker 

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



[issue16188] Windows C Runtime Library Mismatch

2012-10-10 Thread Ned Deily

Changes by Ned Deily :


--
components: +Windows
nosy: +brian.curtin, loewis, tim.golden

___
Python tracker 

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



[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2012-10-10 Thread Ned Deily

Changes by Ned Deily :


--
nosy:  -ned.deily

___
Python tracker 

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



[issue16189] ld_so_aix not found

2012-10-10 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Oct 10, 2012, at 04:13 PM, Éric Araujo wrote:

>This probably happens in 3.2 too, where the ABI suffixes were added.  I think
>Barry edited the sysconfig module to let it find config-$suffixes but not
>distutils.sysconfig.

This sure smells familiar, like I've fixed this some place before.  But I
can't find it, in either the py32 news or in the Ubuntu package changelogs.

--

___
Python tracker 

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



[issue15833] most failures to write byte-compiled file no longer suppressed

2012-10-10 Thread Charles-François Natali

Charles-François Natali added the comment:

> Charles-François's patch looks ok to me. I don't know if this warrants adding 
> a test.

Yes, and triggering a failure other than a permission error (which is
probably already tested) can be difficult.

I'm abroad and won't be able to commit it until at least a week, so if
someone's willing to commit it before go ahead :-)

--

___
Python tracker 

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



[issue12967] IDLE RPC Proxy for standard IO streams lacks 'errors' attribute

2012-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If this issue only about 'errors' attribute of IDLE RPC Proxy for standard IO 
streams, then it should be closed as outdated. If this issue about 'errors' 
attribute of IDLE standard IO streams (even when running IDLE without a 
subprocess), then the patches for issue9290 will solve this issue.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file27520/idle_stdstreams-2.7.patch

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file27519/idle_stdstreams-3.2.patch

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: http://bugs.python.org/file27518/idle_stdstreams-3.3.patch

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The proposed patches make the behavior of sys.std* files in IDLE more similar 
to the behavior of sys.std* files in standard interpreter. Now sys.stdin have 
read() and readlines() methods. The source code is simplified.

--
nosy: +kbk, loewis, serhiy.storchaka
versions: +Python 2.7, 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



[issue16186] shlex bug?

2012-10-10 Thread Roger Serwy

Roger Serwy added the comment:

I verified that the problem also occurs with 3.3 and 3.4 as well.

Adding "sl.posix = True" causes the "h w" test to enter an infinite loop.

--
nosy: +serwy
versions: +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



[issue13691] pydoc help (or help('help')) should show the doc for help

2012-10-10 Thread Éric Araujo

Éric Araujo added the comment:

Cool!  Can you add tests?

--
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



[issue16190] Misleading warning in random module docs

2012-10-10 Thread Georg Brandl

Georg Brandl added the comment:

Sure, I'd propose a rewording that mentions both alternatives and when they 
should be used.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Michele Orrù

Changes by Michele Orrù :


--
nosy: +maker

___
Python tracker 

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



[issue14313] zipfile should raise an exception for unsupported compression methods

2012-10-10 Thread Éric Araujo

Éric Araujo added the comment:

Raising priority won’t give more free time to the module maintainer, or change 
the planned date for the next release.  Thanks for reviewing the patch however, 
it is helpful.  Did you apply it and run the test suite?

--
versions: +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



[issue16189] ld_so_aix not found

2012-10-10 Thread Éric Araujo

Éric Araujo added the comment:

This probably happens in 3.2 too, where the ABI suffixes were added.  I think 
Barry edited the sysconfig module to let it find config-$suffixes but not 
distutils.sysconfig.

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



[issue16190] Misleading warning in random module docs

2012-10-10 Thread Christian Heimes

New submission from Christian Heimes:

The documentation [1] of the random module contains a misleading warning 

---
Warning: The generators of the random module should not be used for security 
purposes. Use ssl.RAND_bytes() if you require a cryptographically secure 
pseudorandom number generator.
---

The warning should point users to os.urandom() and random.SystemRandom rather 
than ssl.RAND_bytes(). On Linux os.urandom() wraps /dev/urandom [2], on Windows 
it uses CryptGenRandom() [3]. Both are suitable for most cryptographic purposes 
except for long-lived keys (SSL, SSH, GPG certs etc.). ssl.RAND_bytes() should 
only be used for such long-lived data and not for salts, session ids and 
similar.

I like to see the warning box in Python 2.7, too. It's still the default for 
docs.python.org. My inquiry is motivated by #16184.

[1] http://docs.python.org/py3k/library/random.html
[2] http://linux.die.net/man/4/urandom
[3] 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa379942%28v=vs.85%29.aspx

--
assignee: docs@python
messages: 172589
nosy: christian.heimes, docs@python
priority: normal
severity: normal
status: open
title: Misleading warning in random module docs
type: security
versions: Python 2.7, 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



[issue16189] ld_so_aix not found

2012-10-10 Thread Rainer Schaaf

New submission from Rainer Schaaf:

When building an extension on AIX with distutils the build fails like this:

/usr/local/lib/python3.3/config/ld_so_aix xlc_r 
-bI:/usr/local/lib/python3.3/config/python.exp 
build/temp.aix-5.3-3.3/pdflib_py.o -L../../../libs/pdflib/.libs 
-L../../../libs/icu/lib -ls_libpdf -lC -o build/lib.aix-5.3-3.3/pdflib_py.so
unable to execute /usr/local/lib/python3.3/config/ld_so_aix: No such file or 
directory
error: command '/usr/local/lib/python3.3/config/ld_so_aix' failed with exit 
status 1

The problem can easily be fixed by:

ln -s /usr/local/lib/python3.3/config-3.3m  /usr/local/lib/python3.3/config

--
assignee: eric.araujo
components: Distutils
messages: 172588
nosy: eric.araujo, rjs, tarek
priority: normal
severity: normal
status: open
title: ld_so_aix not found
type: compile error
versions: Python 3.3

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 705a70b0fff4 by Chris Jerdonek in branch '3.3':
Issue #12947: Remove doctest directives from the doctest examples in the 
"Option Flag" section.
http://hg.python.org/cpython/rev/705a70b0fff4

New changeset 9475fc82768e by Chris Jerdonek in branch 'default':
Issue #12947: Merge doctest documentation change from 3.3.
http://hg.python.org/cpython/rev/9475fc82768e

New changeset 8704f9e7ad7c by Chris Jerdonek in branch '2.7':
Issue #12947: Backport doctest documentation change from 3.3.
http://hg.python.org/cpython/rev/8704f9e7ad7c

--

___
Python tracker 

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



[issue1043134] Add preferred extensions for MIME types

2012-10-10 Thread Evan Jones

Changes by Evan Jones :


--
nosy: +evanj

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Georg suggested removing the doctest directives from the examples I mentioned.  
As currently written, they don't help them pass if doctest were run on the .rst 
file.  That sounds fine to me for now.

--

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Like these that discuss the behavior of the doctest.IGNORE_EXCEPTION_DETAIL 
option (but before doctest directives have been introduced):

http://hg.python.org/cpython/file/0d6910bef979/Doc/library/doctest.rst#l543

The key is that you can have options take effect without using directives, so 
it would be good if people can see examples like that.

--

___
Python tracker 

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



[issue16188] Windows C Runtime Library Mismatch

2012-10-10 Thread rlinscheer

New submission from rlinscheer:

When installing python-2.7.3.amd64.msi or python-2.7.3.msi and selecting for 
single-user (as opposed to for all users), an incorrect version of the 
microsoft C runtime library (msvcr90.dll) seems to be placed into the top-level 
directory along side the python executable.  This results in the message:

The application has failed to start because its side-by-side configuration is 
incorrect. Please see the application event log or use the command-line 
sxstrace.exe tool for more detail.

The event log shows the error too:

Activation context generation failed for "C:\python_rob_32\pythonw.exe".Error 
in manifest or policy file "C:\python_rob_32\Microsoft.VC90.CRT.MANIFEST" on 
line 4. Component identity found in manifest does not match the identity of the 
component requested. Reference is 
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
 Definition is 
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.1".
 Please use sxstrace.exe for detailed diagnosis.

Running the sxstrace tool shows the following:

INFO: Parsing Manifest File C:\python_rob_32\Microsoft.VC90.CRT.MANIFEST.
INFO: Manifest Definition Identity is 
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.1".
ERROR: Component identity found in manifest does not match the identity 
of the component requested. Reference is 
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
 Definition is 
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.1".
ERROR: Activation Context generation failed.

This would seem to be the relevant section of the trace, though I have attached 
the full output of the sxstrace if desired.

This leads me to the conclusion that a newer version of the C runtime library 
is being shipped with the python executable that was built with an older 
version.

This problem was mentioned with less detail in issue 14608, but closed without 
resolution as far as I can tell.

--
components: Installation
files: rob_32.txt
messages: 172584
nosy: rlinscheer
priority: normal
severity: normal
status: open
title: Windows C Runtime Library Mismatch
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file27517/rob_32.txt

___
Python tracker 

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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Georg Brandl

Georg Brandl added the comment:

> 1. In spite of the fact that MT states are initialized correctly,
> there is a practical method to exploit the vulnerability because of
> Python web framework peculiarities.

What does this mean exactly?  If it means that this predictability can
be used for attacks on web frameworks because they assume cryptographic
strength of random numbers, please report it to those frameworks' 
security channels, e.g. secur...@djangoproject.com.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Georg Brandl

Georg Brandl added the comment:

I don't see any blocks in doctest.rst where the directives should be stripped, 
so it's enough to do it per-file.

--

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks, Georg.  Can this new directive be applied to individual code blocks 
though (or be modified to do so)?

After a closer review (as mentioned in my comment above), it seems that the 
doctest directives should only be displayed in the code snippets that are 
illustrating the use of doctest directives (as opposed to, say, the snippets 
that are illustrating doctest options without using directives).

--

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffe9f644d5af by Georg Brandl in branch '2.7':
Issue #12947: revert earlier workaround and use a monkey-patch to enable 
showing doctest directives only in the doctest docs.
http://hg.python.org/cpython/rev/ffe9f644d5af

--

___
Python tracker 

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



[issue16187] incoming.irker hook raised an exception: [Errno 111] Connection refused

2012-10-10 Thread Georg Brandl

Georg Brandl added the comment:

Restarted.  Let's see if this is reproducible.

--
resolution:  -> fixed
status: open -> pending

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9057da41cf0b by Georg Brandl in branch '3.2':
Issue #12947: revert earlier workaround and use a monkey-patch to enable 
showing doctest directives only in the doctest docs.
http://hg.python.org/cpython/rev/9057da41cf0b

New changeset 1202c1449d83 by Georg Brandl in branch '3.3':
Issue #12947: revert earlier workaround and use a monkey-patch to enable 
showing doctest directives only in the doctest docs.
http://hg.python.org/cpython/rev/1202c1449d83

--

___
Python tracker 

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



[issue16187] incoming.irker hook raised an exception: [Errno 111] Connection refused

2012-10-10 Thread Chris Jerdonek

New submission from Chris Jerdonek:

I got the following irker-related errors when committing about 20 minutes ago:

remote: added 3 changesets with 2 changes to 1 files
remote: buildbot: change(s) sent successfully
remote: sent email to roundup at rep...@bugs.python.org
remote: notified python-check...@python.org of incoming changeset 00555659253d
remote: error: incoming.irker hook raised an exception: [Errno 111] Connection 
refused
remote: notified python-check...@python.org of incoming changeset 467c9f663b77
remote: error: incoming.irker hook raised an exception: [Errno 111] Connection 
refused
remote: notified python-check...@python.org of incoming changeset 15bfa778ec21
remote: error: incoming.irker hook raised an exception: [Errno 111] Connection 
refused

--
components: None
messages: 172577
nosy: chris.jerdonek, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: incoming.irker hook raised an exception: [Errno 111] Connection refused
type: behavior

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> Yes, the workaround should be applied in those cases as well.

I added the workaround to the last remaining example.  Nick was right before in 
that three of the four examples I mentioned above were in the part about 
"option flags" rather than in the part about "directives".  I made those two 
parts into their own sections for added clarity.

--

___
Python tracker 

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



[issue12947] doctest directive examples in library/doctest.html lack the flags

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 00555659253d by Chris Jerdonek in branch '3.3':
Issue #12947: Divide doctest "Option Flags and Directives" section into two.
http://hg.python.org/cpython/rev/00555659253d

New changeset 467c9f663b77 by Chris Jerdonek in branch 'default':
Issue #12947: Merge doctest documentation improvements from 3.3.
http://hg.python.org/cpython/rev/467c9f663b77

New changeset 15bfa778ec21 by Chris Jerdonek in branch '2.7':
Issue #12947: Backport doctest documentation improvements from 3.3.
http://hg.python.org/cpython/rev/15bfa778ec21

--

___
Python tracker 

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



[issue16186] shlex bug?

2012-10-10 Thread jamesf

jamesf added the comment:

but if i did this, it works again:

In [121]: test_ws(" 'h' w")  # prepend a whitespace at the beginning
[" 'h' w"]

--

___
Python tracker 

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



[issue16186] shlex bug?

2012-10-10 Thread jamesf

New submission from jamesf:

In [112]: def test_ws(s):
   .: sl = shlex.shlex(s)
   .: sl.whitespace = "|"
   .: sl.whitespace_split = True
   .: print list(sl)


In [114]: test_ws("h w")   # works fine
['h w']

In [115]: test_ws("'h' w")  # i expected ["'h' w"] here, but why?
["'h'", ' w']

--
messages: 172573
nosy: jwfang
priority: normal
severity: normal
status: open
title: shlex bug?
type: behavior
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



[issue15111] Wrong ImportError message with importlib

2012-10-10 Thread Brett Cannon

Brett Cannon added the comment:

Here are two possible tests.

1) __import__('distutils', fromlist=['_i_do_not_exist']) should return distutils

2) Use a fake loader which executes some code which does nothing more than 
tries to import a non-existent module. The trick with this test is that the 
submodule must be found but a module that the submodule needs cannot be found 
by import itself (and simply not faked with an ImportError thanks to the 
_not_found hack and needing that attribute to propagate up to the submodule 
search).

And I think the failure stems from the lack of check against exc.name equaling 
the name of the module being imported (e.g. exc.name == 
distutils.msvc9compiler) since the winreg import is a failed module search as 
well.

--

___
Python tracker 

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



[issue16175] Add I/O Completion Ports wrapper

2012-10-10 Thread Richard Oudkerk

Changes by Richard Oudkerk :


Added file: http://bugs.python.org/file27516/iocp_example.py

___
Python tracker 

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



[issue16175] Add I/O Completion Ports wrapper

2012-10-10 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Adding the IOCP functions to _winapi is straightforward -- see patch.  Note 
that there seems to be no way to unregister a handle from an IOCP.

Creating overlapped equivalents of socket.accept() and socket.connect() looks 
more complicated.  Perhaps that should be added to the socket module or left to 
pywin32.

--
keywords: +patch
Added file: http://bugs.python.org/file27515/iocp.patch

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> Maybe better to fix Windows behavior for unifying FileNotFoundError?

I created issue 16185 to include the path in the messages of the corresponding 
errors on Windows.

--

___
Python tracker 

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



[issue16185] include path in subprocess.Popen() file not found error messages on Windows

2012-10-10 Thread Chris Jerdonek

New submission from Chris Jerdonek:

Currently, when subprocess.Popen() raises a FileNotFoundError on POSIX systems, 
the error message helpfully includes the path not found.  But it does not do so 
on Windows.

This issue is to include the path also in the messages of the corresponding 
errors on Windows.

See also the related issue 16114.

--
components: Library (Lib)
messages: 172569
nosy: asvetlov, chris.jerdonek, gregory.p.smith
priority: normal
severity: normal
status: open
title: include path in subprocess.Popen() file not found error messages on 
Windows
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Christian Heimes

Christian Heimes added the comment:

I don't see a problem here. It's a well known and documented fact that a PRNG 
like a Mersenne-Twister must not be used for any cryptographic purpose. The 
most of the random module is designed to be deterministic. The global instance 
even keeps its state after fork(). It's really not a security issue but a 
feature.

http://docs.python.org/library/random.html
---
The Mersenne Twister is one of the most extensively tested random number 
generators in existence. However, being completely deterministic, it is not 
suitable for all purposes, and is completely unsuitable for cryptographic 
purposes.
---

The os.urandom() function and random.SystemRandom class are desigend to create 
cryptographically strong random data that can be for most purposes except for 
long lived crypto keys like SSL certs.

--
components: +Library (Lib) -None
nosy: +christian.heimes

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I made some comments on the changes as committed here:

http://mail.python.org/pipermail/python-dev/2012-October/122125.html

"""
It would be cleaner to use the self.assertRaises() pattern here and
also probably better to share code across the three test methods which
are nearly identical to one another (there is a fourth scenario I
would also add of shell=True).

I would also check for FileNotFoundError instead of OSError in the 3.3
and later versions.
"""

--

___
Python tracker 

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



[issue16184] Attack against the pseudorandom number generator

2012-10-10 Thread Yury

New submission from Yury:

---[ Vulnerability description]

Positive Research experts have detected a vulnerability "Predictable 
pseudorandom numbers in Python" caused by random.random() output in Python.

By default, Mersenne Twister initialization is done during random module import 
and then after 312 random.random() calls that allows attackers to predict 313 
random number with 2^8 accuracy based on 1, 2, 199, 200, 511, 625 random 
numbers.

--[Solution]
 
We recommend you to initialize random.seed() after every 312 calls that 
guarantees enough entropy of Mersenne Twister element statuses.

---[Credits]

Vulnerability was detected by Timur Yunusov, Positive Research Center (Positive 
Technologies Company)

---

1. In spite of the fact that MT states are initialized correctly, there is a 
practical method to exploit the vulnerability because of Python web framework 
peculiarities.
2. The possibility that a random number is among described 256 variants is 
12,5% because there are two methods to round off numbers to the certain 
accuracy. This provides 8 possible variants of existing state_1[2], 
state_1[397], state_2[397].
You can find the code necessary to demonstrate the vulnerability (vuln.py) and 
exploit it (brute.py) attached.

--
components: None
files: POC.zip
messages: 172566
nosy: ymaryshev
priority: normal
severity: normal
status: open
title: Attack against the pseudorandom number generator
type: security
versions: Python 3.3
Added file: http://bugs.python.org/file27514/POC.zip

___
Python tracker 

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



[issue16160] subclassing types.SimpleNamespace does not work

2012-10-10 Thread R. David Murray

R. David Murray added the comment:

Thanks.  I don't have a need for those in my current application at the current 
time.

--

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I'm keeping this open until I backport this to subprocess32 for use on Python 2.

--
stage: needs patch -> commit review

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 543bb0e0afb9 by Gregory P. Smith in branch 'default':
Fixes Issue #16114: The subprocess module no longer provides a
http://hg.python.org/cpython/rev/543bb0e0afb9

--

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e938fa6be509 by Gregory P. Smith in branch '3.2':
Fixes Issue #16114: The subprocess module no longer provides a
http://hg.python.org/cpython/rev/e938fa6be509

New changeset ee30d7ef70be by Gregory P. Smith in branch '3.3':
Fixes Issue #16114: The subprocess module no longer provides a
http://hg.python.org/cpython/rev/ee30d7ef70be

--
nosy: +python-dev

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> replacing repr(args[0]) with repr(executable) in the identified python should 
> be sufficient for this bug as originally reported.

Yes, almost.  The executable variable is a bytes object so it needs to be 
fsdecoded first.

> I have a test and fix for that.  I'll take care of both.

Let me at least upload what I already prepared.  You can add to it or modify it 
as you see fit.

--

___
Python tracker 

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



[issue16183] ZipExtFile object close without file handle closed

2012-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Windows
nosy: +alanmcintyre, loewis

___
Python tracker 

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



[issue16179] hashlib.md5 / json inconsistency

2012-10-10 Thread Robin Åsén

Robin Åsén added the comment:

Yes, you are quite right.
Somewhere in the back of my head I had a feeling I should understand what was 
happening, hence my comment "Am I doing something wrong here?".
I just couldn't see it. 

Thank you.

--

___
Python tracker 

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



[issue16179] hashlib.md5 / json inconsistency

2012-10-10 Thread Hynek Schlawack

Hynek Schlawack added the comment:

Actually, that’s not the point here, the code has a deeper flaw.

You’re computing hashlib.md5() on `data.encode()` and `str(jsonData).encode()`. 
Did you have a look how they look like?

>>> data.encode()
b'{"key1":"value1","key2":"value2"}'
[71875 refs]
>>> str(jsonData).encode()
b"{'key1': 'value1', 'key2': 'value2'}"

`str(jsonData)` doesn’t return JSON because it’s a simple dict():

>>> type(jsonData)


If you wanted to have JSON again, you’d have to use `json.dumps()`:

>>> json.dumps(jsonData)
'{"key1": "value1", "key2": "value2"}'

HOWEVER: This string _also_ differs from yours due to additional whitespace, 
ie. the sum would differ again.

Additionally, as David pointed out, you can’t rely on the order of the dict. 
json.dump() could just as well return `'{"key2": "value2", "key1": "value1"}'`.

--
nosy: +hynek

___
Python tracker 

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



[issue15278] UnicodeDecodeError when readline in codecs.py

2012-10-10 Thread Walter Dörwald

Walter Dörwald added the comment:

> >>> codecs.utf_8_decode('\u20ac'.encode('utf8')[:2])
> ('', 0)
>
> Oh... codecs.CODEC_decode are incremental decoders? I misunderstood completly 
> this.

No, those function are not decoders, they're just helper functions used to 
implement the real incremental decoders. That's why they're undocumented.

Whether codecs.utf_8_decode() returns partial results or raises an exception 
depends on the final argument::

>>> s = '\u20ac'.encode('utf8')[:2]
>>> codecs.utf_8_decode(s, 'strict')
('', 0)
>>> codecs.utf_8_decode(s, 'strict', False)
('', 0)
>>> codecs.utf_8_decode(s, 'strict', True)
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-1: 
unexpected end of data

If you look at encodings/utf_8.py you see that the stateless decoder call 
codecs.utf_8_decode() with final==True::

def decode(input, errors='strict'):
return codecs.utf_8_decode(input, errors, True)

so the stateless decoder *will* raise exceptions for partial results. The 
incremental decoder simply passed on the final argument given to its encode() 
method.

--
nosy: +doerwalter

___
Python tracker 

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



[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-10 Thread Christian Heimes

Christian Heimes added the comment:

The patch defines either PY_IS_BIG_ENDIAN or PY_IS_LITTLE_ENDIAN and sets 
PY_LITTLE_ENDIAN_FLAG to either 0 or 1 for some modules that require a boolean 
flag.

--
Added file: http://bugs.python.org/file27513/endian.patch

___
Python tracker 

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2012-10-10 Thread Gregory P. Smith

Gregory P. Smith added the comment:

replacing repr(args[0]) with repr(executable) in the identified python should 
be sufficient for this bug as originally reported.

BUT it goes deeper:  I just ran into this error in a different case.  It also 
happens when cwd is passed and the chdir(cwd) fails in the child process.  
args[0] is reported as not found rather than cwd in the error message.

I have a test and fix for that.  I'll take care of both.

--
assignee: chris.jerdonek -> gregory.p.smith
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



[issue16183] ZipExtFile object close without file handle closed

2012-10-10 Thread V.E.O

Changes by V.E.O :


--
type:  -> behavior

___
Python tracker 

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



[issue16183] ZipExtFile object close without file handle closed

2012-10-10 Thread V.E.O

New submission from V.E.O:

Hi, I tried to open file-like object ZipExtFile in one zip file, after 
operations, I close it and after all, close ZipFile.
But I still can not remove the zip file immediately.

This problem happens on Windows, error msg:
WindowsError: [Error 32] The process cannot access the file because it is being 
used by another process: ..

Sample code as below:

z = ZipFile('D:\\1', 'r')
zlist = z.infolist()
for zi in zlist:
zf = z.open(zi)
zf.close()

z.close()
os.remove(attach)

--
components: Library (Lib)
messages: 172555
nosy: V.E.O
priority: normal
severity: normal
status: open
title: ZipExtFile object close without file handle closed
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



[issue15991] BaseHTTPServer with ThreadingMixIn serving wrong data sometimes

2012-10-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Furthermore, BaseHTTPServer responds with a HTTP/1.0 status line (not 
HTTP/1.1), meaning persistent connections are not the default.

Therefore, I'm closing as invalid.

--
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



[issue15991] BaseHTTPServer with ThreadingMixIn serving wrong data sometimes

2012-10-10 Thread Charles-François Natali

Charles-François Natali added the comment:

According to http://tools.ietf.org/html/rfc2616#section-8.1,
persistent connections are default in HTTP 1.1.
However, here's what's said about the persistence negotiation:
"""
   An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to
   maintain a persistent connection unless a Connection header including
   the connection-token "close" was sent in the request. If the server
   chooses to close the connection immediately after sending the
   response, it SHOULD send a Connection header including the
   connection-token close.

   An HTTP/1.1 client MAY expect a connection to remain open, but would
   decide to keep it open based on whether the response from a server
   contains a Connection header with the connection-token close. In case
   the client does not want to maintain a connection for more than that
   request, it SHOULD send a Connection header including the
   connection-token close.

   If either the client or the server sends the close token in the
   Connection header, that request becomes the last one for the
   connection.
"""

And if you have a look at the strace output (or a tcpdump capture),
you see that httpserver indeeds sends a "Connection: close" header,
which wget ignores:
"""
select(6, [5], NULL, NULL, {900, 0})= 1 (in [5], left {900, 0})
recvfrom(5, "Connection: close\r\n", 390, MSG_PEEK, NULL, NULL) = 19
read(5, "Connection: close\r\n", 19)= 19
select(6, [5], NULL, NULL, {900, 0})= 1 (in [5], left {900, 0})
recvfrom(5, "\r\n", 371, MSG_PEEK, NULL, NULL) = 2
read(5, "\r\n", 2)  = 2
select(6, [5], NULL, NULL, {0, 1})  = 0 (Timeout)
select(6, NULL, [5], NULL, {900, 0})= 1 (out [5], left {900, 0})
write(5, "GET /FOUND-8154 HTTP/1.1\r\nUser-A"..., 124) = 124
select(6, [5], NULL, NULL, {900, 0})= 1 (in [5], left {900, 0})
recvfrom(5, "\nError response\nError response\nError response

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