[issue18565] Test for closing delegating generator with cleared frame (Issue17669)

2013-07-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Thanks! It looks good except I think you could use the support.disable_gc() 
context manager.

--

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



[issue18568] Support \e escape code in strings

2013-07-27 Thread Steven D'Aprano

New submission from Steven D'Aprano:

I'm adding this so there is a record in the bug tracker for posterity. No 
action is needed except to close it as a Won't Fix.

As per this discussion here:

http://mail.python.org/pipermail/python-ideas/2013-June/021318.html

using \e as an escape code for ASCII ESC character might be nice to have, but 
it fails backwards compatibility and therefore must be ruled out.

(But perhaps could be re-visited in Python 4000?)

--
components: Interpreter Core
messages: 193776
nosy: stevenjd
priority: normal
severity: normal
status: open
title: Support \e escape code in strings

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



[issue18568] Support \e escape code in strings

2013-07-27 Thread Steven D'Aprano

Changes by Steven D'Aprano steve+pyt...@pearwood.info:


--
resolution:  - rejected
status: open - closed

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



[issue18537] bool.toggle()

2013-07-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FYI, the itertools module has ifilterfalse() for inverse filtering.

--
nosy: +rhettinger
resolution: invalid - rejected

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Latest version is a more general cleanup patch for PEP 8 (hence the change in 
the issue title). Enumerating all the changes/additions:

1. Added an intro paragraph that makes it clear this is a living document, not 
set and forget.

2. Added a couple more explicit reasons to the foolish consistency section, 
and tweaked the header for that list to help make it clearer that there may be 
other good reasons, these are just especially good ones.

3. Updated the tabs and spaces section for Python 3

4. Changed the rationale for the line length limit. These days, it is about 
side-by-side editor windows, diff tools, and online text editing widgets, not 
ancient terminals with limited column widths.

5. Cleaned up the encoding cookie guidelines for Python 3

6. Changed the absolute vs explicit relative import discussion to state that 
while absolute imports are recommended, there are valid reasons to use explicit 
relative imports. Added an explicit admonition that the standard library should 
always absolute imports, and that *nobody* should use implicit relative imports.

7. Added a guideline to avoid wildcard imports

8. The new section on public vs internal interfaces

9. Clarified that it's not just Jython that omits the += hack, and that it is 
fairly easy to break it in CPython, too.

10. Added a guideline about using def rather than assigning a lambda to a name.

11. Rewrote the class based exception guideline to account for the requirement 
that all exceptions inherit from BaseException, as well as the exception 
hierarchy design lessons we have learned that led to the creation of PEP 3151 
(which explicitly *rejects* the per-module generic exception approach 
previously recommended by PEP 8)

12. Clarified what a non-error exception might be used for.

13. Added a guideline about exception chaining

14. For the exception raising guideline, moved Python 3 compatibility up as the 
main motivating factor

15. Added a guideline about using the as clause to bind a caught exception to 
a name

16. Added a guideline explicitly favouring PEP 3151 based exception handling 
over errno introspection

17. Added a note about the Python 3 text model changes to the isinstance 
guideline

18. Added a recommendation that third party experiments with function 
annotations combine them with a decorator that indicates how they're to be 
interpreted

--
Added file: http://bugs.python.org/file31050/issue18472_pep_8_update4.diff

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

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


Removed file: http://bugs.python.org/file30938/issue18472_pep_8_update3.diff

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

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


Removed file: http://bugs.python.org/file30937/issue18472_pep_8_update2.diff

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



[issue18533] Avoid error from repr() of recursive dictview

2013-07-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for backporting the fix.

--
nosy: +rhettinger

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

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


Removed file: http://bugs.python.org/file30936/issue18472_pep_8_update.diff

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Guido, if you have time to review these proposed PEP 8 changes, that would be 
great. Most should be unobjectionable, but I seem to recall you disliking the 
recommendation for third party function annotation experiments to use an 
explicit decorator, so I'm happy to drop that one if you don't like it.

