[issue18772] Fix gdb plugin for new sets dummy object

2013-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> In other words, we're paying a price for the dummy object being
> printable as a string.

Which is pointless, I agree.

> Antoine, thanks to the link to the python-dev discussion.  I hope we
> can come with a solution that doesn't involve going back to unicode
> objects.

Re-using PyDict's dummy object would be a solution, AFAICT?

--

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> In addition to being a pain at the interactive prompt

Just type "pr" and the "print(" call will be auto-completed.
(with TAB-completion being enabled by default in 3.4 ;-))

> the change of print from a statement to a function has also been noted 
> as one of the biggest problems with compatibility of third party user
> scripts for Linux distros changing the default system Python to Python 3

Well, I know 2to3 has had some bad press recently, but it should still make it 
a piece of cake to convert such small scripts.
(since you don't need to keep 2.x compatibility for them)

--
nosy: +pitrou

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Peter Otten

Peter Otten added the comment:

> a bare expression is not call

Wouldn't that silently swallow a lot of bare

print

statements?

--
nosy: +peter.otten

___
Python tracker 

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



[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PyErr_SetFromErrno(PyExc_OSError) looks more appropriate for permission denied 
error. However this change is backward incompatible so perhaps we have to left 
a KeyError.

--
nosy: +loewis, serhiy.storchaka
stage:  -> test needed

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Ambiguous cases (such as "expr * expr" and "expr ** expr") obey the rule that 
> implicit calls are very *low* precedence, so you have to use parens to force 
> the call interpretation.

Does "a + b c" mean "(a + b)(c)"? Does "a + b (c)" mean "(a + b)((c))"?

What does "a (b, c)" mean? "a.__call__(b, c)" or "a.__call__((b, c))"?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18783] No more refer to Python "long"

2013-08-20 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Attached the patch to accomodate Serhiy Storchaka's suggestion by using 
KeyError exception for backward compatibility.

--
Added file: http://bugs.python.org/file31382/fix_error_message_getspnam_v2.patch

___
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-20 Thread Mark Dickinson

Mark Dickinson added the comment:

I agree with Oscar about sum for decimal.Decimal.  The *ideal* sum for Decimal 
instances would return the correctly rounded result (i.e., the exact result, 
rounded to the current context just once using the current rounding mode).  It 
seems wrong to give a guarantee of behaviour that's in conflict with this ideal.

IEEE 754 recommends a 'sum' operation (in section 9.4, amongst other reduction 
operations), but doesn't go so far as to either require or recommend that the 
result be correctly rounded.  Instead, it says "Implementations may associate 
in any order or evaluate in any wider format.", and then later on, "Numerical 
results [...] may differ among implementations due to the precision of 
intermediates and the order of evaluation."  It certainly *doesn't* specify 
that the results should be as though the context precision and rounding mode 
were used for every individual addition.

--

___
Python tracker 

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



[issue17087] Improve the repr for regular expression match objects

2013-08-20 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Here's my patch attempt. The repr of a match object has the following format:
(groups=\d+, span=(start, end), group0=the entire group or the first X 
characters, where X is represented by a new constant in sre_constants.h, 
SRE_MATCH_REPR_SIZE).

--
keywords: +patch
nosy: +Claudiu.Popa
Added file: http://bugs.python.org/file31383/sre.patch

___
Python tracker 

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



[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It was not a suggestion, it was a doubt.

See also issue10388.

--
nosy: +akuchling

___
Python tracker 

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



[issue10388] spwd returning different value depending on privileges

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue18787.

--
nosy: +akuchling, loewis, serhiy.storchaka
versions: +Python 3.3, Python 3.4 -Python 3.1, Python 3.2

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Nick Coghlan

Nick Coghlan added the comment:

As Serhiy's examples show, the ambiguities this introduces get confusing fast. 
A more constrained version that (for example) permitted only name references 
for the callable could resolve that, but it's probably still a bad idea. Still, 
interesting to know it is *technically* possible, if anyone decides to pursue 
it further :)

The "silently ignores bare print statements" aspect isn't new - Python 3 
already behaves that way, since a print on its own line now just references the 
builtin without calling it.

--
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue17087] Improve the repr for regular expression match objects

2013-08-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage: needs patch -> patch review

___
Python tracker 

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



[issue18789] XML Vunerability Table Unclear

2013-08-20 Thread Joe Tennies

New submission from Joe Tennies:

EASY

This is an issue with the 2.x and 3.x documentation.

http://docs.python.org/3.2/library/xml.html#xml-vulnerabilities
http://docs.python.org/dev/library/xml.html#xml-vulnerabilities
http://docs.python.org/2/library/xml.html#xml-vulnerabilities

This section has a table with a bunch of Trues and Falses. This is a bit 
confusing, especially for something that is trying to describe security 
concerns. After looking at the table, I'm pretty sure that True means vunerable 
(only due to the (1), (2), & (3) comments), but it's not clear. All that is 
needed is a heading stating "Vunerable", or change the "True" to "Vunerable" 
and "False" to "Not Vunerable" (probably V and NV w/ a legend).

--
assignee: docs@python
components: Documentation
messages: 195691
nosy: docs@python, joe-tennies
priority: normal
severity: normal
status: open
title: XML Vunerability Table Unclear
type: security
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue18789] XML Vunerability Table Unclear

