[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Okay, nevermind about non-normalized whitespaces in placeholder, but what about 
this case?

>>> text = "Hello there, how are you this fine day? I'm glad to hear it!"
>>> from textwrap import shorten
>>> shorten(text, 10, placeholder=" ")
'Hello'
>>> shorten(text, 9, placeholder=" ")
''
>>> len('Hello')
5

Isn't that weird?

--

___
Python tracker 

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



[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I'm not convinced this is a bug. The whitespace right-stripping is more of an 
implementation detail. You can really put what you want inside the placeholder.

--

___
Python tracker 

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



[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-12 Thread Vajrasky Kok

New submission from Vajrasky Kok:

In shorten function of textwrap module, the placeholder becomes a hole where we 
can inject non-normalized whitespaces to the text.

>>> text = "Hello there, how are you this fine day? I'm glad to hear it!"
>>> from textwrap import shorten
>>> shorten(text, 40, placeholder="  ")
'Hello there, how are you'

We normalize the only-whitespaces placeholder.

But

>>> shorten(text, 17, placeholder="  \n\t(...)  \n\t[...]  \n\t")
'(...)  \n\t[...]'
>>> shorten(text, 40, placeholder="  \n\t(...)  \n\t[...]  \n\t")
'Hello there, how  \n\t(...)  \n\t[...]'

Attached the patch to normalize the non-normalized whitespaces in placeholder.

--
components: Library (Lib)
files: fix_for_non_normalized_whitespaces_in_placeholder.patch
keywords: patch
messages: 195045
nosy: pitrou, vajrasky
priority: normal
severity: normal
status: open
title: shorten function of textwrap module is susceptible to non-normalized 
whitespaces
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file31271/fix_for_non_normalized_whitespaces_in_placeholder.patch

___
Python tracker 

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



[issue18721] test for FTP cwd function

2013-08-12 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Fixed in
6816ae6c49ce (2.7)
68b599740aa0 (3.3)
f8942b8e6774 (tip)

--
assignee:  -> orsenthil
nosy: +orsenthil
resolution:  -> fixed
status: open -> closed
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file31270/27.diff

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
versions: +Python 2.7, Python 3.3

___
Python tracker 

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



[issue17997] ssl.match_hostname(): sub string wildcard should not match IDNA prefix

2013-08-12 Thread Ben Darnell

Changes by Ben Darnell :


--
nosy: +Ben.Darnell

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Arun Babu Neelicattu

Arun Babu Neelicattu added the comment:

This issue has been assigned CVE-2013-4238 [1].

Please use CVE-2013-4238 for this issue in Python for patches and references.

[1] http://www.openwall.com/lists/oss-security/2013/08/13/2

--
nosy: +abn

___
Python tracker 

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



[issue18583] Idle: enhance FormatParagraph

2013-08-12 Thread R. Jayakrishnan

Changes by R. Jayakrishnan :


--
nosy: +JayKrish

___
Python tracker 

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



[issue18704] IDLE: PEP8 Style Check Integration

2013-08-12 Thread R. Jayakrishnan

Changes by R. Jayakrishnan :


--
nosy: +philwebster

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Alex Gaynor

Alex Gaynor added the comment:

The statistic that htis is *never* hit across a large python program is great 
evidence that this isn't useful. +1 on removing from me.

--

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Madison May

Madison May added the comment:

Or perhaps with an alternate wording: README_v4.diff

--
Added file: http://bugs.python.org/file31269/README_v4.diff

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Profiling the test suite shows that the short-cut branch NEVER gets taken.
There are no cases where the string lengths, kinds, and 64-bit hashes match, 
but the stings themselves are a mismatch.  The whole theory behind this 
optimization is invalid.  The first characters always match, so you don't need 
to test for them.

Alex, these things are very difficult to measure because the cost of a 100% 
predictable branch is also zero in a tight benchmark.  The negative effects of 
useless tests are subtle and indirect (i.e. blowing other useful things out of 
the branch prediction table).

Victor, thanks for link to 17628.  I will look at that further, but at first 
glance it looks like you're introducing a big wall of code right in the middle 
of a critical loop in code the is supposed to be in-lined.  It too smells of a 
false optimization and places far too much hope that memcmp, case-statements, 
and whatnot will behave awesomely will all compilers.

Unless you object, I'm going to go ahead and remove the bogus test.

--

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Madison May

Madison May added the comment:

Good point, Éric.

It refers readers to the bug tracker, the Sphinx bug tracker, and 
d...@python.org in the `Contributing` section, but a link to the devguide would 
probably be more useful.  I've tweaked the patch a bit to reflect this.

--
Added file: http://bugs.python.org/file31268/README_v3.diff

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Éric Araujo

Éric Araujo added the comment:

Thanks for the patch!  One thing: Doc/README.txt does not actually mention how 
to contribute to the doc, does it?  Maybe the main README should link to the 
devguide instead of or in addition to Doc/README.txt

--

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Madison May

Madison May added the comment:

Here's a patch that adds a short sentence to the README's `Documentation` 
section that refers readers to the Doc/README.txt file.

--
nosy: +madison.may
Added file: http://bugs.python.org/file31267/README_v2.diff

___
Python tracker 

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



[issue18583] Idle: enhance FormatParagraph

2013-08-12 Thread Phil Webster

Phil Webster added the comment:

I've attached a patch that attempts to address the issues above. For the tests, 
I made some changes because the cursor doesn't end in exactly the same spot 
with line endings.

Here's a quick summary of the changes:
1. Removed format_paragraph and format_comment methods because all text is 
treated the same and formatted in the event method. (The formatting code could 
be pulled out of the format_event method if needed.)

2. Added find_string_indices method to see if cursor is in string using the 
text widget's string tag. If the cursor is in a string, only the string lines 
are formatted. Before, if code immediately preceded or followed the string at 
the same indentation level, it was treated as part of the same paragraph.

3. If the text to be formatted ends with a triple quoted string on its own line 
(such as a docstring), the formatting code leaves the line alone.

4. If selection contains multiple paragraphs (separated by blank lines), it can 
format each one. Previously, only the first paragraph was formatted.

Once I have some feedback, I can thoroughly check all of the tests and make 
sure that we're getting the expected behavior.

--
keywords: +patch
Added file: http://bugs.python.org/file31266/18583enhancefp1.patch

___
Python tracker 

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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2013-08-12 Thread Eric Snow

Eric Snow added the comment:

I'm doing some string-based serialization of datetimes and need to be able to 
specify the type somewhat declaratively.  So I'm using a datetime subclass.  
This is more or less the code I'm using:


class Timestamp(datetime.datetime):

def __new__(cls, raw_value, *args, **kwargs):
if not args and not kwargs:
return cls.fromtimestamp(int(raw_value))
else:
return super(Timestamp, cls).__new__(cls, raw_value,
 *args, **kwargs)

def __str__(self):
return str(int(time.mktime(self.timetuple(


Incidently, the whole equality testing thing didn't actually cause a problem.  
It was comparing against the result of `datetime.utcnow()` which has 
microseconds (and my Timestamp instance didn't).  Clearing out the microseconds 
resolved the failure so I wasn't actually bitten by this issue after all.

--

___
Python tracker 

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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2013-08-12 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Eric,

Could you share details of your use-case?  My experience with subclassing from 
basic python types including date/time has been mostly negative.  The problem 
is that when I subclass, I want to inherit the rich set of operations such as 
+, -, *, etc., and add a few methods of my own.  After that, I want to always 
use instances of my subclass instead of the stdlib one.  This does not work 
because adding instances of my subclass returns an instance of the superclass 
unless I override __add__ explicitly. (See   #2267.)  This kills all benefits 
of subclassing as compared to containment.

These days I try to stay away from subclassing date/time, int/float, or 
anything like that and thus have little incentive to resolve this issue.  And 
it does not look like we have a workable solution.

--

___
Python tracker 

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



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8cf0f997dfa by Felix Crux in branch '3.3':
Documenting that json.load may raise a ValueError.
http://hg.python.org/cpython/rev/f8cf0f997dfa

New changeset 524693d62093 by Felix Crux in branch '2.7':
Documenting that json.load may raise a ValueError.
http://hg.python.org/cpython/rev/524693d62093

--

___
Python tracker 

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2013-08-12 Thread Ben Hoyt

Ben Hoyt added the comment:

All looks great. I like what you've done with default_encoding now. Thanks, Tim 
(and Dave for the original report).

--

___
Python tracker 

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



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-12 Thread David Wolever

Changes by David Wolever :


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



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f11683963558 by Felix Crux in branch 'default':
Documenting that json.load may raise a ValueError.
http://hg.python.org/cpython/rev/f11683963558

New changeset 905fad4cb40a by Felix Crux in branch 'default':
Documenting that json.load may raise a ValueError.
http://hg.python.org/cpython/rev/905fad4cb40a

New changeset 7ba77d77b499 by Felix Crux in branch 'default':
Documenting that json.load may raise a ValueError.
http://hg.python.org/cpython/rev/7ba77d77b499

--
nosy: +python-dev

___
Python tracker 

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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2013-08-12 Thread Eric Snow

Eric Snow added the comment:

This bit me today (under 2.7).

--
nosy: +eric.snow

___
Python tracker 

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



[issue18721] test for FTP cwd function

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue18721] test for FTP cwd function

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


--
keywords: +patch
Added file: http://bugs.python.org/file31265/issue18721.patch

___
Python tracker 

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



[issue18722] Remove uses of the register keyword

2013-08-12 Thread STINNER Victor

STINNER Victor added the comment:

+1 for removal of the register keyword.

I hope that nowadays, no compiler needs register hint to be able to optimize 
correctly a function. GCC knows better than me which variables must be 
"optimized".

--
nosy: +haypo

___
Python tracker 

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



[issue18722] Remove uses of the register keyword

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(amusingly, the two Python executables generated by gcc - with or without 
register - have exactly the same size, although their md5 hashes differ)

--

___
Python tracker 

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



[issue18722] Remove uses of the register keyword

2013-08-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +mark.dickinson, skrah

___
Python tracker 

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

Attaching updated patch answering Ethan's review. Also added a tiny sanity test 
that makes sure that AF_INET is indeed an enum. A more comprehensive test 
probably won't hurt for the final patch.

--
Added file: http://bugs.python.org/file31264/socket-intenum-af.2.patch

___
Python tracker 

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



[issue18722] Remove uses of the register keyword

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The benchmark suite doesn't show any significant speedup or slowdown generally:

Report on Linux fsol 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 
2013 x86_64 x86_64
Total CPU cores: 4

### django_v2 ###
Min: 0.672909 -> 0.659464: 1.02x faster
Avg: 0.673821 -> 0.660258: 1.02x faster
Significant (t=32.72)
Stddev: 0.00071 -> 0.00060: 1.1869x smaller

### fastunpickle ###
Min: 0.578535 -> 0.593218: 1.03x slower
Avg: 0.578700 -> 0.593440: 1.03x slower
Significant (t=-185.83)
Stddev: 0.00011 -> 0.00014: 1.1950x larger

### float ###
Min: 0.309679 -> 0.302615: 1.02x faster
Avg: 0.312457 -> 0.304713: 1.03x faster
Significant (t=4.33)
Stddev: 0.00326 -> 0.00232: 1.4039x smaller

### go ###
Min: 0.602035 -> 0.578129: 1.04x faster
Avg: 0.604634 -> 0.581584: 1.04x faster
Significant (t=12.50)
Stddev: 0.00253 -> 0.00325: 1.2855x larger

### nqueens ###
Min: 0.309602 -> 0.316767: 1.02x slower
Avg: 0.310222 -> 0.317734: 1.02x slower
Significant (t=-21.22)
Stddev: 0.00057 -> 0.00055: 1.0295x smaller

### richards ###
Min: 0.184306 -> 0.178887: 1.03x faster
Avg: 0.184969 -> 0.180215: 1.03x faster
Significant (t=8.40)
Stddev: 0.00076 -> 0.00101: 1.3380x larger

### silent_logging ###
Min: 0.080233 -> 0.073160: 1.10x faster
Avg: 0.080594 -> 0.073170: 1.10x faster
Significant (t=69.28)
Stddev: 0.00024 -> 0.1: 21.7820x smaller

### threaded_count ###
Min: 0.234882 -> 0.226954: 1.03x faster
Avg: 0.241049 -> 0.231458: 1.04x faster
Significant (t=3.04)
Stddev: 0.00567 -> 0.00420: 1.3519x smaller

### unpack_sequence ###
Min: 0.46 -> 0.48: 1.05x slower
Avg: 0.46 -> 0.49: 1.06x slower
Significant (t=-299.85)
Stddev: 0.0 -> 0.0: 1.0256x larger

The following not significant results are hidden, use -v to show them:
call_method, call_method_slots, call_method_unknown, call_simple, chaos, 
fannkuch, fastpickle, formatted_logging, iterative_count, json_dump_v2, 
json_load, meteor_contest, nbody, normal_startup, pathlib, pidigits, raytrace, 
regex_compile, regex_effbot, regex_v8, simple_logging, spectral_norm, 
startup_nosite, telco.

--

___
Python tracker 

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



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-12 Thread Felix Crux

Felix Crux added the comment:

Working with wolever on the process, generated the attached patch.

--
keywords: +patch
nosy: +felixc, wolever
Added file: http://bugs.python.org/file31263/18680.patch

___
Python tracker 

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



[issue18722] Remove uses of the register keyword

2013-08-12 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Attached patch removes all uses of the C "register" keyword in the CPython 
sources.

--
components: Interpreter Core
files: remove_register.patch
keywords: patch
messages: 195024
nosy: pitrou
priority: low
severity: normal
stage: patch review
status: open
title: Remove uses of the register keyword
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31262/remove_register.patch

___
Python tracker 

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



[issue18721] test for FTP cwd function

2013-08-12 Thread Muhammad Jehanzeb

New submission from Muhammad Jehanzeb:

Test coverage for cwd function of ftplib directory.

--
components: Tests
messages: 195023
nosy: mjehanzeb
priority: normal
severity: normal
status: open
title: test for FTP cwd function
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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Benjamin Peterson

Benjamin Peterson added the comment:

No, this extra code you're adding. :)

2013/8/12 Benjamin Peterson :
>
> Benjamin Peterson added the comment:
>
> Okay. Hopefully, we can kill that thing one day...
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about a multiline summarize? The textwrap module is designed to work with 
multiline text.

Let we want wrap 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed 
do eiusmod tempor incididunt ut labore et dolore magna aliqua.' in 40 column 
and shorten it to three lines:

Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore (...)

For this we need to add two arguments for TextWrapper: max_lines and 
placeholder. Then shorten() will be just fill() with max_lines=1.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue17701] Improving strftime documentation

2013-08-12 Thread David Wolever

David Wolever added the comment:

Done, pushed to 2.7, 3.3, default.

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



[issue17701] Improving strftime documentation

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1d4b02d8fa8a by David Wolever in branch '3.3':
Issue #17701: Improving strftime documentation.
http://hg.python.org/cpython/rev/1d4b02d8fa8a

New changeset ab550dac6209 by David Wolever in branch 'default':
Merge issue #17701: Improving strftime documentation.
http://hg.python.org/cpython/rev/ab550dac6209

--

___
Python tracker 

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-12 Thread Eli Bendersky

New submission from Eli Bendersky:

As part of original plan and since issue #18264 has been resolved, it's time to 
dust off some old patches I have for the socket.* module. The socket.AF_* and 
socket.SOCK_* constants are good candidates for IntEnum conversion.

I'm attaching an initial patch that handles socket.AF_* (as a proof-of-concept; 
socket.SOCK_* should get identical treatment); it only touches Lib/socket.py 
and all regrtest tests pass without changes. Result:

>>> import socket
>>> socket.AF_INET

>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.family

>>> '{}'.format(s.family)
'AddressFamily.AF_INET'

The code in the patch is pretty well commented, and I also want to point out a 
couple of decision points that came up:

1. The underlying socketmodule.c has no idea of IntEnums, and neither IMHO it 
should. These constants are essentially one-way, going from Python into C. They 
are only exposed back through read-only accessors (e.g. s.family above), at 
which point the Python code can wrap them back into the enum. The alternative, 
making socketmodule.c use enums is probably way more complicated than really 
necessary.
2. As a followup to (1), the constants are actually wrapped into an IntEnum at 
the Python level and exposed back to the user. My hacking of globals() there 
may be a bit rough - suggestions for a better way are welcome.
3. A bunch of AF_* constants exported by Python built on my x64 Ubuntu are not 
documented in socket.rst; I'm still wrapping them all in enums; I basically 
went over all PyModule_AddIntMacro(m, AF_*) in PyInit__socket.

PTAL

--
assignee: eli.bendersky
components: Library (Lib)
files: socket-intenum-af.1.patch
keywords: patch
messages: 195018
nosy: barry, eli.bendersky, ethan.furman, gvanrossum, ncoghlan, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Switch suitable constants in the socket module to IntEnum
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31261/socket-intenum-af.1.patch

___
Python tracker 

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



[issue18718] datetime documentation contradictory on leap second support

2013-08-12 Thread David Wolever

David Wolever added the comment:

Here's the relevant diff. Will commit on a +1.

diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -1664,7 +1664,7 @@
 | ``%M``| Minute as a zero-padded| 00, 01, ..., 59|   |
 |   | decimal number.||   |
 +---+++---+
-| ``%S``| Second as a zero-padded| 00, 01, ..., 61| \(3)  |
+| ``%S``| Second as a zero-padded| 00, 01, ..., 59| \(3)  |
 |   | decimal number.||   |
 +---+++---+
 | ``%f``| Microsecond as a decimal   | 00, 01, ...,   | \(4)  |
@@ -1728,12 +1728,8 @@
the output hour field if the ``%I`` directive is used to parse the hour.
 
 (3)
-   The range really is ``0`` to ``61``; according to the Posix standard this
-   accounts for leap seconds and the (very rare) double leap seconds.
-   The :mod:`time` module may produce and does accept leap seconds since
-   it is based on the Posix standard, but the :mod:`datetime` module
-   does not accept leap seconds in :meth:`strptime` input nor will it
-   produce them in :func:`strftime` output.
+   Unlike the :mod:`time` module, the :mod:`datetime` module does not support
+   leap seconds.
 
 (4)
``%f`` is an extension to the set of format characters in the C standard

--

___
Python tracker 

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2013-08-12 Thread Tim Golden

Tim Golden added the comment:

Thanks for the review, Ben. Updated patches attached.

1 & 3) default_encoding -- Your two points appear to contradict each 
other slightly. What's in the updated patches is: 3.x has no encoding 
(because everything's unicode end-to-end); 2.7 attempts to apply the 
default encoding -- which is probably ascii -- to the extension and the 
mimetype and continues on error. I'm not 100% sure about this because it 
seems possible if unlikely to have a non-ascii extension / mimetype, but 
this seems like the best compromise (and is no worse than what was there 
before). Does that seem to fit the bill?

2) subkeyname[0] -- done

4) "throws EnvironmentError" -- done

5) test for .png -- done

--
Added file: http://bugs.python.org/file31259/issue15207.27.2.patch
Added file: http://bugs.python.org/file31260/issue15207.33.2.patch

___
Python tracker 

___diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst
--- a/Doc/library/mimetypes.rst
+++ b/Doc/library/mimetypes.rst
@@ -85,6 +85,9 @@
:const:`knownfiles` takes precedence over those named before it.  Calling
:func:`init` repeatedly is allowed.
 
+   Specifying an empty list for *files* will prevent the system defaults from
+   being applied: only the well-known values will be present from a built-in 
list.
+
.. versionchanged:: 2.7
   Previously, Windows registry settings were ignored.
 
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -254,23 +254,26 @@
 i += 1
 
 default_encoding = sys.getdefaultencoding()
-with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
- r'MIME\Database\Content Type') as mimedb:
-for ctype in enum_types(mimedb):
+with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr:
+for subkeyname in enum_types(hkcr):
 try:
-with _winreg.OpenKey(mimedb, ctype) as key:
-suffix, datatype = _winreg.QueryValueEx(key,
-'Extension')
+with _winreg.OpenKey(hkcr, subkeyname) as subkey:
+# Only check file extensions
+if not subkeyname.startswith("."):
+continue
+# raises EnvironmentError if no 'Content Type' value
+mimetype, datatype = _winreg.QueryValueEx(
+subkey, 'Content Type')
+if datatype != _winreg.REG_SZ:
+continue
+try:
+mimetype = mimetype.encode(default_encoding)
+subkeyname = subkeyname.encode(default_encoding)
+except UnicodeEncodeError:
+continue
+self.add_type(mimetype, subkeyname, strict)
 except EnvironmentError:
 continue
-if datatype != _winreg.REG_SZ:
-continue
-try:
-suffix = suffix.encode(default_encoding) # omit in 3.x!
-except UnicodeEncodeError:
-continue
-self.add_type(ctype, suffix, strict)
-
 
 def guess_type(url, strict=True):
 """Guess the type of a file based on its URL.
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -85,6 +85,8 @@
 # Use file types that should *always* exist:
 eq = self.assertEqual
 eq(self.db.guess_type("foo.txt"), ("text/plain", None))
+eq(self.db.guess_type("image.jpg"), ("image/jpeg", None))
+eq(self.db.guess_type("image.png"), ("image/png", None))
 
 def test_main():
 test_support.run_unittest(MimeTypesTestCase,
diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst
--- a/Doc/library/mimetypes.rst
+++ b/Doc/library/mimetypes.rst
@@ -85,6 +85,9 @@
:const:`knownfiles` takes precedence over those named before it.  Calling
:func:`init` repeatedly is allowed.
 
+   Specifying an empty list for *files* will prevent the system defaults from
+   being applied: only the well-known values will be present from a built-in 
list.
+
.. versionchanged:: 3.2
   Previously, Windows registry settings were ignored.
 
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -249,19 +249,21 @@
 yield ctype
 i += 1
 
-with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
- r'MIME\Database\Content Type') as mimedb:
-for ctype in enum_types(mimedb):
+with _winreg.OpenKey(_winreg.HKEY_

[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread STINNER Victor

STINNER Victor added the comment:

See also issues #16286 and #17628.

--

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Alex Gaynor

Alex Gaynor added the comment:

does this show demonstrable results (in either direction) on stringbench or the 
benchmarks repo?

--
nosy: +alex

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo, serhiy.storchaka

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c27ec198d3d1 by Antoine Pitrou in branch 'default':
Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a piece of 
text to a given length.
http://hg.python.org/cpython/rev/c27ec198d3d1

--
nosy: +python-dev

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
status: open -> closed

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I've committed after having addressed (most of) RDM's comments.

--
resolution:  -> fixed
stage: patch review -> committed/rejected

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Raymond Hettinger

New submission from Raymond Hettinger:

This code is only run when the kinds, lengths, and hashes match.  So, the 
probability of the strings being equal is VERY high.  Accordingly, there is no 
benefit to an earlier out test to see if the first characters differ.

There is a modest benefit to comparing one-character strings, but that comes at 
the expense of of testing all other string lengths.

This code is on the critical path for dicts and sets, so we don't want to slow 
it down with false optimizations or optimizations of special cases that come at 
the expense of the common, general case.

--
keywords: +patch
Added file: http://bugs.python.org/file31258/eq_optimization.diff

___
Python tracker 

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

On Mon, Aug 12, 2013 at 1:33 PM, Eli Bendersky wrote:

>
> Eli Bendersky added the comment:
>
> On Mon, Aug 12, 2013 at 12:41 PM, Serhiy Storchaka
> wrote:
>
> >
> > Serhiy Storchaka added the comment:
> >
> > Here is a preliminary patch which get rids of
> > _convert_namespace_to_getopt() and directly uses a Namespace object.
> > Unfortunately it breaks tests because test_regrtest depends on
> > implementation details of the regrtest module and uses
> > _convert_namespace_to_getopt(). If the proposed patch is good enough I
> will
> > try to write suitable tests.
> >
>
> If test_regrtest is the only test broken by this, it doesn't like a major
> problem.
>

Something is wrong with the part of my brain that deals with grammar today;
sorry! What I mean to say, in case it's not obvious - is that if this
change breaks no tests except the one that specifically tests regrtest
itself, I don't think there's a reason to worry. test_regrtest can (and
should) be changed not to rely on internals of the module-under-test.

--

___
Python tracker 

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



[issue18719] Remove false optimizaton for equality comparison of hashed strings

2013-08-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
components: Interpreter Core
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Remove false optimizaton for equality comparison of hashed strings
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



[issue16799] start using argparse.Namespace in regrtest

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

On Mon, Aug 12, 2013 at 12:41 PM, Serhiy Storchaka
wrote:

>
> Serhiy Storchaka added the comment:
>
> Here is a preliminary patch which get rids of
> _convert_namespace_to_getopt() and directly uses a Namespace object.
> Unfortunately it breaks tests because test_regrtest depends on
> implementation details of the regrtest module and uses
> _convert_namespace_to_getopt(). If the proposed patch is good enough I will
> try to write suitable tests.
>

If test_regrtest is the only test broken by this, it doesn't like a major
problem.

--

___
Python tracker 

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



[issue18718] datetime documentation contradictory on leap second support

2013-08-12 Thread David Wolever

New submission from David Wolever:

The documentation for the `%S` formatter suggests that it supports leap 
seconds, but the footnote contradicts that:

> The range really is 0 to 61; according to the Posix standard this
> accounts for leap seconds and the (very rare) double leap seconds.
> The time module may produce and does accept leap seconds since it is
> based on the Posix standard, but the datetime module does not accept
> leap seconds in strptime() input nor will it produce them in
> strftime() output.

I propose that the documentation be updated to mirror the 3.X documentation: no 
leap second in the example and a footnote which makes note of that and suggests 
using the time module.

--
assignee: wolever
messages: 195008
nosy: wolever
priority: normal
severity: normal
status: open
title: datetime documentation contradictory on leap second support
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



[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue18715] Tests fail when run with coverage

2013-08-12 Thread Ned Deily

Ned Deily added the comment:

Please upload the test results as file attachment(s) to this issue.  Files 
stored elsewhere may disappear.

--
nosy: +ned.deily

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Yes, I think it would make sense to fix the docs as well, at least for Python 
3.4.  Probably not worth it for the maintenance releases.

--

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch addressing Ezio's comments.

--
Added file: http://bugs.python.org/file31257/shorten2.patch

___
Python tracker 

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



[issue18699] What is Future.running() for in PEP 3148 / concurrent.futures.Future?

2013-08-12 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Oscar Benjamin

Oscar Benjamin added the comment:

On 12 August 2013 20:20, Steven D'Aprano  wrote:
> On 12/08/13 19:21, Mark Dickinson wrote:
>> About the implementation of sum:
> add_partial is no longer documented as a public function, so I'm open to 
> switching algorithms in the future.

Along similar lines it might be good to remove the doc-test for using
decimal.ROUND_DOWN. I can't see any good reason for anyone to want
that behaviour when e.g. computing the mean() whereas I can see
reasons for wanting to reduce rounding error for decimal in
statistics.sum. It might be a good idea not to tie yourself to the
guarantee implied by that test.

I tried an alternative implementation of sum() that can also reduce
rounding error with decimals but it failed that test (by making the
result more accurate). Here's the sum() I wrote:

def sum(data, start=0):

if not isinstance(start, numbers.Number):
raise TypeError('sum only accepts numbers')

inexact_types = (float, complex, decimal.Decimal)
def isexact(num):
return not isinstance(num, inexact_types)

if isexact(start):
exact_total, inexact_total = start, 0
else:
exact_total, inexact_total = 0, start

carrybits = 0

for x in data:
if isexact(x):
exact_total = exact_total + x
else:
new_inexact_total = inexact_total + (x + carrybits)
carrybits = -(((new_inexact_total - inexact_total) - x) - carrybits)
inexact_total = new_inexact_total

return (exact_total + inexact_total) + carrybits

It is more accurate for e.g. the following:
nums = [decimal.Decimal(10 ** n) for n in range(50)]
nums += [-n for n in reversed(nums)]
assert sum(nums) == 0

However there will also be other situations where it is less accurate such as
print(sum([-1e30, +1e60, 1, 3, -1e60, 1e30]))
so it may not be suitable as-is.

--

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


Removed file: http://bugs.python.org/file31255/mywork.patch

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Muhammad Jehanzeb added the comment:

included issue# in the patch file

--
Added file: http://bugs.python.org/file31256/issue18717.patch

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Ezio Melotti

Ezio Melotti added the comment:

+1

--
type:  -> enhancement
versions: +Python 2.7, Python 3.3

___
Python tracker 

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



[issue17701] Improving strftime documentation

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset adbc9789a5e4 by David Wolever in branch '2.7':
Issue #17701: Improving strftime documentation
http://hg.python.org/cpython/rev/adbc9789a5e4

--
nosy: +python-dev

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


Removed file: http://bugs.python.org/file31253/test_urllib.py

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Muhammad Jehanzeb added the comment:

the patch fie

--
keywords: +patch
Added file: http://bugs.python.org/file31255/mywork.patch

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We can use type(a).__index__(a). Should we also correct the documentation for 
operator.index() and operator.length_hint()?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a preliminary patch which get rids of _convert_namespace_to_getopt() 
and directly uses a Namespace object. Unfortunately it breaks tests because 
test_regrtest depends on implementation details of the regrtest module and uses 
_convert_namespace_to_getopt(). If the proposed patch is good enough I will try 
to write suitable tests.

--
Added file: http://bugs.python.org/file31254/regrtest_argparse.patch

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Ezio Melotti

Ezio Melotti added the comment:

Thanks for your contribution.  Can you submit this as a diff?

--
nosy: +ezio.melotti
stage:  -> patch review

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

New submission from Muhammad Jehanzeb:

As part of pyconca sprints, this is my first patch for urlcleanup test

--
components: Tests
files: test_urllib.py
messages: 194996
nosy: mjehanzeb
priority: normal
severity: normal
status: open
title: test for request.urlretrieve
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31253/test_urllib.py

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

+1

--
nosy: +larry

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18689] add argument for formatter to logging.Handler and subclasses in logging module

2013-08-12 Thread Vinay Sajip

Vinay Sajip added the comment:

> If 3rd party handlers are intelligent

It's not an ideal world. Sorry, but I think this change is too invasive to 
consider. I can't believe this change is really needed - logging has been 
around since 2002 and this has never been raised before.

--
status: open -> closed

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Okay, that works.  I agree that not documenting add_partial is probably a good 
plan.

--

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 12/08/13 19:21, Mark Dickinson wrote:

> About the implementation of sum: it's worth noting that the algorithm you're 
> using for floats depends on correct rounding of addition and subtraction, and 
> that that's not guaranteed.
[...]
> Steven: any thoughts about how to deal with this?  Options are (1) just 
> ignore the problem and hope no-one runs into it, (2) document it / warn about 
> it, (3) try to fix it.  Fixing it would be reasonably easy for a C 
> implementation (with access to the FPU control word, in the same way that our 
> float<->string conversion already does), but not so easy in Python without 
> switching algorithm altogether.

Document it and hope :-)

add_partial is no longer documented as a public function, so I'm open to 
switching algorithms in the future.

--

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Kill what thing?  The review link?  I love that thing?

Anyway, we did get a review link, hoopla!

--

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Éric Araujo

Éric Araujo added the comment:

There is a README in the Doc directory.  Wouldn’t it be enough to point to that 
file from the main README?

--

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch renaming summarize() to shorten(), and adding docs and a fix for 
a nit reported by Vajrasky.

--
Added file: http://bugs.python.org/file31250/shorten.patch

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Brett Cannon

New submission from Brett Cannon:

Turns out the formatter module isn't really used by anyone. Pydoc uses it, but 
it could easily use textwrap. Searching on Github shows a usage by someone who 
simply re-exposes it as part of their own public API but has no actual usage 
themselves 
(https://github.com/search?q=%22import+formatter%22&ref=searchresults&type=Code 
and 
https://github.com/search?q=%22from+formatter%22&type=Code&ref=searchresults) . 
A Google search only turns up references in books 
(https://www.google.ca/search?{google:acceptedSuggestion}oq=%22import+formatter%22&{google:instantFieldTrialGroupParameter}sourceid=chrome&ie=UTF-8&q=%22import+formatter%22&qscrl=1#bav=on.2,or.r_cp.r_qf.&fp=7bfd11bde90d01cb&q=%22import+formatter%22+OR+%22from+formatter%22&qscrl=1).

The attached patch deprecated formatter for removal in Python 3.6.

--
components: Library (Lib)
files: deprecate_formatter.diff
keywords: patch
messages: 194989
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Deprecate the formatter module
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file31252/deprecate_formatter.diff

___
Python tracker 

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



[issue18714] Add tests for pdb.find_function

2013-08-12 Thread Kevin Jing Qiu

Changes by Kevin Jing Qiu :


--
keywords: +patch
Added file: http://bugs.python.org/file31251/mywork.patch

___
Python tracker 

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



[issue18715] Tests fail when run with coverage

2013-08-12 Thread Seydou Dia

New submission from Seydou Dia:

When I run the tests suit with coverage (e.g, ./python COVERAGEDIR run --pylib 
Lib/test/regrtest.py test_frame), the following tests fails:

 * test_frame
 * test_xml_etree
 * test_threading_local
 * test_super
 * test_importlib

 The tracebacks are available here : http://pastebin.com/j6ScCibV

--
components: Tests
messages: 194988
nosy: seydou
priority: normal
severity: normal
status: open
title: Tests fail when run with coverage
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



[issue18714] Add tests for pdb.find_function

2013-08-12 Thread Kevin Jing Qiu

New submission from Kevin Jing Qiu:

PyConCA 2013 sprint task

--
components: Tests
messages: 194986
nosy: Kevin.Jing.Qiu
priority: normal
severity: normal
status: open
title: Add tests for pdb.find_function
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-08-12 Thread Jason R. Coombs

Jason R. Coombs added the comment:

My sense on the issue is that wintypes was added to the library and was never 
intended to raise a ValueError on import. By that logic, the behavior is a bug, 
not a new feature. I agree with Ezio that raising a ValueError on import is a 
bug. And since the patch not only addresses the ValueError on import, but 
simply addresses the underlying cause, it seems to me the most obvious solution.

--

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 09/08/13 21:49, Oscar Benjamin wrote:

> I think that the argument `m` to variance, pvariance, stdev and pstdev
> should be renamed to `mu` for pvariance/pstdev and `xbar` for
> variance/stdev. The doc-strings should carefully distinguish that `mu`
> is the true/population mean and `xbar` is the estimated/sample mean
> and refer to this difference between the function variants.

Good thinking, and I agree.

--

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Okay. Hopefully, we can kill that thing one day...

--

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Attached is an updated patch, this time for 3.3.  (So I'm guessing we won't get 
a "review" link.)  It incorporates Benjamin's two comments.

--
Added file: http://bugs.python.org/file31249/larry.setxattr.zfs.3.3.patch.1.txt

___
Python tracker 

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



[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hey Catherine,
Do you want to update your patch to include Vajrasky's suggestion?

--

___
Python tracker 

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



[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-12 Thread Madison May

Madison May added the comment:

I ran into a similar issue (see #18700) with test_cgi.

``/home/mmay/cpython/Lib/test/test_cgi.py:276: ResourceWarning: unclosed file 
<_io.BufferedRandom name=3>``

--
nosy: +madison.may

___
Python tracker 

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



[issue18700] test_cgi raises ResourceWarning

2013-08-12 Thread Madison May

Madison May added the comment:

Good catch, Vajrasky.  I'll close the issue and add my brief report to bug 
#18394.

--
status: open -> closed

___
Python tracker 

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



[issue18416] Move to absolute file paths for module.__file__

2013-08-12 Thread Madison May

Changes by Madison May :


Added file: http://bugs.python.org/file31248/Issue18416_v2.patch

___
Python tracker 

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



[issue18416] Move to absolute file paths for module.__file__

2013-08-12 Thread Madison May

Madison May added the comment:

Here's a minor revision to that patch removing an unnecessary 
@skip_if_dont_write_bytecode decorator from the test I added to test_import.py. 
 

No docs changes are included in the current patch -- I'm guessing this should 
probably wait until we have all the other details ironed out.

--

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Fixed in 3.3 and trunk.  Thanks for the report!

--
assignee:  -> larry
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92de1a5dc3ea by Larry Hastings in branch 'default':
Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
http://hg.python.org/cpython/rev/92de1a5dc3ea

--

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a89226508a04 by Larry Hastings in branch '3.3':
Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
http://hg.python.org/cpython/rev/a89226508a04

--
nosy: +python-dev

___
Python tracker 

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



[issue12837] Patch for issue #12810 removed a valid check on socket ancillary data

2013-08-12 Thread Brett Cannon

Brett Cannon added the comment:

This is still a warning and so I'm still looking for a solution.

--

___
Python tracker 

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



[issue18598] Importlib, more verbosity please

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue18598] Importlib, more verbosity please

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2294594fbe6c by Brett Cannon in branch 'default':
Closes issue #18598: Have the exception message for
http://hg.python.org/cpython/rev/2294594fbe6c

--
nosy: +python-dev

___
Python tracker 

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



[issue18578] Rename and document test.bytecode_helper as test.support.bytecode_helper

2013-08-12 Thread Seydou Dia

Seydou Dia added the comment:

I have a hard time figuring out what exactly BytecodeTestCase methods actually 
do. Thus the documentation is not probably accurate.

--
keywords: +patch
Added file: http://bugs.python.org/file31247/issue-18578.diff

___
Python tracker 

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



[issue18689] add argument for formatter to logging.Handler and subclasses in logging module

2013-08-12 Thread Derek Wilson

Derek Wilson added the comment:

dictConfig and fileConfig are nice for static needs, but when I want to quickly 
enable a complex (but not complicated) logging flow I find it just as tedious 
as the current situation with the direct API.

> ... as at the very least every handler would need to be changed to 
> accommodate the new kwarg

Adding a keyword only argument to the base handler and the other handler 
classes is a nearly trivial change in terms of lines and complexity of the code.

> Also, this isn't going to work for third-party handlers which are out there 
> already, since they won't necessarily recognise a new kwarg.

I don't see that as a problem. If 3rd party handlers are intelligent then they 
will include **kargs in their __init__ and pass that forward to the 
initialization of their parent. If they haven't done so then nothing changes 
for them and they just support exactly the same features they supported 
previously.

--
status: pending -> open

___
Python tracker 

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



  1   2   >