I'm also willing to send it back to python-dev at large for further feedback, 
but I'm not sure that's necessary (the two big changes are the ones about 
public APIs and the import recommendations, and those have had discussion 
threads already)

--

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

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


--
nosy: +gvanrossum

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



[issue18569] Set PATHEXT in the Windows installer

2013-07-27 Thread Paul Moore

New submission from Paul Moore:

Make the Windows Python installer set PATHEXT when Register Python extensions 
is set. This allows users to run a scripy by typing the name of the .py file at 
the command line without the .py extension.

The patch needs review - I have not been able to build the MSI installer and so 
this patch is untested :-(

--
assignee: loewis
components: Installation, Windows
files: pathext.patch
keywords: needs review, patch
messages: 193781
nosy: loewis, pmoore
priority: normal
severity: normal
stage: patch review
status: open
title: Set PATHEXT in the Windows installer
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31051/pathext.patch

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

 1. Added an intro paragraph that makes it clear this is a living document, 
 not set and forget.

If we want to make this a living document, I think the PEP will
have to receive its own internal version number and a history
section at the end explaining the changes (basically what you
just summarized for the patch).

Doing so is important, since companies and tools often reference
PEP 8 in internal coding guidelines and any changes need to
be easily identifiable for readers of those guidelines.

--
nosy: +lemburg

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



[issue18570] OverflowError during division: wrong message

2013-07-27 Thread Marco Buttu

New submission from Marco Buttu:

When the integer division result is too large to converto to float, and the 
operands are inside the limits, the result is `inf` or `-inf`::

 2**1023 / 2**-3
inf
 2**1022 / 2**-4
inf
 2**1023 / 2**-1074
inf

When both the result and an operand are too large to converto to float, we 
raise an OverflowError::

 2**1028 / 2**-2
Traceback (most recent call last):
  File input, line 1, in module
OverflowError: long int too large to convert to float

The message says: long int too large to convert to float. I think in Python 3 
it should be int too large to convert In any case, the most important 
thing is that in the same situation we get a different message [1]_::

 2**1032 / 2**2
Traceback (most recent call last):
  File input, line 1, in module
OverflowError: integer division result too large for a float

and I think is it muddleheaded, because it should be long int too large to 
convert to float, as we got in the case `2**1028 / 2**-2`. I think we should 
never show integer division result too large for a float, but just:

* `inf` or `-inf` when the operands are inside the limits, but the result 
  does not
* `OverflowError: long int too large to convert to float` when the result, 
  and at least one operand, are out of range.


.. [1] In this situation, we get the message OverflowError: integer division 
result too large for a float only when the denominator exponent is positive.

--
messages: 193783
nosy: marco.buttu
priority: normal
severity: normal
status: open
title: OverflowError during division: wrong message
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

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



[issue18570] OverflowError during division: wrong message

2013-07-27 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy: +christian.heimes, mark.dickinson
versions:  -Python 3.1, Python 3.2

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



[issue8425] a -= b should be fast if a is a small set and b is a large set

2013-07-27 Thread Michele Orrù

Michele Orrù added the comment:

ping.

--

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Guido van Rossum

Guido van Rossum added the comment:

This is mostly fine.

FWIW I disagree with MAL's assertion that we need to start adding internal 
versioning; people who lawyer about which version of the PEP should apply are 
focused on the wrong thing entirely.  IIUC the occasional Python-3-specific 
rule is already flagged as such.  Also for real nitpickers there's the Hg 
revision. :-)

My nits on the diff:

- You're missing a comma after Barry's name (i.e. before your own).

- Also a period at the end of point 3 starting near line 55.

- I think we should recommend against tabs outright.  They are getting more and 
more misunderstood.