2013-08-20 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue10388] spwd returning different value depending on privileges

2013-08-20 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Attached the patch to raise OSError instead of returning empty list if a normal 
user uses getspall function of spwd module.

I investigated about this issue. There exists situation where /etc/shadow file 
does not exist:
https://bugs.kde.org/show_bug.cgi?id=117202
https://dev.openwrt.org/ticket/2887

So I think it is better to differentiate the result of the function where a 
normal user trying to access /etc/shadow file (permission denied, therefore 
should raise exception) or root user trying to access non-existent /etc/shadow 
file (therefore should get empty list).

--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file31384/fix_error_message_getspall.patch

___
Python tracker 

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



[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Sorry about that.

Okay, so for now, we wait for other people's suggestion, which way we should 
use to handle this situation?

--

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I like a parens-less call syntax, but it is unpythonic and even anti-pythonic. 
It can be good in some other language (like Forth or Tcl, may be Perl or Ruby) 
but not in Python. It requires some other coordinated features (a syntax to 
obtaining a reference to a function/method, perhaps shorter syntax for lambdas, 
braced blocks, different scoping and binding rules) and different philosophy. 
It doesn't quack as Python.

--

___
Python tracker 

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



[issue18789] XML Vunerability Table Unclear

2013-08-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +XML
versions:  -Python 3.2, Python 3.5

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Ramchandra Apte

Ramchandra Apte added the comment:

I do not see much use of of implicit call syntax, a good editor will 
autocomplete the brackets.

--
nosy: +Ramchandra Apte

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue8865] select.poll is not thread safe

2013-08-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: gregory.p.smith -> serhiy.storchaka
versions:  -Python 3.2

___
Python tracker 

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



[issue17348] Unicode - encoding seems to be lost for inputs of unicode chars in IDLE

2013-08-20 Thread irdb

Changes by irdb :


--
nosy: +irdb

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-20 Thread David Edelsohn

David Edelsohn added the comment:

I am not certain what is going on. Only 3.x appears to be affected, but the 
problems seem somewhat intermittent. There were some strange processes of 
another user running on the buildslave, which was driving the load up very 
high. I have killed the processes and blocked the user. We can see if that 
affects the test results.

--

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Guido van Rossum

Guido van Rossum added the comment:

Well aren't there other languages (Ruby, Coffeescript) that have the same 
syntax?  How do they do it?  (Haskell does it too, but I don't think we can 
learn from it -- but in Ruby and IIRC Coffeescsript it is syntactic sugar for a 
regular call.)

Heck, even Python's predecessor, ABC, used "f x" to mean "f(x)".  It solved "a 
b + c" by giving function call binding the *tightest* possible priority though, 
interpreting it as (a b) + c, and hence (a(b)) + c", which would be no good for 
Nick's hope that "print x+1, y" can be made to mean print(x+1, y) -- ABC would 
interpret it as "(print(x)) + 1, y".

Still, I'd like to hear about how Ruby/Coffee solve this.

--

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Alex Gaynor

Alex Gaynor added the comment:

I suppose I'm one of the more qualified people to comment on how Ruby does it: 
a mess of hacks in the lexer/parser. Ruby's case is complicated by the fact 
that a bare `foo` can either be a local variable or a method call on self. 
Consider the case `a +b`, should that be parsed as a call to a with a unary + 
on b, or an addition? In Ruby this depends on whether `a` is already defined as 
a local. Basically I think this is a terrible idea, and would encourage as 
strongly as possible to not consider this.

--
nosy: +alex

___
Python tracker 

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



[issue18512] sys.stdout.write does not allow bytes in Python 3.x

2013-08-20 Thread Ezio Melotti

Ezio Melotti added the comment:

> A workaround is to perform sys.stdout.flush() before 
> sys.stdout.buffer.write().

FWIW you can just use print(..., flush=True) from 3.3+.

--

___
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-20 Thread Ezio Melotti

Ezio Melotti added the comment:

> I think modern editors are expected to have this sort of functionality
> built into them [1].

Mine doesn't :)

> XCode is simply amazing where it will pop up errors and quote the C99
> standard [2].

That's a standard though, the ones in PEP8 are just 
conventions/guidelines/suggestions.

> We don't expect IDLE to have all that functionality but it seemed to
> us like it would be great to add pep8 or PyFlakes to IDLE.

AFAIU PyFlakes should be able to catch actual problems with the code -- not 
just simply suggesting a particular style -- so it would be a better candidate.

> It is possible we could create an extension but that would void
> Python's motto "batteries included".

Often editors are able to download extensions automatically from a central 
place, without having to ship them all by default.  Doing this is probably more 
work though, but on the other hand it would be more flexible.

> In addition tools like pep8 and PyFlakes could be useful for other purposes 
> as well.

Are you suggesting to include it directly in the stdlib, and not as part of 
IDLE?

> JayKrish is checking with the authors of pep8 about license issues.

