[issue13761] Add flush keyword to print()

2012-01-12 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

I am not discussing printing to file, so my 0.02 is that flush=True should 
be made default for print() with sys.stdout, because it is probably what users 
expect when calling this function.

If somebody needs buffering/cache or more fine-grained control over output, 
they are free to use sys.stdout.write/flush directly.

And users won't be happy to wrap every print() into try/catch to guard from the 
flush exceptions.

--
nosy: +techtonik

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



[issue13703] Hash collision security issue

2012-01-12 Thread Frank Sievertsen

Frank Sievertsen pyt...@sievertsen.de added the comment:

I'd like to add a few notes:

1. both 32-bit and 64-bit python are vulnerable
2. collision-counting will break other things
3. imho, randomization is the way to go, enabled by default.
4. do we need a steady hash-function later again?

I created ~500KB of colliding strings for both 32-bit and 64-bit python.
It works impressively good:

32bit: ~500KB payload keep django busy for 30 minutes.
64bit: ~500KB payload keep django busy for 5 minutes.

Django is more vulnerable than python-dict alone, because it
* converts the strings to unicode first, making the comparision more expensive
* does 5 dict-lookups per key.

So Python's dict of str alone is probably ~10x faster. Of course it's much 
harder to create the payload for 64-bit python than for 32-bit, but it works 
for both.

The collision-counting idea makes some sense in the web environment, but for 
other software types it can causes serious problems.

I don't want my software to stop working because someone managed to enter 1000 
bad strings into it. Think of a software that handles names of customers or 
filenames. We don't want it to break completely just because someone entered a 
few clever names.

Randomization fixes most of these problems.

However, it breaks the steadiness of hash(X) between two runs of the same 
software. There's probably code out there that assumes that hash(X) always 
returns the same value: database- or serialization-modules, for example.

There might be good reasons to also have a steady hash-function available. The 
broken code is hard to fix if no such a function is available at all. Maybe 
it's possible to add a second steady hash-functions later again?

For the moment I think the best way is to turn on randomization of hash() by 
default, but having a way to turn it off.

--
nosy: +fx5

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



[issue13703] Hash collision security issue

2012-01-12 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Frank Sievertsen wrote:
 
 I don't want my software to stop working because someone managed to enter 
 1000 bad strings into it. Think of a software that handles names of customers 
 or filenames. We don't want it to break completely just because someone 
 entered a few clever names.

Collision counting is just a simple way to trigger an action. As I mentioned
in my proposal on this ticket, raising an exception is just one way to deal
with the problem in case excessive collisions are found. A better way is to
add a universal hash method, so that the dict can adapt to the data and
modify the hash functions for just that dict (without breaking other
dicts or changing the standard hash functions).

Note that raising an exception doesn't completely break your software.
It just signals a severe problem with the input data and a likely
attack on your software. As such, it's no different than turning on DOS
attack prevention in your router.

In case you do get an exception, a web server will simply return a 500 error
and continue working normally.

For other applications, you may see a failure notice in your logs. If
you're sure that there are no possible ways to attack the application using
such data, then you can simply disable the feature to prevent such
exceptions.

 Randomization fixes most of these problems.

See my list of issues with this approach (further up on this ticket).

 However, it breaks the steadiness of hash(X) between two runs of the same 
 software. There's probably code out there that assumes that hash(X) always 
 returns the same value: database- or serialization-modules, for example.
 
 There might be good reasons to also have a steady hash-function available. 
 The broken code is hard to fix if no such a function is available at all. 
 Maybe it's possible to add a second steady hash-functions later again?

This is one of the issues I mentioned.

 For the moment I think the best way is to turn on randomization of hash() by 
 default, but having a way to turn it off.

--

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



[issue13703] Hash collision security issue

2012-01-12 Thread Graham Dumpleton

Graham Dumpleton graham.dumple...@gmail.com added the comment:

Right back at the start it was said:


We haven't agreed whether the randomization should be enabled by default or 
disabled by default. IMHO it should be disabled for all releases except for the 
upcoming 3.3 release. The env var PYTHONRANDOMHASH=1 would enable the 
randomization. It's simple to set the env var in e.g. Apache for mod_python and 
mod_wsgi.