- Regarding line length, I think it is reasonable to mention that many 
organizations are settling on 100 as a compromise.  On newer laptops you can 
still fit two terminal windows (with a reasonable font size) side by side.  
(Also many people checking code into the stdlib ignore the 80 char limit. :-( )

- The section about Latin-1 author names sounds a little confused (why 
recommend Latin-1 over UTF-8 at all?).  I believe what is left unsaid is that 
you don't need a coding cookie when using Latin-1 in comments in Python 2?  But 
in strings the cookie would still be required IIRC.  But this will cause 
problems when the file is converted Python 3 because the UTF-8 default will 
complain about non-ASCII Latin-1 bytes.

- In performance sensitive parts of the library -- are we suddenly clinging 
to the fiction that PEP 8 only applies to the stdlib?  I'd change parts of the 
library to code. Also, it's performance-sensitive.

- Eliminate this:

+- Use class-based exceptions (recent versions of Python require that all
+  exceptions inherit from BaseException).

Instead, I'd add an admonition to derive exceptions from Exception rather than 
BaseException unless you really know what you're doing.  

- Which reminds me.  Do we have a recommendation yet to write
  except Exception:
instead of
  except:
If not, we should.

- I wouldn't mind seeing at least a mild recommendation against using 
exceptions for non-local control flow.  The lessons of StopIteration suggest 
that such designs are often fraught with subtle problems.

- About third party experiments: can you strike highly?  I don't want mypy to 
feel out of line (http://www.mypy-lang.org/).

--

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



[issue17036] Implementation of the PEP 433: Easier suppression of file descriptor inheritance

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file31052/ecc10f0afb76.diff

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



[issue17036] Implementation of the PEP 433: Easier suppression of file descriptor inheritance

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file31052/ecc10f0afb76.diff

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: haypo
priority: normal
severity: normal
status: open
title: Implementation of the PEP 446: non-inheriable file descriptors
type: enhancement
versions: Python 3.4

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
hgrepos: +205

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

New submission from STINNER Victor:

Implementation of the PEP 446.

--

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



[issue18572] Remove redundant note about surrogates in string escape doc

2013-07-27 Thread Steven D'Aprano

New submission from Steven D'Aprano:

The documentation for string escapes suggests that \u escapes can be used 
to generate characters in the Supplementary Multilingual Planes by using 
surrogate pairs:

Individual code units which form parts of a surrogate pair can be encoded 
using this escape sequence.

http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

E.g. in Python 3.2:

py '\uD80C\uDC80' == '\U00013080'
True

but that is no longer the case in Python 3.3. I suggest the documentation 
should just remove that note.

--
assignee: docs@python
components: Documentation
messages: 193787
nosy: docs@python, stevenjd
priority: normal
severity: normal
status: open
title: Remove redundant note about surrogates in string escape doc
versions: Python 3.3

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file31053/327133193321.diff

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-27 Thread py.user

New submission from py.user:

http://docs.python.org/3/library/unittest.html#unittest.TestCase.assertWarns
When used as a context manager, assertRaises() accepts
... is to perform additional checks on the exception raised

--
assignee: docs@python
components: Documentation
files: issue.diff
keywords: patch
messages: 193788
nosy: docs@python, py.user
priority: normal
severity: normal
status: open
title: In unittest.TestCase.assertWarns doc there is some text about 
assertRaises()
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31054/issue.diff

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



[issue18572] Remove redundant note about surrogates in string escape doc

2013-07-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
stage:  - needs patch
type:  - behavior
versions: +Python 3.4

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
stage:  - needs patch
versions: +Python 2.7, Python 3.3

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



[issue18539] Idle 2.7: Calltip wrong if def contains float default value

2013-07-27 Thread ariel brunner

ariel brunner added the comment:

Superb, and thanks for doing the actual work on fixing it.

--

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



[issue18570] OverflowError in division: wrong message

2013-07-27 Thread Marco Buttu

Changes by Marco Buttu marco.bu...@gmail.com:


--
title: OverflowError during division: wrong message - OverflowError in 
division: wrong message

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



[issue18572] Remove redundant note about surrogates in string escape doc

2013-07-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

3.3.2:
 '\uD80C\uDC80' == '\U00013080'
False

The statement that surrogate code units can be encoded this way is still true. 
Indeed, it is now the only way to get such code units into a string. The 
suggestion that a pair will make an astral char is now false. The sentence 
could be changed to 

Individual surrogate code units can be encoded using this escape sequence.

On the other hand, the same is true of *any* BMP char, including all the 
*other* non-graphic chars that can only be entered this way. So I think the 
sentence, if not deleted, should be replaced by what seems to me a more useful 
(complete) statement.

Any Basic Multilingual  Plane (BMP) codepoint can be encoded using this escape 
sequence.

--
nosy: +terry.reedy

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
assignee: docs@python - terry.reedy
nosy: +terry.reedy

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 55dcf9e065be by Terry Jan Reedy in branch '3.3':
Issue #18573: Complete copy-paste from assertRaises entry to assertWarns entry.
http://hg.python.org/cpython/rev/55dcf9e065be

--
nosy: +python-dev

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

assertWarns is new in 3.2 and not in 2.7.
The sentence was copied from the assertRaises section but not changed.
Thanks for reporting.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
type: enhancement - behavior
versions:  -Python 2.7

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



[issue18570] OverflowError in division: wrong message

2013-07-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Yes, 'long int' should just be 'int' in 3.x.

However, int/int (integer division) is *not* the same thing as int/float. In 
the latter case, the int is converted to float first and if that conversion 
fails, there is no result.

Now that int/int is always converted to float, it seems sensible that out of 
float range results be +-inf. But there may be an issue with back 
compatibility. I know there has been discussion on overflow vs. inf in various 
contexts.

--
nosy: +terry.reedy

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



[issue18565] Test for closing delegating generator with cleared frame (Issue17669)

2013-07-27 Thread Phil Connell

Phil Connell added the comment:

Good suggestion, updated patch attached.

--
Added file: http://bugs.python.org/file31055/gen_close_with_cleared_frame.diff

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



[issue18564] Integer overflow in socketmodule

2013-07-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Instead of writing try / except / self.fail, you could simply use the context 
manager form of assertRaises.

--
nosy: +neologix, pitrou

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




[issue18112] PEP 442 implementation

2013-07-27 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy: +christian.heimes

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



[issue18566] In unittest.TestCase docs for setUp() and tearDown() don't mention AssertionError

2013-07-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I re-ran with setUp 'raise' changed to 'pass' to see the effect of raise 
AssertionError or unittest.SkipTest in tearDown and indeed the test fails or 
skips even then. I suggest adding ', other than AssertionError or SkipTest,' 
just after 'method'. The same is true of test_xxx methods.

A slight anomaly is that AssertionError in test_nothing and SkipTest in 
tearDown results in FAILED (failures=1, skipped=1), which is not really a 
skip.

For setUpClass and setUpModule, AssertionErrors *are* errors, not failures, 
while SkipTest works everywhere.

--
nosy: +terry.reedy
versions: +Python 2.7, Python 3.3

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



[issue17669] Segfault caused by weird combination of imports and yield from

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 516303f32bad by Benjamin Peterson in branch '3.3':
add a test for issue #17669 (closes #18565)
http://hg.python.org/cpython/rev/516303f32bad

--

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



[issue18565] Test for closing delegating generator with cleared frame (Issue17669)

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 516303f32bad by Benjamin Peterson in branch '3.3':
add a test for issue #17669 (closes #18565)
http://hg.python.org/cpython/rev/516303f32bad

New changeset f90e7540dcba by Benjamin Peterson in branch 'default':
merge 3.3 (#18565)
http://hg.python.org/cpython/rev/f90e7540dcba

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue18564] Integer overflow in socketmodule

2013-07-27 Thread Michele Orrù

Changes by Michele Orrù maker...@gmail.com:


Added file: http://bugs.python.org/file31056/issue18564.1.patch

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dd9941f5fcda by Terry Jan Reedy in branch '2.7':
Issue #18441: Make test.support.requires('gui') skip when it should.
http://hg.python.org/cpython/rev/dd9941f5fcda

New changeset d9a53ab464ea by Terry Jan Reedy in branch '2.7':
Issue #18441: Correct previous patch, which hg committed before I wanted it to.
http://hg.python.org/cpython/rev/d9a53ab464ea

--

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



[issue18564] Integer overflow in socketmodule

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue18112] PEP 442 implementation

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue18574] BaseHTTPRequestHandler.handle_expect_100() sends invalid response