Note that that's not the only issue.  Even if the license is OK, before 
inclusion we would have to make sure that the module meets the quality 
standards for the repo and that the author is still active and willing to 
maintain it for at least a few years in the CPython repo.  A PEP would likely 
be required, especially if the module gets included directly in the stdlib (as 
opposed as including it just in IDLE).  This also means that external 
development of the module should stop and move to the stdlib, and follow the 
release schedule of Python instead of release whenever they want (in theory 
they could maintain both, but it's more work).

--

___
Python tracker 

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



[issue18326] Mention 'keyword only' for list.sort, improve glossary.

2013-08-20 Thread Zachary Ware

Zachary Ware added the comment:

How about this?

--
Added file: http://bugs.python.org/file31385/issue18326.v2.diff

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-08-20 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Nick Coghlan

Nick Coghlan added the comment:

To clarify how my patch works: leaving out the parentheses is permitted
*only* when the call is a statement unto itself. That's how it avoids
conflicting with any existing syntax like "a *b" or "a **b": the parser
consumes those as part of the initial expression, so you *need* the parens
to control precedence and get it interpreted as a call instead. It was
surprisingly elegant at the implementation level - once I got the new
expr_stmt definition and parsing right, everything later in the chain "just
worked".

A real patch might want to look at the following enhancements:
* constraining the LHS further. This needs to happen at the AST
construction stage, since the parser can't look far enough ahead to limit
it. The patch currently uses the same rules as augmented assignment targets
* constraining the RHS. For example, disallowing generator expressions, so
they need to use the parenthesised form.
* adding an AST node for clean source-to-source transformations
* allowing implicit calls in more places. For example, as an assignment
value, or a return value.

Proving it was possible at all with pgen scratched my itch, so someone else
will need to run with it for it to turn into a concrete proposal that
addresses the readability issues.

--

___
Python tracker 

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



[issue13461] Error on test_issue_1395_5 with Python 2.7 and VS2010

2013-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 826233404be8 by Serhiy Storchaka in branch '3.3':
Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit platforms.
http://hg.python.org/cpython/rev/826233404be8

New changeset 6c9d49b8e3ec by Serhiy Storchaka in branch 'default':
Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit platforms.
http://hg.python.org/cpython/rev/6c9d49b8e3ec

New changeset 5e679ef2a55c by Serhiy Storchaka in branch '2.7':
Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"
http://hg.python.org/cpython/rev/5e679ef2a55c

--
nosy: +python-dev

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-20 Thread David Edelsohn

David Edelsohn added the comment:

The crash seems to have been due to another user abusing the buildslave system.

The remaining failure is a mis-match in the expected GDB output.

AssertionError: "{, 'b'}" != "{'b'}"
- {, 'b'}
+ {'b'}

--

___
Python tracker 

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



[issue8865] select.poll is not thread safe

2013-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 072ba5df77e4 by Serhiy Storchaka in branch '3.3':
Issue #8865: Concurrent invocation of select.poll.poll() now raises a
http://hg.python.org/cpython/rev/072ba5df77e4

New changeset 4543408e2ba6 by Serhiy Storchaka in branch 'default':
Issue #8865: Concurrent invocation of select.poll.poll() now raises a
http://hg.python.org/cpython/rev/4543408e2ba6

New changeset a4091c1de27a by Serhiy Storchaka in branch '2.7':
Issue #8865: Concurrent invocation of select.poll.poll() now raises a
http://hg.python.org/cpython/rev/a4091c1de27a

--
nosy: +python-dev

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks David! The test_gdb failure is another issue (not PowerLinux-specific), 
see issue18772.

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

___
Python tracker 

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



[issue8865] select.poll is not thread safe

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for the report and the patch Christian.

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

___
Python tracker 

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



[issue13461] Error on test_issue_1395_5 with Python 2.7 and VS2010

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for the report Sébastien. Thank you for the patch Yogesh.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
versions:  -Python 3.2

___
Python tracker 

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



[issue3158] Doctest fails to find doctests in extension modules

2013-08-20 Thread Zachary Ware

Zachary Ware added the comment:

Ping!

Anyone able to do a review of this patch?  It still applies cleanly to default 
(or even 3.3, if this qualifies as a bug rather than a new feature).

--

___
Python tracker 

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



[issue3158] Doctest fails to find doctests in extension modules

2013-08-20 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue18790] incorrect text in argparse add_help example

2013-08-20 Thread purplezephyr

New submission from purplezephyr:

The last example under add_help in the documentation for the argparse module 
has incorrect text.  It is supposed to demonstrate what happens when 
prefix_chars doesn't include '-', and add_help is True, but the example has the 
following:

  usage: PROG [-h]

  optional arguments:
-h, --help  show this help message and exit

instead of:

  usage: PROG [+h]

  optional arguments:
+h, ++help  show this help message and exit

--
assignee: docs@python
components: Documentation
messages: 195710
nosy: docs@python, purplezephyr
priority: normal
severity: normal
status: open
title: incorrect text in argparse add_help example
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



[issue18704] IDLE: PEP8 Style Check Integration

2013-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Summary:
I am in favor of making more Python code analysis available from within Idle. I 
have an alternate, more generalized proposal. I am opposed to this specific 
proposal and think this issue should be closed.

Alternatives: when and how to analyze.

1. Local analysis as the user types ('on the fly'). One example is smart 
indentation, which includes conversion of \t to spaces (this is PEP 8 
enforcement!) and backspace to multiple deletes. Others are calltips and code 
completion.  We might consider doing a bit more syntax checking, but would have 
to be very careful about style enforcement.