with a environment variable PYTHONHASHSEED still being mentioned towards the 
end.

Be aware that a user being able to set an environment variable which is used on 
Python interpreter initialisation when using mod_python or mod_wsgi is not as 
trivial as made out in leading comment.

To set an environment variable would require the setting of the environment 
variable to be done in the Apache etc init.d scripts, or if the Apache distro 
still follows Apache Software Foundation conventions, in the 'envvars' file.

Having to do this requires root access and is inconvenient, especially since 
where it needs to be done differs between every distro.

Where there are other environment variables that are useful to set for 
interpreter initialisation, mod_wsgi has been changed in the past to add 
specific directives for the Apache configuration file to set them prior to 
interpreter initialisation. This at least makes it somewhat easier, but still 
only of help where you are the admin of the server.

If that approach is necessary, then although mod_wsgi could eventually add such 
a directive, as mod_python is dead it will never happen for it.

As to another question posed about whether mod_wsgi itself is doing anything to 
combat this, the answer is no as don't believe there is anything it can do. 
Values like the query string or post data is simply passed through as is and 
always pulled apart by the application.

--
nosy: +grahamd

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



[issue13774] json.loads raises a SystemError for invalid encoding on 2.7.2

2012-01-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Here is a patch

--
nosy: +amaury.forgeotdarc
stage:  - patch review

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



[issue13774] json.loads raises a SystemError for invalid encoding on 2.7.2

2012-01-12 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc amaur...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file24212/json_badencoding.patch

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-12 Thread Mads Kiilerich

Mads Kiilerich m...@kiilerich.com added the comment:

I was scared by the note in the documentation and wondered if the socket Python 
API was completely incapable of handling half-closed connections cross 
platform. pitrou helped me on IRC to track the note down to this issue.


IMO the bug report should have been rejected and the documentation patch should 
be removed. It shouldn't be that surprising that shutting something down that 
already has been shutdown (by the peer) will fail.

I don't see any indication that a shutdown call closes the connection on the 
other half. It makes it half-closed as it should - and if it did anything else 
(which the note indicates) then it would be a big violation of BSD TCP API.

Ok, it might be slightly surprising that the next shutdown on the other end 
fails, but that is fully covered by Note Some behavior may be platform 
dependent, since calls are made to the operating system socket APIs. It is not 
specific to Python in any way, AFAICT.

If anything it could just say something like Note that shutdown of a socket 
that already has been shut down by the peer is platform dependent and might 
fail.

--
nosy: +kiilerix, pitrou
title: socket.shudown documentation: on some platforms, closing one half closes 
the other half - socket.shutdown documentation: on some platforms, closing one 
half closes the other half

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-12 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +neologix

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Added file: http://bugs.python.org/file24213/494c976c41c4.diff

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file23774/0d1d76f68750.diff

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file24213/494c976c41c4.diff

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Added file: http://bugs.python.org/file24214/f8349cbc1b26.diff

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Nice milestone this evening: by incorporating doc updates based on Zbysek's 
efforts and dropping the explicit bytecode generation tests, I now have 
something that appears ready to commit *without* a dependency on the proposed 
dis module updates.

So, assuming nobody spots any major problems between now and then, the PEP 380 
implementation should be landing in the main repo some time this weekend :)

--
dependencies:  -Refactor the dis module to provide better building blocks for 
bytecode analysis

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



[issue13359] urllib2 doesn't escape spaces in http requests

2012-01-12 Thread Michele Orrù

Michele Orrù maker...@gmail.com added the comment:

Patch attached for python3, with unit tests.

--
nosy: +maker
Added file: http://bugs.python.org/file24215/issue13359.patch

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



[issue13359] urllib2 doesn't escape spaces in http requests

2012-01-12 Thread Mads Kiilerich

Mads Kiilerich m...@kiilerich.com added the comment:

FWIW, I don't think it is a good idea to escape automatically. It will change 
the behaviour in a non-backward compatible way for existing applications that 
pass encoded urls to this function.

I think the existing behaviour is better. The documentation and the failure 
mode for passing URLs with spaces could however be improved.

--
nosy: +kiilerix

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



[issue13776] formatter_unicode.c still assumes ASCII

2012-01-12 Thread Jim Jewett