2013-07-27 Thread Nikolaus Rath

New submission from Nikolaus Rath:

The handle_expect_100() implementation in BaseHTTPRequestHandler currently 
calls send_response_only(100) followed by flush_headers(). However, even a 1xx 
response is always followed by a (potentially empty) set of response headers 
(cf. http://tools.ietf.org/html/rfc2616#section-9.9). Therefore, clients will 
block waiting for an additional '\r\n' before sending the buffer.

The attached patch fixes the problem.

--
components: Library (Lib)
files: handle_expect.diff
keywords: patch
messages: 193800
nosy: Nikratio
priority: normal
severity: normal
status: open
title: BaseHTTPRequestHandler.handle_expect_100() sends invalid response
versions: Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file31057/handle_expect.diff

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



[issue18574] BaseHTTPRequestHandler.handle_expect_100() sends invalid response

2013-07-27 Thread Nikolaus Rath

Nikolaus Rath added the comment:

The correct link is http://tools.ietf.org/html/rfc2616#section-10.1:

10.1 Informational 1xx

   This class of status code indicates a provisional response,
   consisting only of the Status-Line and optional headers, and is
   terminated by an empty line.
   [...]

Currently handle_expect_100() does not send this empty line.

--

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file31058/c066794c85cd.diff

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



[issue18571] Implementation of the PEP 446: non-inheriable file descriptors

2013-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file31053/327133193321.diff

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9a4c62c1a4c0 by Terry Jan Reedy in branch '2.7':
Issue #18441: add Mac (darwin) gui check. This is not needed today, but has been
http://hg.python.org/cpython/rev/9a4c62c1a4c0

New changeset ba5c264d67ea by Terry Jan Reedy in branch '2.7':
Issue #18441: Comment out code that will not compile because the standard
http://hg.python.org/cpython/rev/ba5c264d67ea

New changeset 6420dcd377f9 by Terry Jan Reedy in branch '2.7':
Issue #18441: whitespace
http://hg.python.org/cpython/rev/6420dcd377f9

--

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



[issue1521051] Allow passing DocTestRunner and DocTestCase in doctest

2013-07-27 Thread Jason Myers

Jason Myers added the comment:

The attached file contains a simple test for this code to make sure the test 
runner is being applied.  I've never submitted anything before, so it might be 
totally naive.

--
nosy: +jasonamyers
Added file: http://bugs.python.org/file31059/test.patch

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



[issue12129] Document Object Model API - validation

2013-07-27 Thread John Cassidy

John Cassidy added the comment:

I added the line print(str(doc)) after the call to getDomImplementation and 
verified that the errors that I'm seeing are coming from the xml.dom.minidom 
implemenation of xml.dom.  Checking minidom.py I did not see any validation on 
the tagName that gets passed to createElement.  
http://www.w3.org/TR/xml11/#NT-NameStartChar lists the format of allowed names. 
 Attached is a file containing the functions I was working on.  My thinking is 
that if the tagName is not valid a ValueError should be thrown.

--
nosy: +jocassid
Added file: http://bugs.python.org/file31060/xmlNameVerification.py

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I tried to run the currently unnecessary Mac 'darwin' check in 2.7 with
if sys.platform == 'darwin':
from lib-tk.test.runtktests import check_tk_availability
# tkinter.test.suppport in 3.x
try:
check_tk_availability()
except unittest.SkipTest:
raise tk.TclError

This fails because 'lib-tk' is not a legal module name. There are workarounds 
in test/test_tk.py and test_ttk_guionly, but I decided not to bother with them 
now because I would rather work on moving the function to test.support (and 
perhaps the package could be given a legal name). If, before that is done, 
someone adds a Mac buildbot that will not run gui tests but requests that they 
be run anyway, the above could be added with the different changes needed for 
2.7 and 3.x.

--

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c3936a52f215 by Terry Jan Reedy in branch '3.3':
Issue #18441: Make test.support.requires('gui') skip when it should.
http://hg.python.org/cpython/rev/c3936a52f215

New changeset 858a72d91162 by Terry Jan Reedy in branch '2.7':
Issue #18441: Move commented out code to issue message.
http://hg.python.org/cpython/rev/858a72d91162

--

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



[issue8425] a -= b should be fast if a is a small set and b is a large set

2013-07-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

There's no rush on this.  I have other work I want to do on set objects before 
applying further optimizations, so I want to hold off on it for a bit.

--

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

- I think we should recommend against tabs outright.  They are getting more and 
more misunderstood.

+1  Perhaps also mention that Python 3 now raises TabError for inconsistent 
tabs and spaces.


- Regarding line length, I think it is reasonable to mention that many 
organizations are settling on 100 as a compromise.  On newer laptops you can 
still fit two terminal windows (with a reasonable font size) side by side

+1  I've seen too many atrocities committed by people trying to scrunch code 
into 80 columns (weird line splits, over-abbreviated variable names, etc).

- The section about Latin-1 author names sounds a little confused (why 
recommend Latin-1 over UTF-8 at all?).  I believe what is left unsaid is that 
you don't need a coding cookie when using Latin-1 in comments in Python 2?  But 
in strings the cookie would still be required IIRC.  But this will cause 
problems when the file is converted Python 3 because the UTF-8 default will 
complain about non-ASCII Latin-1 bytes.

+1 for UTF-8 as the default preference for everything in the Python world.


- Eliminate this:

+- Use class-based exceptions (recent versions of Python require that all
+  exceptions inherit from BaseException).

Instead, I'd add an admonition to derive exceptions from Exception rather than 
BaseException unless you really know what you're doing.  

+1

- I wouldn't mind seeing at least a mild recommendation against using 
exceptions for non-local control flow.  The lessons of StopIteration suggest 
that such designs are often fraught with subtle problems.

I'm afraid even a mild admonition would lead of over zealous rejection of 
legitimate use cases for exceptions.

For uses cases that actually need non-local control flow, there are worse 
things you can do than use exceptions (i.e. returning an error token up a chain 
of function calls requiring if-error logic at every step along the way).

In particular, exceptions for control-flow are a good solution to some 
challenges that arise in larger programs (i.e. problems encountered in low 
level logic can only be handled by high level user interface logic, and the 
intermediate level business logic serves only as a pass through).

It seems to me that the issues with StopIteration were mostly caused by having 
multiple control conditions all sharing the same exception (i.e. a function 
inside a for-loop can't use StopIteration to control an outer loop; the latter 
would need its own distinction exception).

P.S.  For those who are interested, the book The Little MLer does a great job 
showing how exceptions for control-flow can be used simplify recursive 
functions.

--
nosy: +rhettinger

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



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-27 Thread Nick Coghlan

Nick Coghlan added the comment:

The exception one is near-and-dear to my heart at the moment, as we're in
the process of refactoring a large app that currently does various checks
in the UI layer so it can present nice errors, when it should really be
leaving those checks to the business logic layer and then throwing app
specific exceptions that the UI layer understands and can present to the
users.

As Raymond noted, I think we need to be very cautious when it comes to
exception handling, especially with Go advocates propagating all sorts of
foolishness about the evils of exceptions and the notion that return codes
are somehow now a superior approach :P

However, I'm not sure we have a guideline about using deterministic
resource management to better cope with unexpected exceptions - I'll look
into that.

--

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