2. Block or whole file analysis within the text widget upon user request. 
Examples include search, reformatting, and whitespace stripping. The result is 
shown within the text widget (except for the bug on Windows that search still 
does not highlight found results while the dialog is active).

3. Analysis of one or more external files with Idle code. 'Find in Files' 
applies one pattern to file names and another to lines within found files and 
presents hits in an output (editor) window. The output lines contain file name, 
line number, and code line formatted so that right click, 'Go to file/line' 
opens the file if necessary and jumps to the indicated line.

4. Analysis of the saved editor file with external code. 'Run' (normally) does 
this (and more), with the complication that a socket rather than stdio streams 
are used for communication. Results appear in the shell window. Although 
tracebacks put file name and line number on one line and code on the next, 'Go 
to file/line' works when either is right-clicked. (Although Run now uses the 
same interpreter that is running Idle, this does not necessarily have to be so.)


Proposal: Run with ... 

What I would like to see is a generic option to save and run the current window 
with appropriate external programs. This proposal combines ideas from 3. and 4. 
above. The interface would be the addition of 'Run with ...' to the Run menu. 
Selecting that would bring up a submenu.

I would use subprocess to start the program (as is done with Run now). A 
command-line template would be needed for each supported external program. 
Unlike Run, subprocess would be used to capture stdout and stderr, as needed. 
The filtered output would be presented in a new Output Window, as done with 
Find-in-Files.

To me, the main value-added of doing this from Idle is being able to jump from 
output chunks to targets in an editor window for possible editing. I would only 
officially support external programs for which this is sensible, whose output 
includes line numbers and messages for possible action. Each supported program 
would need an output filter function to add the filename (if not present) to 
the line number and message and otherwise format as needed.

This proposal needs more details. how are external programs located if 
installed? (Ezio suggested the possibility of easy download and installation if 
not. I would start with instructions in the docs.) How is the submenu 
populated. How might users add templates and filter functions for programs not 
supported?  Such program might include locally written programs. There should 
be a PEP or at least PEP-like specification. Since the only stdlib addition 
would be to idlelib, backporting could be considered.


What I think is wrong with the current proposal.

1. There is no specification.

2. It is limited to one category of analysis. Within that category, it 'plays 
favorites' by picking a winner. I think users should be able to use whatever 
style analysis program they have already chosen, with the configuration options 
they have already selected. Not yet mentioned here are PyLint and PyChecker.

3. Rather than pick the 'best of breed' (if there is one), it picks what some 
would consider to be the 'worst of breed'. The PEP8 module, or at least the way 
it has been used, violates PEP 8 by treating guidelines as rigid rules, even 
though PEP 8 says not to do that. Some of the recent edits to PEP 8 were 
intended to counteract the negative effect of this module.

4. It proposes to add an external program to the stdlib without the needed PEP. 
I believe the idea of adding one of PyChecker, PyFlakes, and PyLint has already 
been rejected for multiple reasons (there is no winner, these are apps or 
tools, not library 'batteries', they are better off maintained where they are, 
we cannot maintain what we already have, etc.). The fact that these programs 
have (or should have) persistent configuration and customization files shows 
that they are apps, like Idle, and not library modules.

5. It proposes to add the external program in the wrong place. Idlelib should 
only contain Idle-specific code. Need I add that Idle is also under-maintained?

My proposal would start with a specification, would allow user choice, would 
generalize to other categories and programs (spell checking?), would 

[issue18592] IDLE: Unit test for SearchDialogBase.py

2013-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

For next edit -- docstring for class SearchDialogBase:
> +a row of standard radiobuttons (create_option_buttons);
This is wrong -- these are Checkbuttons
> +a row of dialog specific radiobuttons (create_other_buttons).
dialog-specific Radiobuttons

--

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Shouldn't it be PendingDeprecationWarning?

--

___
Python tracker 

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



[issue14971] (unittest) loadTestsFromName does not work on method with a decorator

2013-08-20 Thread Claudiu.Popa

Claudiu.Popa added the comment:

The patch for Python 2.7 is pretty similar with the one provided for Python 3.

--
nosy: +Claudiu.Popa
Added file: 
http://bugs.python.org/file31386/unittest_method_name_difference_27.patch

___
Python tracker 

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



[issue18791] PIL freeze reading Jpeg file

2013-08-20 Thread Ezio Melotti

Ezio Melotti added the comment:

PIL is not part of the standard library, you should report this on the PIL bug 
tracker.

--
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18791] PIL freeze reading Jpeg file

2013-08-20 Thread lolo27

New submission from lolo27:

With this Python program and 20070517-152405_lovers_4 (copie).jpg  (this file 
is ok whith Gimp and others programs).

Program "freeze" ( line print "Done" is not processing).

-
from PIL import Image
from PIL.ExifTags import TAGS
 
def get_exif(fn):
ret = {}
i = Image.open(fn)
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret


get_exif("./20070517-152405_lovers_4 (copie).jpg")
print "Done"

-
Console output  :

Traceback (most recent call last):
  File "pil_exif.py", line 14, in 
get_exif("./20070517-152405_lovers_4 (copie).jpg")
  File "pil_exif.py", line 7, in get_exif
info = i._getexif()
  File "/usr/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line 381, in 