New submission from Jim Jewett jimjjew...@gmail.com:

http://docs.python.org/library/string.html#format-specification-mini-language 
defines

fill::=  a character other than '}'

and the text also excludes '{'.  It does not require that the fill character be 
ASCII.

However, function parse_internal_render_format_spec 
http://hg.python.org/cpython/file/c2153ce1b5dd/Python/formatter_unicode.c#l277 
raises a ValueError if fill_char  127.

I'm honestly not certain which of the three is correct, but they should be 
consistent, and if anything but '{' is excluded, it would be best to explain 
why.

--
components: Unicode
messages: 151128
nosy: Jim.Jewett, ezio.melotti
priority: normal
severity: normal
status: open
title: formatter_unicode.c still assumes ASCII
type: behavior

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



[issue13359] urllib2 doesn't escape spaces in http requests

2012-01-12 Thread Michele Orrù

Michele Orrù maker...@gmail.com added the comment:

Here the patch for python2.


kiilerix, RFC 1738 explicitly says that the space character shall not be used.

--
Added file: http://bugs.python.org/file24216/issue13359_py2.patch

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



[issue13776] formatter_unicode.c still assumes ASCII

2012-01-12 Thread Eric V. Smith

Eric V. Smith e...@trueblade.com added the comment:

This is a duplicate of issue 13706.

--
nosy: +eric.smith
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed

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



[issue13359] urllib2 doesn't escape spaces in http requests

2012-01-12 Thread Mads Kiilerich

Mads Kiilerich m...@kiilerich.com added the comment:

Yes, the url sent by urllib2 must not contain spaces. In my opinion the only 
way to handle that correctly is to not pass urls with spaces to urlopen. 
Escaping the urls is not a good solution - even if the API was to be designed 
from scratch. It would be better to raise an exception if it is passed an 
invalid url.

Note for example that '/' and the %-encoding of '/' are different, and it must 
thus be possible to pass an url containing both to urlopen. That is not 
possible if it automically escapes.

--

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



[issue13761] Add flush keyword to print()

2012-01-12 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

Anatoly, duly noted, and disagreed with.

--

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



[issue9253] argparse: optional subparsers

2012-01-12 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
hgrepos: +102

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



[issue9253] argparse: optional subparsers

2012-01-12 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
keywords: +patch
Added file: http://bugs.python.org/file24217/ed0fce615582.diff

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



[issue13631] readline fails to parse some forms of .editrc under editline (libedit) emulation on Mac OS X

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I applied your patch and built the readline module against libreadline and 
imported it successfully.  (I did not try the special parsing feature, but I 
don’t think it’s needed.)

--

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



[issue13761] Add flush keyword to print()

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Patch LGTM.  (s/assertEquals/assertEqual/ though, or you’ll get a warning)

--
nosy: +eric.araujo

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



[issue6095] os.curdir as the default argument for os.listdir

2012-01-12 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +michael.foord
resolution: accepted - fixed
stage: patch review - committed/rejected

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



[issue11397] os.path.realpath() may produce incorrect results

2012-01-12 Thread Vadim Fint

Changes by Vadim Fint mocks...@gmail.com:


--
nosy: +Vadim.Fint

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