_getexif
info.load(file)
  File "/usr/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 348, in 
load
for i in range(i16(fp.read(2))):
  File "/usr/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 68, in 
il16
return ord(c[o]) + (ord(c[o+1])<<8)
IndexError: string index out of range




Linux Mint : Linux mystation 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 
GNU/Linux
Python :  2.7.3rc2 (no additional lib installed)
TiffImagePlugin.py : __version__ = "1.3.5"

--
files: 20070517-152405_lovers_4 (copie).jpg
messages: 195715
nosy: lolo27
priority: normal
severity: normal
status: open
title: PIL freeze reading Jpeg file
type: crash
Added file: http://bugs.python.org/file31387/20070517-152405_lovers_4 
(copie).jpg

___
Python tracker 

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



[issue18792] test_ftplib timeouts

2013-08-20 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Some ftplib tests sometimes time out. Seem they seem to try to connect to 
"localhost" (rather than "127.0.0.1"), I was wondering if this could be a DNS 
issue and if we should resolve "localhost" in advance like Charles-François did 
for some other tests (or simply hardcode "127.0.0.1", actually).

http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/7060/steps/test/logs/stdio

(example:

==
ERROR: testTimeoutDefault (test.test_ftplib.TestTimeouts)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_ftplib.py",
 line 953, in testTimeoutDefault
ftp = ftplib.FTP("localhost")
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\ftplib.py", 
line 115, in __init__
self.connect(host)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\ftplib.py", 
line 150, in connect
source_address=self.source_address)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", 
line 454, in create_connection
raise err
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", 
line 445, in create_connection
sock.connect(sa)
socket.timeout: timed out

)

--
components: Tests
messages: 195717
nosy: giampaolo.rodola, neologix, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: test_ftplib timeouts
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue18793] occasional test_multiprocessing_forkserver failure on FreeBSD 10.0

2013-08-20 Thread Antoine Pitrou

New submission from Antoine Pitrou:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/243

[259/379] test_multiprocessing_forkserver
Process Process-246:
Traceback (most recent call last):
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/process.py",
 line 255, in _bootstrap
self.run()
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/process.py",
 line 92, in run
self._target(*self._args, **self._kwargs)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/_test_multiprocessing.py",
 line 3388, in child
p.start()
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/process.py",
 line 108, in start
self._popen = Popen(self)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/popen.py",
 line 35, in Popen
return _Popen(process_obj)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/popen_forkserver.py",
 line 36, in __init__
super().__init__(process_obj)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/popen_fork.py",
 line 21, in __init__
self._launch(process_obj)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/popen_forkserver.py",
 line 52, in _launch
self.sentinel, w = forkserver.connect_to_new_process(self._fds)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/forkserver.py",
 line 67, in connect_to_new_process
reduction.sendfds(client, allfds)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/reduction.py",
 line 145, in sendfds
sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)])
OSError: [Errno 9] Bad file descriptor
Traceback (most recent call last):
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/forkserver.py",
 line 161, in main
_serve_one(s, listener, alive_r, handler)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/forkserver.py",
 line 187, in _serve_one
fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/reduction.py",
 line 155, in recvfds
raise EOFError
EOFError
Timeout (1:00:00)!
Thread 0x000801c06400:
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/connection.py",
 line 385 in _recv
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/connection.py",
 line 408 in _recv_bytes
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/multiprocessing/connection.py",
 line 252 in recv
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/_test_multiprocessing.py",
 line 3400 in test_lock
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/case.py",
 line 496 in run
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/case.py",
 line 535 in __call__
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 105 in run
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 67 in __call__
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 105 in run
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 67 in __call__
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 105 in run
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py",
 line 67 in __call__
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/runner.py",
 line 168 in run
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/support/__init__.py",
 line 1637 in _run_suite
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/support/__init__.py",
 line 1671 in run_unittest
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py",
 line 1304 in 
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py",
 line 1305 in runtest_inner
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py",
 line 998 in runtest
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py",
 line 796 in main
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py",
 line 1590 in main_in_temp_cwd
  File 
"/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/__main__.py",
 line 3 in 
  File 
"/usr/home/buildbot/koobs

[issue17442] code.InteractiveInterpreter doesn't display the exception cause

2013-08-20 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Here's an updated patch for the stdlib, with adapted tests.

--
keywords: +patch
nosy: +Claudiu.Popa
Added file: http://bugs.python.org/file31388/code.patch

___
Python tracker 

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'll get on it this evening.  Please be patient.

--

___
Python tracker 

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



[issue18794] select.devpoll objects have no close() method

2013-08-20 Thread STINNER Victor

New submission from STINNER Victor:

select.epoll and select.kqueue objects have a close() method, but not 
select.poll objects, whereas all these objects store internally a file 
descriptor.

select.poll lacks also a fileno() method.

I added the fileno() method in my implementation of the PEP 446 (see issue 
#18571).

--
messages: 195721
nosy: gvanrossum, haypo, neologix
priority: normal
severity: normal
status: open
title: select.devpoll objects have no close() method
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



[issue16853] add a Selector to the select module

2013-08-20 Thread STINNER Victor

STINNER Victor added the comment:

FYI I created the issue #18794: "select.devpoll objects have no close() 
method". If this method is added, it should also be called by the close() 
method of the selector.

--
nosy: +haypo

___
Python tracker 

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



[issue18794] select.devpoll objects have no close() method

2013-08-20 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #16853 "add a Selector to the select module".

--

___
Python tracker 

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



[issue16853] add a Selector to the select module

2013-08-20 Thread Guido van Rossum

Guido van Rossum added the comment:

I've lost track -- who is waiting for whom?  I reviewed the patch 
selector-12.diff and received zero response AFAICT.  (Maybe the email from 
Rietveld didn't make it?)

I'd like to get this into alpha2, even if the proactor won't make it (though 
I'd love to see that as well).

Maybe the main issue is that I would prefer if the selector classes were in a 
separate module (selectors.py) than the low-level select/poll/etc. calls.  I 
think it makes sense if the selectors module *only* defines the high level 
classes and not the messy low-level stuff, since an app shouldn't be using both 
at the same time.

--

___
Python tracker 

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



[issue18794] select.devpoll objects have no close() method

2013-08-20 Thread Guido van Rossum

Guido van Rossum added the comment:

This all sounds fine to fix without waiting for anything else -- can you attach 
a patch here?

--

___
Python tracker 

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



[issue16853] add a Selector to the select module

2013-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, I suppose it waits on Charles-François to update the patch.

I'd prefer not to add a separate module for this, personally. I think this 
functionality is fine in the select module. People who know how to use a 
selector certainly have heard about select() or poll() already :-)
(no strong feelings about it anyway)

--

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-20 Thread Christian Heimes

Christian Heimes added the comment:

Thanks Victor, it sounds like a good suggestion. I have modified my patch to 
use _PyTime_gettimeofday(). Python 2.7 doesn't have _PyTime_gettimeofday() so 
I'm going to use time(NULL).

--
Added file: http://bugs.python.org/file31389/openssl_prng_atfork5.patch

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-20 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: http://bugs.python.org/file31389/openssl_prng_atfork5.patch

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-20 Thread Christian Heimes

Changes by Christian Heimes :


Added file: http://bugs.python.org/file31390/openssl_prng_atfork5.patch

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2013-08-20 Thread paul j3

paul j3 added the comment:

It's everything I intend to add.  Now I'm just waiting for a committer to act, 
either with suggested changes, or a merge.  I'm watching more than a dozen 
argparse patches.

--

___
Python tracker 

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



[issue18782] sqlite3 row factory and multiprocessing map

2013-08-20 Thread Ned Deily

Ned Deily added the comment:

I agree with Richard's comments.  The crash appears to be a result of an 
unsupported usage of SQLite and one that Python can't really protect you from.

--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-20 Thread STINNER Victor

STINNER Victor added the comment:

openssl_prng_atfork5.patch:

- you should use RAND_pseudo_bytes() instead of RAND_bytes() in the unit test, 
to not skip the test depending on the entropy
- the change in Misc/NEWS is strange
- please remove dead code ("#if 0")
- PySSL_RAND_atfork_child() comment is wrong, it is no more able to get time 
with a nanosecond resolution (write "(microseconds or seconds)")
- can you explain the choice of "char stack[72]" (72 bytes): why no more, why 
not less?

--

___
Python tracker 

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-20 Thread Alexandre Dias

New submission from Alexandre Dias:

Me and a couple of colleagues have stumbled upon the need to sometimes sort our 
profiling stats by time (cumulative and total) per call. I believe this could 
be useful to other people, and have therefore opened this patch.

Thanks for taking the time to look into it.

-Alexandre

--
components: Library (Lib)
files: pstats.py
messages: 195731
nosy: alexnvdias
priority: normal
severity: normal
status: open
title: pstats - allow stats sorting by cumulative time per call and total time 
per call
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file31391/pstats.py

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread Toshio Kuratomi

Toshio Kuratomi added the comment:

Nick and I had talked about this at a recent conference and came to it from 
different directions.  On the one hand, Nick made the point that any encoding 
of surrogateescape'd text to bytes via a different encoding is corrupting the 
data as a whole.  On the other hand, I made the point that raising an exception 
when doing something as basic as printing something that's text type was 
reintroducing the issues that python2 had wrt unicode, bytes, and encodings -- 
particularly with the exception being raised far from the source of the problem 
(when the data is introduced into the program).

After some thought, Nick came up with this solution.  The idea is that 
surrogateescape was originally accepted to allow roundtripping data from the OS 
and back when the OS considers it to be a "string" but python does not consider 
it to be "text".  When that's the case, we know what the encoding was used to 
attempt to construct the text in python.  If that same encoding is used to 
re-encode the data on the way back to the OS, then we're successfully 
roundtripping the data we were given in the first place.  So this is just 
applying the original goal to another API.

--
nosy: +a.badger

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Which reminds me: I'm curious what "ls" currently does for malformed
filenames. The aim of this change would be to get 'python -c "import os;
print(os.listdir())"' to do the best it can to work without losing data in
such a situation.

--

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread STINNER Victor

STINNER Victor added the comment:

On Linux, the locale encoding is usually UTF-8. If a filename cannot
be decoded from UTF-8, invalid bytes are escaped to the surrogate
range using the PEP 383. If I create a UTF-8 text file and I try to
write the filename into this text file, the Python UTF-8 encoder
raises an error.

IMO Python must raise an error here because I want to generate a valid
UTF-8 text file, not a text file only readable by Python if the locale
encoding is UTF-8.

So using surrogateescape error handler if the encoding is
sys.getfilesystemencoding() is *not* a good idea.

What is your use case where you need to display a filename? Is it
displayed to the terminal, into a file or in a graphical window? Why
not escaping surrogate just to format the filename, as Gnome does? See
for example:
https://developer.gnome.org/glib/2.34/glib-Character-Set-Conversion.html#g-filename-display-name

--

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread STINNER Victor

STINNER Victor added the comment:

2013/8/21 Nick Coghlan :
> Which reminds me: I'm curious what "ls" currently does for malformed
> filenames. The aim of this change would be to get 'python -c "import os;
> print(os.listdir())"' to do the best it can to work without losing data in
> such a situation.

The "ls" command works on bytes, not on characters. You can
reimplement "ls" with:

* Unicode: os.listdir(str), os.fsencode() and sys.stdout.buffer
* bytes: os.listdir(bytes) and sys.stdout.buffer

os.fsencode() does exactly the opposite of os.fsdecode(). There is a
unit test to check that :-)

I ensured that all OS functions can be used directly with bytes
filenames in Python 3. That's why I added os.environb for example.

--

___
Python tracker 

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-20 Thread Ethan Furman

Ethan Furman added the comment:

Eli Bendersky added the comment:
>
> The whole point of IntEnum and replacing stdlib constants with it was 
> friendly str & repr out of the box.

Sure, friendly str and repr plus an nice way to work them in code.

> This means that "just printing out" an enum member should have a nice string 
> representation.

And when are you going to print out an enum?  Debugger and/or command line.

> And "just printing out" means:
>
> print(member)
> "%s" % member
> "{}".format(member)

Would you seriously use either of those last two in either the debugger 
or the command line?

--

___
Python tracker 

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



[issue16248] Security bug in tkinter allows for untrusted, arbitrary code execution.

2013-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 84f40562669f by Barry Warsaw in branch '2.6':
Fix UnboundLocalError regression due to previous incorrect fix for
http://hg.python.org/cpython/rev/84f40562669f

--

___
Python tracker 

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



[issue16248] Security bug in tkinter allows for untrusted, arbitrary code execution.

2013-08-20 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Applied the fix to 2.6 and null merged into 2.7.  This didn't need a NEWS entry 
because the regression hadn't been released yet.  I'll remove 2.6 from the 
Versions now.

--

___
Python tracker 

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



[issue16248] Security bug in tkinter allows for untrusted, arbitrary code execution.

2013-08-20 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
versions:  -Python 2.6

___
Python tracker 

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-20 Thread Ethan Furman

Ethan Furman added the comment:

Eric V. Smith added the comment:
>
> this gives the (to me) surprising results of:
>
 format(S.a)
> 'S.a'
 format(S.a, '10')
> 'S.a'
 format(S.a, '10s')
> 'A'

that is surprising: if a __format__ is defined in the Enum class chain 
then it should be used instead of the default.  I'll fix that (I treat 
__new__, __repr__, __getnewargs__, and maybe one other the same way).