[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the report and patch.  How can we test it?  Do we need to install a 
Python on a path with embedded spaces?

--
keywords: +needs review
stage:  - patch review
versions: +Python 2.7, Python 3.3 -Python 2.6

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



[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Oh and BTW it would be very helpful if you could adapt your test script to be 
pure-distutils, without Cython or Numpy extensions.

--

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



[issue11397] os.path.realpath() may produce incorrect results

2012-01-12 Thread Konstantin Nikitin

Changes by Konstantin Nikitin n...@ya.ru:


--
nosy: +stromsund

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



[issue12409] Moving Documenting Python to Devguide

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Could you provide a single patch or publish your version somewhere to help 
reviews?

For the CPython docs, I think just removing the whole of Doc/documenting would 
be okay, or if we expect that people will go to that URI we may leave a 
placeholder page with only links.  Georg?

--

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



[issue13706] non-ascii fill characters no longer work in formatting

2012-01-12 Thread Eric V. Smith

Eric V. Smith e...@trueblade.com added the comment:

Sorry for the off-the-cuff diagnosis. I had assumed this was the unintended 
result of the conversion, but of course I'm wrong.

I'd like to fix this.

--
nosy: +Jim.Jewett

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



[issue13645] import machinery vulnerable to timestamp collisions

2012-01-12 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

LGTM (although I didn't run the unit tests and focused mainly on the 
importlib._bootstrap and abc changes). Only two things I would change. One is 
possibly deprecating path_mtime() so people don't waste time implementing it 
(we actually never need to remove it thanks to the ABC; otherwise we need to 
make sure the docs strongly state to only bother with path_stats()). The other 
is to say the mtime key should contain a value that is a real number (ie. float 
and any other numeric type that can cast to an integer). That way you get your 
higher resolution in the dict while still being able to use the value in 
writing the bytecode.

And is there any efficient way to get the stat info on a file AND its contents 
in a single call? If so we might want a method to support that (eg. add a 
'source_bytes' key or something), but I can't think of any low-level call that 
supports that kind of thing.

--
assignee:  - pitrou

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



[issue11633] Document that print may need explicit flushing

2012-01-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I agree with the python-ideas message that ``sys.stdout.flush()`` is surprising 
/ possibly misleading and should be ``file.flush()``.  If the other bug report 
about adding a flush argument is rejected, please consider this.  Thanks :)

--

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



[issue12736] Request for python casemapping functions to use full not simple casemaps per Unicode's recommendation

2012-01-12 Thread Jim Jewett

Jim Jewett jimjjew...@gmail.com added the comment:

The currently applied patch ( http://hg.python.org/cpython/rev/f7e05d205a52 ) 
left some dead code in unicodeobject.c

function fixup ( 
http://hg.python.org/cpython/file/f7e05d205a52/Objects/unicodeobject.c#l9386 ) 
has a shortcut for when the fixer doesn't make any actual changes.  The removed 
fixers (like fixupper ) returned 0 rather than maxchar to indicate that.  The 
only remaining fixer, fix_decimal_and_space_to_ascii (line 8839), does not.  (I 
think fix_decimal_and_space_to_ascii *should* add a touched flag, but until it 
does, the shortcut dedup code is dead.)

Also, around line 10502, there is an #if 0 section with code that relied on one 
of the removed fixers; is it time to remove that section?

--
nosy: +Jim.Jewett

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



[issue12409] Moving Documenting Python to Devguide

2012-01-12 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Sure, sorry I didn't make it before; here attached the 2 patches, one against 
devguide, the other to default cpython repo.

--
keywords: +patch
Added file: http://bugs.python.org/file24218/doc2devguide-devguide.patch

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



[issue12409] Moving Documenting Python to Devguide

2012-01-12 Thread Sandro Tosi

Changes by Sandro Tosi sandro.t...@gmail.com:


Added file: http://bugs.python.org/file24219/doc2devguide-cpython.patch

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



[issue2292] Missing *-unpacking generalizations

2012-01-12 Thread Zbyszek Szmek

Zbyszek Szmek zbys...@in.waw.pl added the comment:

#11682 will likely be merged. The part of this patch about yielding everything 
from an iterator becomes obsolete:
 def flatten(iterables):
...for it in iterables:
...  yield from it
... 
 L = [ [0,1,2], (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]
 list(flatten(L))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

The rest is of course still valid and useful.

--
nosy: +zbysz

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Zbyszek Szmek

Changes by Zbyszek Szmek zbys...@in.waw.pl:


--
hgrepos:  -66

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



[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Zbyszek Szmek

Zbyszek Szmek zbys...@in.waw.pl added the comment:

Some minor comments in http://bugs.python.org/review/11682/show.

--

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



[issue13777] socket: communicating with Mac OS X KEXT controls

2012-01-12 Thread Michael Goderbauer

New submission from Michael Goderbauer cont...@m-goderbauer.de:

Mac OS X provides a socket-based API to communicate with Kernel Extensions 
(KEXTs) called KEXT Controls. For this, Mac OS X defines PF_SYSTEM as a new 
socket domain which supports the SYSPROTO_CONTROL protocol.

Right now the PF_SYSTEM domain and the SYSPROTO_CONTROL protocol are not 
supported by Python's socket module. I am attaching a patch that introduces 
support for both.

More information on KEXT Controls can be found here:
http://developer.apple.com/library/mac/documentation/Darwin/Conceptual/NKEConceptual/control/control.html

--
components: Extension Modules
files: kext.patch
keywords: patch
messages: 151145
nosy: goderbauer
priority: normal
severity: normal
status: open
title: socket: communicating with Mac OS X KEXT controls
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file24220/kext.patch

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



[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic

2012-01-12 Thread Jan Kratochvil

Jan Kratochvil jan.kratoch...@redhat.com added the comment:

Here is the implementation.

Python/getargs.c was modified for:
ImportError: /usr/lib64/python2.7/lib-dynload/fcntlmodule.so: undefined symbol: 
_PyArg_ParseTuple_SizeT
but I guess that patch part should be different.  There is no need to do #ifdef 
HAVE_DECLSPEC_DLL as PyAPI_FUNC is properly defined even without it.  So the 
declaration+export block should be unified there.

The Modules/ files were modified for:
*** WARNING: renaming _ctypes_test since importing it failed: dynamic module 
does not define init function (init_ctypes_test)
*** WARNING: renaming _elementtree since importing it failed: dynamic module 
does not define init function (init_elementtree)
*** WARNING: renaming _hotshot since importing it failed: dynamic module does 
not define init function (init_hotshot)
*** WARNING: renaming _json since importing it failed: dynamic module does 
not define init function (init_json)
*** WARNING: renaming ossaudiodev since importing it failed: dynamic module 
does not define init function (initossaudiodev)

without this patch:
-rw-r--r-- 1 jkratoch jkratoch 5775829 Jan 12 17:42 
python-libs-2.7.2-18.fc17.x86_64.rpm
-r-xr-xr-x 1 jkratoch jkratoch 1738264 Jan 12 17:44 
./clean/python-libs-2.7.2-18.fc17.x86_64/usr/lib64/libpython2.7.so.1.0*
1226 libpython2.7.so.1.0 .dynsym exports
+
-rw-r--r-- 1 jkratoch jkratoch 1986161 Jan 12 17:48 
gdb-7.4.50.20120103-8.fc17.x86_64.rpm
-rwxr-xr-x 1 jkratoch jkratoch 5018800 Jan 12 19:13 
clean/gdb-7.4.50.20120103-8.fc17.x86_64/usr/bin/gdb*

with this patch:
-rw-r--r-- 1 jkratoch jkratoch 5762537 Jan 12 19:04 
python-libs-2.7.2-18hidden3.fc17.x86_64.rpm
-r-xr-xr-x 1 jkratoch jkratoch 1720920 Jan 12 19:06 
./hidden3/python-libs-2.7.2-18hidden3.fc17.x86_64/usr/lib64/libpython2.7.so.1.0*
1046 libpython2.7.so.1.0 .dynsym exports
+
-rw-r--r-- 1 jkratoch jkratoch 1886781 Jan 12 19:11 
gdb-7.4.50.20120103-8.fc17.x86_64.rpm
-rwxr-xr-x 1 jkratoch jkratoch 4732080 Jan 12 19:13 
hidden3/gdb-7.4.50.20120103-8.fc17.x86_64/usr/bin/gdb*

--
keywords: +patch
versions: +Python 2.7 -Python 3.2
Added file: http://bugs.python.org/file24221/hidden.patch

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



[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic

2012-01-12 Thread Meador Inge

Changes by Meador Inge mead...@gmail.com:


--
nosy: +meador.inge

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



[issue13775] Access Denied message on symlink creation misleading for an existing file/directory target.

2012-01-12 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I fail to see the bug. The output is correct, you are just misinterpreting it. 
It gives you the error code, error message, and original filename. It doesn't 
*actually* claim that the access to test is denied.

Now, changing the file in the message to the dest file doesn't really improve 
things. It fixes your case, but breaks cases involving problems with the source 
file.

So if any change is made, it should include both source and dest in the 
exception.

--
nosy: +loewis

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



[issue13777] socket: communicating with Mac OS X KEXT controls

2012-01-12 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +ned.deily, ronaldoussoren

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



[issue13709] Capitalization mistakes in the documentation for ctypes

2012-01-12 Thread Meador Inge

Changes by Meador Inge mead...@gmail.com:


--
components: +ctypes
nosy: +meador.inge
stage:  - needs patch
type:  - enhancement

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-12 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 I was scared by the note in the documentation and wondered if the
 socket Python API was completely incapable of handling half-closed
 connections cross platform.
[...]
 It makes it half-closed as it should

Indeed. Calling shutdown(SHUT_WR) doesn't close the other end (which doesn't 
make much sense), it just sends a FIN (or RST depending on the context). It's 
the other end which decides to return ENOTCONN upon shutdown(SHUT_RD) on OS X, 
which is questionable (not sure it's against the BSD socket API, since 
shutdown(SHUT_RD) doesn't have any counterpart in the TCP layer).

I also find this note confusing and scary for no good reason, and since I don't 
think we should document every OS idiosyncrasies, it would probably be better 
to revert it.

I'll leave this open for a couple days to see if anyone objects, otherwise I'll 
revert it.

--
resolution: accepted - 
status: closed - open

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



[issue11633] Document that print may need explicit flushing

2012-01-12 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 4a767054551b by Terry Jan Reedy in branch '3.2':
#11633 At least 2 people prefer earlier revision.
http://hg.python.org/cpython/rev/4a767054551b

New changeset 22688f5f9d0f by Terry Jan Reedy in branch 'default':
Merge #11633 At least 2 people prefer earlier revision.
http://hg.python.org/cpython/rev/22688f5f9d0f

--

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-12 Thread Nicolas Dumazet

Nicolas Dumazet nicd...@gmail.com added the comment:

 It's the other end which decides to return ENOTCONN upon shutdown(SHUT_RD) on 
 OS X, which is questionable
 (not sure it's against the BSD socket API, since shutdown(SHUT_RD) doesn't 
 have any counterpart in the TCP layer).

Exactly. The same code raises a socket.error in one platform (mac os) and not 
on another (linux). Why not document this questionable behavior?

I'm sorry, I realize that my original patch was imprecise. I'm not an expert 
here, and I simply read 
http://svn.python.org/view/python/trunk/Lib/test/test_socket.py?r1=64125r2=68611pathrev=68611
 . Ok, fine -- it doesn't close the other end per se, but shutdown(SH_RD) after 
a FIN on MacOS raises a socket.error . This is questionable, unexpected, and 
should be documented.


If possible, I'd like to push for a rewording instead of a revert.

--

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



[issue13763] rm obsolete reference in devguide

2012-01-12 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe tshep...@gmail.com added the comment:

On Thu, Jan 12, 2012 at 00:12, Sandro Tosi rep...@bugs.python.org wrote:

 Sandro Tosi sandro.t...@gmail.com added the comment:

 But we may explain what's behind: after the mercury chemical element symbol 
 - what do you think?

Good idea. That's actually what I thought it meant initially before
noticing it was (probably) left there accidentally.

--

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



[issue13763] rm obsolete reference in devguide

2012-01-12 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe tshep...@gmail.com added the comment:

 Ezio Melotti ezio.melo...@gmail.com added the comment:

 If 'program' refers to the executable, the sentence is still valid.

Interesting. It didn't appear like that until you mentioned it. It was
far more clear with subversion:svn than mercurial:hg. Sandro's
suggestion removes the ambiguity, although it would be kool to also
mention that it's also the program's name, since it seems to always be
used in that context.

--

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



[issue13748] Allow rb literals as an equivalent to br

2012-01-12 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset bbed36370b08 by Antoine Pitrou in branch 'default':
Issue #13748: Raw bytes literals can now be written with the `rb` prefix as 
well as `br`.
http://hg.python.org/cpython/rev/bbed36370b08

--
nosy: +python-dev

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



[issue13748] Allow rb literals as an equivalent to br

2012-01-12 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Committed, thanks.

--
resolution:  - fixed
stage: patch review - commit review
status: open - closed

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-12 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Okay, I like Matthew Barnett's idea of 

except SomeError [as e]:
raise as SomeOtherError('...')

This would require a change to the grammer as well, yes?  From:

raise_stmt: 'raise' [test ['from' test]]

to

raise_stmt: 'raise' [test ['from' test]] | 'raise' 'as' [test ['from' test]]

--

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-12 Thread Patrick Westerhoff

Patrick Westerhoff patrickwesterh...@gmail.com added the comment:

Yeah, I would really like that solution, especially as it separates from the 
`from X` syntax that sets the exception’s cause.

Also I would prefer a syntax solution over a class method simply because the 
exception context is something that is implicitely set by Python with the 
`raise` statement. So it would make sense to overwrite that behaviour with a 
syntax construct as well.

--

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



[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Patch version 6:

 - remove a debug code in dev_urandom() (did always raise an exception for 
testing)
 - dev_urandom() raises an exception if open() fails
 - os.urandom() uses again the right exception type and message (instead of a 
generic exception)
 - os.urandom() is not more linked to PYTHONHASHSEED
 - replace uint32_t by unsigned int in lcg_urandom() because Visual Studio 8 
doesn't provide this type. unsigned __int32 is available but I prefer to use 
a more common type. 32 or 64-bit types are supposed to generate the same 
sequence number (I didn't test).
 - fix more tests
 - regrtest.py restarts the process with PYTHONHASHSEED=randomseed if -r 
--randomseed=SEED is used
 - fix compilation on Windows (add random.c to the Visual Studio project file)

--
Added file: http://bugs.python.org/file24222/random-6.patch

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



[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I wrote bench_startup.py to measure the startup time on Windows. The precision 
of the script is quite bad because Windows timer has a bad resolution (e.g. 
15.6 ms on Windows 7) :-/

In release mode, the best startup time is 45.2 ms without random, 50.9 ms with 
random: an overhead of 5.6 ms (12%).

My script uses PYTHONHASHSEED=0 to disable the initialization of CryptoGen. You 
may modify the script to compare an unpatched Python with a patched Python for 
better numbers.

An overhead 12% is important. random-6.patch contains a faster (but also 
weaker) RNG on Windows, disable at compilation time. Search #if 1 at the end 
of random.c. It uses my linear congruential generator (LCG) initialized with 
gettimeofday() and getpid() (which are known to be weak) instead of CryptoGen. 
Using the LCG, the startup overhead is between 1 and 2%.

--
Added file: http://bugs.python.org/file24223/bench_startup.py

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



[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

SafeDict.py: with this solution, the hash of key has to be recomputed at each 
access to the dict (creation, get, set), the hash is not cached in the string 
object.

--

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



[issue13752] add a str.casefold() method

2012-01-12 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Patch for review.

--
keywords: +patch
title: add a unicode.casefold() method - add a str.casefold() method
Added file: http://bugs.python.org/file24224/casefolding.patch

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



[issue13629] _PyParser_TokenNames does not match up with the token.h numbers

2012-01-12 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Here is a patch that renumber the tokens.  I also regenerated token.py.

--
nosy: +georg.brandl
Added file: http://bugs.python.org/file24225/renumber-tokens.patch

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



[issue13746] ast.Tuple's have an inconsistent col_offset value

2012-01-12 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

I can reproduce this in tip as well:

 ast.dump(ast.parse('a = (1,2)'), include_attributes=True)
Module(body=[Assign(targets=[Name(id='a', ctx=Store(), lineno=1, 
col_offset=0)], value=Tuple(elts=[Num(n=1, lineno=1, col_offset=5), Num(n=2, 
lineno=1, col_offset=7)], ctx=Load(), lineno=1, col_offset=5), lineno=1, 
col_offset=0)])
 ast.dump(ast.parse('a = (1 + 2)'), include_attributes=True)
Module(body=[Assign(targets=[Name(id='a', ctx=Store(), lineno=1, 
col_offset=0)], value=BinOp(left=Num(n=1, lineno=1, col_offset=5), op=Add(), 
right=Num(n=2, lineno=1, col_offset=9), lineno=1, col_offset=5), lineno=1, 
col_offset=0)])

The actual column number is lost when calling into 'ast_for_testlist'
from the 'LPAR' case of 'ast_for_atom'.

--
nosy: +benjamin.peterson, meador.inge
stage:  - needs patch
versions: +Python 3.2, Python 3.3 -Python 2.6

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



[issue13752] add a str.casefold() method

2012-01-12 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


Added file: http://bugs.python.org/file24226/casefolding.patch

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