> Also, the patch give this:
>
 class E(IntEnum):
> ...   one = 1
> ...   two = 2
> ...
 format(E.one)
> 'E.one'
 format(E.one, 's')
> Traceback (most recent call last):
>File "", line 1, in 
>File "/home/eric/local/python/cpython/Lib/enum.py", line 463, in __format__
>  return obj.__format__(val, format_spec)
> ValueError: Unknown format code 's' for object of type 'int'
>
> I can't format it using the 's' presentation type, despite the fact it looks 
> like a string. I think you need to add 's' to your _remove_plain_format_chars.

Well, they are Enums, not strings.  And if I add 's' to the remove, then 
a str-derived enum would not pass through to the value correctly.

> And consider this valid (but arguably pathological) code:
>
 format(datetime.datetime.now(), '10')
> '10'
>
> Despite this being a valid datetime format spec, your code would consider it 
> a str spec.

Sounds like the way forward is to specify in the docs how the default 
Enum __format__ behaves (basically honors width and justification 
settings to yield the name, anything else passes through to the Enum 
member) along with advice matching that for __str__ and __repr__: if you 
want something different, write your own method. ;)

And I learned something else:  the format mini-language is really in two 
parts; the first part is selecting the object to be printed ({} or {3} 
or {some_name} or {other.name} etc., etc.) and the second part is the 
format spec for the object selected.  The kicker is that each object can 
specify what it knows about.  So float's treat 'f' as float, but 
something else might treat 'f' as fixed.

--

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2013-08-20 Thread Glenn Linderman

Glenn Linderman added the comment:

So I read over your code again, and even read the documentation this time, and 
it all looks good, and I know it works good because I've been using the code. I 
tried to send a notice through Reitveld, and maybe did, but I don't know where 
it went, so I'll say this much here, too.

--

___
Python tracker 

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



[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Think sysadmins running scripts on Linux, writing to the console or a pipe.
I agree the generalisation is a bad idea, so only consider the original
proposal that was specifically limited to the standard streams.

Specifically, if a system is properly configured to use UTF-8 for all
interfaces, I shouldn't have to live in fear of Python steps in a command
pipeline falling over because it happens to encounter a filename encoded
with latin-1 (etc).

If the bytes oriented os tools like ls don't fall over on it, then neither
should Python. This is about treating the standard streams as OS
interfaces, as long as they're using the filesystem encoding.

--

___
Python tracker 

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



[issue18796] Wrong documentation of show_code function from dis module

2013-08-20 Thread Vajrasky Kok

New submission from Vajrasky Kok:

$ ./python
Python 3.4.0a1+ (default:afb1b4797419, Aug 21 2013, 09:54:46) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> import sys
>>> def spam(x):
...   return x * 2
... 
>>> dis.show_code(spam, file=sys.stderr)
Name:  spam
Filename:  
Argument count:1
Kw-only arguments: 0
Number of locals:  1
Stack size:2
Flags: OPTIMIZED, NEWLOCALS, NOFREE
Constants:
   0: None
   1: 2
Variable names:
   0: x
>>> output = open('/tmp/output.txt', 'w')
>>> dis.show_code(spam, file=output)
>>> output.close()
>>> dis.show_code.__doc__
'Print details of methods, functions, or code to stdout.'

Attached the patch to fix the documentation.

--
assignee: docs@python
components: Documentation
files: fix_doc_show_code.patch
keywords: patch
messages: 195742
nosy: docs@python, vajrasky
priority: normal
severity: normal
status: open
title: Wrong documentation of show_code function from dis module
versions: Python 3.4
Added file: http://bugs.python.org/file31392/fix_doc_show_code.patch

___
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-20 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Agree with Terry Reedy.

--

___
Python tracker 

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-20 Thread Eric V. Smith

Eric V. Smith added the comment:

On 8/20/2013 9:26 PM, Ethan Furman wrote:
> Sounds like the way forward is to specify in the docs how the default 
> Enum __format__ behaves (basically honors width and justification 
> settings to yield the name, anything else passes through to the Enum 
> member) along with advice matching that for __str__ and __repr__: if you 
> want something different, write your own method.

I definitely agree on the documentation part.

But I think that IntEnum should have its own __format__, because it
wants something different.

And I still think that any interpretation of the format spec in
Enum.__format__ is a mistake, because you don't know what the string
means to the passed-to object. You're basically trying to guess: does
this look like something that makes sense as a str.__format__ specifier
and I should handle it directly, or does it make sense to the passed-to
object? And you can't know for sure.

> And I learned something else:  the format mini-language is really in two 
> parts; the first part is selecting the object to be printed ({} or {3} 
> or {some_name} or {other.name} etc., etc.) and the second part is the 
> format spec for the object selected.

This is why I've been trying to frame this discussion in terms of
built-in format() or obj.__format__(), and get away from str.format().

> The kicker is that each object can
> specify what it knows about.  So float's treat 'f' as float, but
> something else might treat 'f' as fixed.

And some other object might consider 'f' as being part of a literal
that's always output (like datetime).

--

___
Python tracker 

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



[issue18794] select.devpoll objects have no close() method

2013-08-20 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be29efa60b68 by Raymond Hettinger in branch 'default':
Issue 18772:  Restore set dummy object back to unicode and restore the identity 
checks in lookkey().
http://hg.python.org/cpython/rev/be29efa60b68

--
nosy: +python-dev

___
Python tracker 

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
Removed message: http://bugs.python.org/msg195720

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> After some thought, Nick came up with this solution.  The idea is that
> surrogateescape was originally accepted to allow roundtripping data
> from the OS and back when the OS considers it to be a "string" but
> python does not consider it to be "text".  When that's the case, we
> know what the encoding was used to attempt to construct the text in
> python.  If that same encoding is used to re-encode the data on the
> way back to the OS, then we're successfully roundtripping the data we
> were given in the first place.  So this is just applying the original
> goal to another API.

I think that outlook is a bit naïve. The text source is not always the
same as the text destination, i.e. your surrogateescape-decoded data may
come from a database or some JSON API, so there's no reason to think
that the end of the stdout pipe will share the same convention.

I'm myself quite partial to the "round-tripping" use case, but I'm not
sure we can solve it as bluntly. If it's merely for printing out data,
maybe we can an os.fsescape() function to allow for representation of
broken filenames.

--

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-20 Thread Mark Dickinson

Mark Dickinson added the comment:

> Shouldn't it be PendingDeprecationWarning?

Hmm.  Possibly.  I'm not sure what the policy is any more regarding 
DeprecationWarning versus PendingDeprecationWarning.  Nick?

--

___
Python tracker 

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



[issue812369] module shutdown procedure based on GC

2013-08-20 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
superseder: module shutdown procedure based on GC -> Stop purging modules which 
are garbage collected before shutdown

___
Python tracker 

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



[issue18790] incorrect text in argparse add_help example

2013-08-20 Thread Michael Bikovitsky

Changes by Michael Bikovitsky :


--
keywords: +patch
Added file: http://bugs.python.org/file31393/doc_fix.patch

___
Python tracker 

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



[issue18790] incorrect text in argparse add_help example

2013-08-20 Thread Michael Bikovitsky

Changes by Michael Bikovitsky :


--
nosy: +Michael.Bikovitsky

___
Python tracker 

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