[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Guido has promised an explanation for why he wants to keep the frame hack once 
he is back at work next week. To help him target that reply appropriately for 
my concrete objections to retaining it, I'd like to explain a bit more about 
why I think it's fundamentally impossible to create a robust stack inspection 
mechanism for implicit pickling support. Even if a dedicated mechanism for it 
is added, the information the interpreter needs to make a sensible reliable 
decision simply isn't there.

Consider the following:

# In utils.py
def enum_helper(name, prefix, fields):
if isinstance(fields, str): fields = fields.split()
e = Enum(name, (prefix + field for field in fields))
return e

# In some other module
from utils import enum_helper
MyEnum = enum_helper(MyEnum, st_, mtime atime ctime)

This breaks the frame hack, but would work correctly if enum_helper was 
redesigned to accept an explicit module name, or if we adopted something like 
the name binding protocol discussed on Python ideas.

If we adopted a simplistic rule of ignoring function scopes and only look at 
module and class scopes, then we break the semantics of the global keyword.

I consider the frame hack fundamentally broken, since there's currently no way 
the interpreter can distinguish between an incidental assignment (like the e = 
Enum... call in util.py) and a destination assignment (like the MyEnum = 
enum_helper... call), and if we *do* add a different syntax for this supports 
pickling assignments (like the def name = expr syntax on Python ideas), then a 
name binding protocol makes more sense than implicit contextual magic.

--

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

I don't think that would be wise - there's currently other logic in _get_mixins 
that subclasses would then have to duplicate.

I was thinking more of an allow_subclass() API that subtypes could override to 
always return True. EnumMeta would then just factor the relevant piece of 
_get_mixins out into the default allow_subclass implementation.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Nick Coghlan

New submission from Nick Coghlan:

Creating this as a separate issue so as not to delay incorporation of the 
accepted PEP.

One legitimate criticism of the accepted PEP 435 is that the combination of 
requiring explicit assignment of values *and* allowing aliasing by default is 
that aliases may be created inadvertently. I believe we can actually do better 
than the initial implementation by making the following work:

 class Shape(Enum):
...   square = 2
...   diamond = 1
...   circle = 3
...   alias_for_square = square
...
 Shape.square
Shape.square: 2
 Shape.alias_for_square
Shape.square: 2
 Shape(2)
Shape.square: 2

While *disallowing* the following: 

 class Shape(Enum):
...   square = 2
...   diamond = 1
...   circle = 3
...   alias_for_square = 2
...

How, do you ask? By wrapping non-descriptors on assignment in a placeholder 
type, and keeping track of which values we have already seen. If a new 
attribute is mapped to a placeholder, then that's fine, we accept it as an 
explicit declaration of an alias. However, if it's mapped directly to a repeat 
value, then that would be disallowed (as it was in earlier versions of the PEP).

--
messages: 188981
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Alternate approach to aliasing for PEP 435
type: enhancement
versions: Python 3.4

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Nick Coghlan

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


--
dependencies: +Code, test, and doc review for PEP-0435 Enum

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

I also created issue 17959 to track a legitimate concern with the current 
aliasing design, without impacting incorporation of the accepted PEP.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Alex Gaynor

Alex Gaynor added the comment:

This would preclude code like:

class Shape(Enum):
  rectangle = shape = 2

which seems (to me) to be the most reasonable way to express aliasing.

--
nosy: +alex

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



[issue17890] argparse: mutually exclusive groups full of suppressed args can cause AssertionErrors

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

@Terry: Thanks for the info. I seem to have the elusive * after my username 
now. I am not sure how this works, but can you review/test/apply the patch now?

--

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



[issue17940] extra code in argparse.py

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

I guess that was simple enough. I am new to this issue tracker for Cpython. How 
will the patch review/commit proceed?

--

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



[issue17960] Clarify the required behaviour of locals()

2013-05-12 Thread Nick Coghlan

New submission from Nick Coghlan:

As proposed at [1], I would like to tighten up the definition of locals so that 
defining enum members programmatically is officially supported behaviour.

I'll come up with a patch soonish.

[1] http://mail.python.org/pipermail/python-dev/2013-May/125917.html

--
assignee: ncoghlan
components: Documentation
messages: 188986
nosy: benjamin.peterson, gvanrossum, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify the required behaviour of locals()
type: behavior
versions: Python 3.4

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



[issue17960] Clarify the required behaviour of locals()

2013-05-12 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #17546 and #7083.

--
nosy: +ezio.melotti

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

That's a terrible way to express aliasing, because it's really unclear that 
rectangle is the canonical name.

By contrast:

  class Shape(Enum):
rectangle = 2
oblong = rectangle

leaves no doubt as to which is canonical and which is the alias. You never need 
to go beyond two assignments, as you can still use multiple target assignment 
for the aliases.

--

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



[issue17606] xml.sax.saxutils.XMLGenerator cannot output with the correct encoding

2013-05-12 Thread Antonio Pérez

Changes by Antonio Pérez ape...@skarcha.com:


--
nosy: +skarcha

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



[issue17960] Clarify the required behaviour of locals()

2013-05-12 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue17934] Add a frame method to clear expensive details

2013-05-12 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-05-12 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Stefan, I took a quick look at your patch. There is a couple things that stands 
out.

First, I think the implementation of BINGLOBAL and BINGLOBAL_BIG should be 
moved to another patch. Adding a binary version opcode for GLOBAL is a separate 
feature and it should be reviewed independently. Personally, I prefer the 
STACK_GLOBAL opcode I proposed as it much simpler to implement, but I am biased.

Next, the patch's formatting should be fixed to conform to PEP 7 and PEP 8. 
Make sure the formatting is consistent with the surrounding code. In 
particular, comments should be full sentences that explains why we need this 
code. Avoid adding comments that merely say what the code does, unless the code 
is complex.

In addition, please replace the uses of PyUnicode_InternFromString with the 
_Py_IDENTIFIER as needed. The latter allow the static strings to be garbage 
collected when the module is deleted, which is friendlier to embedded 
interpreters. It is also lead to cleaner code.

Finally, the class method check hack looks like a bug to me. There are multiple 
solutions here. For example, we could fix class methods to be cached so they 
always have the same ID once they are created. Or, we could remove the 'is' 
check completely if it is unnecessary.

--

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



[issue17666] Extra gzip headers breaks _read_gzip_header

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Cherry-picked to 3.2 branch as c31ff361cde3.

--
resolution:  - fixed
status: open - closed

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



[issue17843] Lib/test/testbz2_bigmem.bz2 trigger virus warnings

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Thanks, applied to 3.2 branch.

--
resolution:  - fixed
status: open - closed

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



[issue17857] sqlite modules doesn't build with 2.7.4 on Mac OS X 10.4

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Cherry-picked to 3.2 branch.

--
status: open - closed

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5f62c848f713 by Benjamin Peterson in branch '3.3':
prevent IDLE from trying to close when sys.stdin is reassigned (#17838)
http://hg.python.org/cpython/rev/5f62c848f713

New changeset bc322854c336 by Georg Brandl in branch 'default':
Issue #17838: merge with 3.3
http://hg.python.org/cpython/rev/bc322854c336

--

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



[issue17585] IDLE - regression with exit() and quit()

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
versions:  -Python 3.2

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



[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive

2013-05-12 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

Ok. I thought doc fixes were exempt. Strange policy there.

--

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



[issue15902] imp.load_module won't accept None for the file argument for a C extension

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
status: open - closed

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



[issue17957] remove outdated (and unexcellent) paragraph in whatsnew

2013-05-12 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


Removed file: http://bugs.python.org/file30227/diff

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



[issue17957] remove outdated (and unexcellent) paragraph in whatsnew

2013-05-12 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


Added file: http://bugs.python.org/file30230/diff

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



[issue17585] IDLE - regression with exit() and quit()

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
status: open - closed

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



[issue17957] remove outdated (and unexcellent) paragraph in whatsnew

2013-05-12 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

uploaded the correct one; sori

--

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



[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Please do not comment on policies if you don't understand our release system.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Nick Coghlan

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


--
priority: normal - high

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

3.2?

--

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

I elaborated on this point in 
http://python-notes.boredomandlaziness.org/en/latest/python3/enum_creation.html#support-for-alternate-declaration-syntaxes

However, I'm now wondering if the problem is simply that the no extension of 
enums rule is more restrictive than it needs to be. If you *don't define any 
new methods*, then there's no problem with extending an enumeration - it's only 
the combination of extension and adding extra behaviour which is incoherent.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue15535] Fix pickling efficiency of named tuples in 2.7.3

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 31eaf8a137ea by Georg Brandl in branch '3.2':
Issue #15535: Fix pickling of named tuples.
http://hg.python.org/cpython/rev/31eaf8a137ea

--

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



[issue17843] Lib/test/testbz2_bigmem.bz2 trigger virus warnings

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9da98ab823c9 by Georg Brandl in branch '3.2':
Issue #17843: Remove bz2 test data that triggers antivirus warnings.
http://hg.python.org/cpython/rev/9da98ab823c9

--

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



[issue17857] sqlite modules doesn't build with 2.7.4 on Mac OS X 10.4

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5b5116bf953 by Serhiy Storchaka in branch '3.2':
Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
http://hg.python.org/cpython/rev/d5b5116bf953

--

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



[issue17915] Encoding error with sax and codecs

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1c01571ce0f4 by Georg Brandl in branch '3.2':
Issue #17915: Fix interoperability of xml.sax with file objects returned by
http://hg.python.org/cpython/rev/1c01571ce0f4

--
nosy: +python-dev

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



[issue1159051] Handle corrupted gzip files with unexpected EOF

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 854ba6f414a8 by Georg Brandl in branch '3.2':
Issue #1159051: Back out a fix for handling corrupted gzip files that
http://hg.python.org/cpython/rev/854ba6f414a8

--

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



[issue17666] Extra gzip headers breaks _read_gzip_header

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c31ff361cde3 by Serhiy Storchaka in branch '3.2':
Close #17666: Fix reading gzip files with an extra field.
http://hg.python.org/cpython/rev/c31ff361cde3

--
stage: commit review - committed/rejected

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



[issue17958] int(math.log(2**i, 2))

2013-05-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Sorry: this is not a bug, but a difficult-to-avoid consequence of 
floating-point imprecision: math.log(n, 2) is computed as log(n) / log(2), and 
each of the log computations and the division can introduce small errors.

For what it's worth, Python 3.3 has a `log2` function, which has accuracy 
that's a little bit better than math.log(n, 2), and gives the 'correct' answer 
exact powers of 2.

Closing as invalid.

--
nosy: +mark.dickinson
resolution:  - invalid
status: open - closed

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



[issue17958] int(math.log(2**i, 2))

2013-05-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Postscript: depending on what you're doing, you might also find the 
int.bit_length method helpful.

--

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Not necessary as per msg188301.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

Another approach to handling this, and other, issues is to allow options to 
EnumMeta.  My original aenum code had the default Enum class as unordered, no 
duplicates allowed, non-indexable, etc., but then allowed options to be passed 
in such as DUPLICATES to allow duplicates, ORDERED to add the ge-gt-le-lt 
methods, INDEXED to add __index__, etc.

For the aliasing issue this method is more robust as placeholders are not 
required, and code like this will work:

class Physics(Enum):
e = 2.81847
pi = 3.141596
tau = 2 * pi

To make that code work with placeholders is possible (I have it in aenum) but a 
major pain (I was about to remove it before my offer to help with ref435 was 
accepted).

--
nosy: +ethan.furman

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



[issue17915] Encoding error with sax and codecs

2013-05-12 Thread Georg Brandl

Georg Brandl added the comment:

Fixed in 3.2, 3.3 and default.

--
resolution:  - fixed
status: open - closed

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



[issue1159051] Handle corrupted gzip files with unexpected EOF

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: release blocker - normal

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



[issue1159051] Handle corrupted gzip files with unexpected EOF

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
versions:  -Python 2.7, Python 3.2, Python 3.3

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



[issue1159051] Handle corrupted gzip files with unexpected EOF

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9c2831fe84e9 by Georg Brandl in branch '3.3':
Back out patch for #1159051, which caused backwards compatibility problems.
http://hg.python.org/cpython/rev/9c2831fe84e9

New changeset 5400e8fbc1de by Georg Brandl in branch 'default':
null-merge reversion of #1159051 patch from 3.3
http://hg.python.org/cpython/rev/5400e8fbc1de

--

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



[issue17732] distutils.cfg Can Break venv

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6c5a3d194a10 by Georg Brandl in branch '3.3':
Closes issue #17732: ignore install-directory specific options in
http://hg.python.org/cpython/rev/6c5a3d194a10

--
nosy: +python-dev

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



[issue17958] int(math.log(2**i, 2))

2013-05-12 Thread Mark Dickinson

Mark Dickinson added the comment:

For tracker archaeologists: see also issue #11888, issue #9959.

--

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



[issue17961] Use enum names as values in enum.Enum convenience API

2013-05-12 Thread Nick Coghlan

New submission from Nick Coghlan:

I encountered an interesting suggestion [1] regarding the enum.Enum convenience 
API: use the member names as their values, rather than the current integers 
starting from one.

Since we're now using definition order rather than value order for iteration, 
this suggestion makes a lot of sense to me.

(again, posting this as something to consider after the accepted PEP is 
incorporated)

[1] http://www.acooke.org/cute/Pythonssad0.html

--
messages: 189013
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Use enum names as values in enum.Enum convenience API
type: enhancement

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



[issue17961] Use enum names as values in enum.Enum convenience API

2013-05-12 Thread Nick Coghlan

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


--
dependencies: +Code, test, and doc review for PEP-0435 Enum
versions: +Python 3.4

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Another post-incorporation proposal (issue 17961) relating to the values used 
for the functional API.

--

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

Make it simpler:

class EnumMeta():
allow_subclass = False


class MyEnumMeta(EnumMeta):
allow_subclass = True

--

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



[issue17934] Add a frame method to clear expensive details

2013-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Mostly looks good to me, but I think I'd prefer that attempts to clear
 a running frame raise RuntimeError with an appropriate message.

Hmm, why not. My intuition was to make frame.clear() a best-effort
method, but this sounds ok too.

 I also wonder how this might relate to Eric Snow's proposal to
 reference the currently executing function from the frame object (see
 issue 12857). It seems to me that the f_func pointer in that patch
 could serve the same purpose as the f_executing boolean flag in this
 patch, while providing additional information about the execution
 context.

Yes, perhaps. Then Eric's patch can incorporate that change once the
frame.clear() patch is committed.

 (We may want to add a clear_frames convenience method to tracebacks
 as well)

That, or in the traceback module. The reason I'm proposing this one as a
frame method is that it can't be done in pure Python.

--

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



[issue17961] Use enum names as values in enum.Enum convenience API

2013-05-12 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Stefan, I took a quick look at your patch. There is a couple things
 that stands out.

It would be nice if you could reconcile each other's work. Especially so
I don't re-implement framing on top of something else :-)

 Adding a binary version opcode for GLOBAL is a separate feature and it
 should be reviewed independently.

Well, it's part of the PEP.

 Personally, I prefer the STACK_GLOBAL opcode I proposed as it much
 simpler to implement, but I am biased.

I agree it sounds simpler. I hadn't thought about it when first writing
the PEP.

--

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



[issue17732] distutils.cfg Can Break venv

2013-05-12 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue17962] Broken OpenSSL version in Windows builds

2013-05-12 Thread Antoine Pitrou

New submission from Antoine Pitrou:

3.3 and default are currently fetching OpenSSL 1.0.1d for the Windows builds.

It seems OpenSSL 1.0.1d was a kind of brown paper bag release, they've 
released 1.0.1e since (some of test_ssl can fail on 1.0.1d and succeed on 
1.0.1e, as experienced on my Linux setup; the Windows buildbots also exhibit 
similar failures).

Following is their description of the fix:

“Changes between 1.0.1d and 1.0.1e [11 Feb 2013]

  *) Correct fix for CVE-2013-0169. The original didn't work on AES-NI
 supporting platforms or when small records were transferred.
 [Andy Polyakov, Steve Henson]”

--
components: Build, Windows
messages: 189018
nosy: georg.brandl, larry, loewis, pitrou
priority: release blocker
severity: normal
status: open
title: Broken OpenSSL version in Windows builds
type: behavior
versions: Python 3.3, Python 3.4

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

After more thought, I think we should leave the shortened version of 
_StealthProperty as is.

The reasoning being that if _StealthProperty does the __getattr__ lookup 
itself, and fails, it will return an AttributeError... and then Python will use 
__getattr__ again to try and find the attribute.

So I'll add a comment into the shortened version and leave it at that.

--

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



[issue17425] Update OpenSSL versions in Windows builds

2013-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Opened #17962 to tackle the broken OpenSSL issue.

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

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Eli Bendersky

Eli Bendersky added the comment:

Nick, could you open a separate issue for the frame hack discussion, like you 
did for the other things? You can make this one depend on it, if you feel it's 
a blocker, but let's please not intermix more discussion here.

--

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



[issue17961] Use enum names as values in enum.Enum convenience API

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Specifically, my suggestion is that for auto-created enum members, the 
invariant asset x.value == str(x) should hold.

In flufl.enum, using integers made sense because it relies on sorting of values 
to determine the iteration order. That's no longer a concern for the standard 
library version, as iteration has been changed to use definition order.

--

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



[issue17961] Use enum names as values in enum.Enum convenience API

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

In flufl.enum integers also made since as that was the default back-end data 
type.

Currently, the functional method allows a type declaration.  The behavior there 
could be tweaked such that no specification meant no value (a truly valueless 
enum!), type=int means ints starting from 1, type=str meant str values of 
names, any other value and you better had made your own enum derived class to 
support it.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Hmm, that's an interesting point about allowing operations on the already 
defined values.

You could get around that by requiring that the wrapper be explicit when 
definined the alias:

 class Shape(enum.Enum):
...   rectangle = 1
...   oblong = enum.alias(rectangle)

Or, equivalently:


 class Shape(enum.Enum):
...   rectangle = 1
...   oblong = enum.alias(1)

So simple typos would trigger an error by default, and the enum.alias wrapper 
would tell the namespace (or the metaclass) hey, this should be an alias for 
another value already defined here.

I definitely don't want us to turn the metaclass into a swiss army knife of 
behavioural options - I'm happy with customisation hooks in the metaclass on 
that front, as I believe it is an effective way to discourage excessive use of 
metaclass magic without preventing it when it is necessary.

--

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Simply removing the restriction isn't actually appropriate, as the variants 
that allow addition of new members should *not* allow addition of new 
descriptors.

That's why I'm wondering if the current subclassing restriction is wrong: if 
you subclass an Enum derivative that already has defined members, then adding 
new members is OK, but adding new behaviour is not. If you subclass an Enum 
derivative with no members, then adding either members or behaviours is fine.

If we relaxed the no subclassing rule to no new non-members, then this 
Enums would be natively extensible and this customisation hack wouldn't be 
necessary at all.

We have plenty of time before 3.4 - let's get the existing implementation in 
before worrying further about this.

--

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



[issue17934] Add a frame method to clear expensive details

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 to all Antoine's replies :)

--

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Eli Bendersky

Eli Bendersky added the comment:

Ethan, I pasted the minimized version to point out the problem; I fully agree 
it should do the getattr lookup because otherwise it's very difficult to 
understand what's going on. Let's keep exceptions for actual exceptional 
situations and explicitly code the normal path.

Also, _MemberOrProperty is probably a more descriptive name.

--

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Nick Coghlan

New submission from Nick Coghlan:

(Split off from issue 17947)

collections.namedtuple includes a frame hack that attempts to make the 
functional API work for ordinary module level assignments:

try:
result.__module__ = _sys._getframe(1).f_globals.get('__name__', 
'__main__')
except (AttributeError, ValueError):
pass


I *really* don't like the fact that this hack is being incorporated into the 
PEP 435 implementation as well, when that API has been designed to include an 
explicit cross-implementation workaround for this case.

Eli asked me to move the discussion over to a new issue to allow the 
implementation issue to focus on incorporating the PEP as is.

Issue 17941 (the explicit module keyword-only argument) suggest incorporating 
PEP 435's robust, cross-implementation way to support pickling in the 
functional API into collection namedtuple as well, suggesting to me that the 
frame hack should be deprecated, not propagated further.

The main reason I don't like it is not the fact it doesn't work reliably on 
other implementations, but the fact it doesn't work reliably in CPython either 
- if you create a helper function, then the frame hack will pick up the module 
where the helper function lives rather than where you ultimately store the 
created object. Without some explicit way of telling the created object the 
final destination (whether through an argument or through new syntax and a name 
binding protocol), I don't see a way to resolve this dilemna in a robust way.

However, Guido tells me that he really wants to keep the frame hack (and 
include it for PEP 435 as well), so this issue is basically about documenting 
that rationale somewhere.

--
assignee: gvanrossum
messages: 189028
nosy: eli.bendersky, gvanrossum, ncoghlan
priority: normal
severity: normal
status: open
title: Deprecate the frame hack for implicitly getting module details
type: enhancement
versions: Python 3.4

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Eli: done, created as #17963

--

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Nick Coghlan

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


--
dependencies: +namedtuple should support fully qualified name for more portable 
pickling

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

Not trying to push, but if I don't write it down now, I'll forget later. ;)

What does adding new members gain us?  If I have a func xyz() that's expecting 
a Color, a MoreColor will work sometimes and blow up other times.

Or are you saying that we may have a function mno() that takes a Color or a 
MoreColor?

--

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
nosy: +rhettinger

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



[issue17954] Support creation of extensible enums through metaclass subclassing

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, you're right, I forgot that was the other reason for disallowing extensions 
through subclassing.

To get extensions to work right, you need to flip it around so that 
isinstance(Color.red, MoreColor) is True, while isinstance(MoreColor.magenta, 
Color) is False.

--
dependencies:  -Code, test, and doc review for PEP-0435 Enum
resolution:  - invalid
status: open - closed

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

I believe Guido will be happy to replace the frame hack once we have something 
better, such as a way to implicitly (or explicitly in the case of helper 
functions) pass the calling  module's name.

Maybe a global __calling_module__ that a function can look at... or something 
similar, anyway.

--
nosy: +ethan.furman

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, but I think it's categorically impossible to make that work reliably 
without new syntax and a name binding protocol (or something equivalent).

Due to the existence of the global keyword, the frame stack and normal 
assignment syntax simply don't provide adequate information for us to tell the 
difference between incidental assignments in a helper function and definite 
assignments that represent the ultimate destination.

And if the solution involves new syntax, then the frame hack will have to be 
deprecated at some point anyway.

--

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Oops, that was supposed to be definitive assignments in my previous comment.

--

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



[issue17962] Broken OpenSSL version in Windows builds

2013-05-12 Thread Stefan Drees

Changes by Stefan Drees ste...@drees.name:


--
nosy: +sdrees

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-05-12 Thread Ethan Furman

Ethan Furman added the comment:

Here's the latest patch.

Note that the functional API portion is broken, and I'll get back to that this 
evening.  Please only comment on the working code.  ;)

I'll make that _MemborOrProperty name change then as well.

--
Added file: http://bugs.python.org/file30231/pep-0435.05.patch

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



[issue17606] xml.sax.saxutils.XMLGenerator cannot output with the correct encoding

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a32a3b79f5e8 by Serhiy Storchaka in branch '2.7':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/a32a3b79f5e8

New changeset e730447caf20 by Serhiy Storchaka in branch '3.3':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/e730447caf20

New changeset 00afa5350f6a by Serhiy Storchaka in branch 'default':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/00afa5350f6a

--

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



[issue17606] xml.sax.saxutils.XMLGenerator doesn't support byte strings

2013-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Sebastian for your report and patch.

--
assignee:  - serhiy.storchaka
components: +Library (Lib)
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
title: xml.sax.saxutils.XMLGenerator cannot output with the correct encoding - 
xml.sax.saxutils.XMLGenerator doesn't support byte strings
type: crash - behavior
versions: +Python 3.3, Python 3.4

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



[issue17962] Broken OpenSSL version in Windows builds

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

The following patch will make use of 1.0.1e version of OpenSSL

--
keywords: +patch
nosy: +Yogesh.Chaudhari
Added file: http://bugs.python.org/file30232/issue17962.patch

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I mean applying both issue17585 and issue17838 patches.

--

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
nosy: +gvanrossum

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



[issue17956] add ScheduledExecutor

2013-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

1. Extends an abstract interface to support of a priority and absolute time.
2. Subclass sched.scheduler from this interface and implement missing methods.

--

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



[issue17956] add ScheduledExecutor

2013-05-12 Thread Antoine Pitrou

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


--
versions: +Python 3.4

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



[issue17128] OS X system openssl deprecated - installer should build local libssl

2013-05-12 Thread Stefan Drees

Changes by Stefan Drees ste...@drees.name:


--
nosy: +dilettant

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Stefan Drees

Changes by Stefan Drees ste...@drees.name:


--
nosy: +dilettant

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



[issue17914] add os.cpu_count()

2013-05-12 Thread Stefan Drees

Changes by Stefan Drees ste...@drees.name:


--
nosy: +dilettant

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That's way too much magic for my taste.

--
nosy: +pitrou

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



[issue17959] Alternate approach to aliasing for PEP 435

2013-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Also, since we currently don't forbid the following:

 {'a': 1, 'a': 2}
{'a': 2}

I don't see why enums should be any different. Recommend closing.

--

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



[issue11016] stat module in C

2013-05-12 Thread Stefan Drees

Changes by Stefan Drees ste...@drees.name:


--
nosy: +dilettant

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



[issue17963] Deprecate the frame hack for implicitly getting module details

2013-05-12 Thread Brett Cannon

Brett Cannon added the comment:

If you read the docs for sys._getframe() 
(http://docs.python.org/3/library/sys.html#sys._getframe) we explicitly state 
that the function should be considered an implementation detail for CPython. 
While Nick doesn't want to argue from the VM angle, I will.

I would prefer to not rely on this hack in the stdlib to not put the other VMs 
at a disadvantage. Nick also has a good point that it is at best a heuristic as 
you can fool it into using the wrong result.

At minimum I think the keyword argument for the module being used should be 
provided and documented that if it isn't provided then pickling is wishy-washy 
based on how you call the function and that it is not cross-VM compatible. But 
knowing that users won't clearly read the docs if it just happens to work in 
the interpreter and that is partial luck because of the possible indirection 
issue Nick pointed out, I think it would be better to not rely upon 
sys._getframe() and just ask people to explicitly specify the module if they 
happen to care about pickling *and* are using the functional API for enums.

--
nosy: +brett.cannon

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



[issue10766] optparse uses %s in gettext calls

2013-05-12 Thread Mark Lawrence

Mark Lawrence added the comment:

I don't understand this.  Fixes have already been committed via #4391 but this 
fix couldn't go ahead.  Can somebody please clarify the situation.

--
nosy: +BreamoreBoy

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



[issue11011] More functools functions

2013-05-12 Thread Mark Lawrence

Mark Lawrence added the comment:

To summarize flip, const and identity won't happen, trampoline needs an 
external recipe or blog post and compose is the only one that's likely to 
happen.  Opinions please gentlemen.

--
nosy: +BreamoreBoy

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



[issue8841] getopt errors should be specialized

2013-05-12 Thread Mark Lawrence

Mark Lawrence added the comment:

#11371 was closed on 2011-03-21 so what if anything needs doing here?

--
nosy: +BreamoreBoy

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

@Eric:
when you say: If the type of the object really is object, then it can use 
string formatting. It's only for non-objects that I want to add the error.. 

I am confused. Let me demonstrate what I'm thinking according to the statement 
above. 

First let us take a 'non-object':
 integer=1
 type(integer) != object
True
As of now it returns the following:
 integer.__format__(s)
'1'
Which seems natural.
But after this patch should it return an error

Also now consider an object:
 f = object()
 type(f)
class 'object'
This will return the following after the patch as it does now which is:
 f.__format__('')
'object object at 0xb75b7b48'


Does this mean that 'integer' should give an error, however, 'f' should give 
something that appears messy?

I may be mistaken in my interpretation of the statement, so kindly let me know 
if there is something else that I am not clearly understanding.

--
nosy: +Yogesh.Chaudhari

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

Please replace 
integer.__format__(s)
with 
integer.__format__('')

--

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



[issue17956] add ScheduledExecutor

2013-05-12 Thread Charles-François Natali

Charles-François Natali added the comment:

 1. Extends an abstract interface to support of a priority

I'm not sure I see the use case for priority support, do you have a
sample use case?

Furthermore, the executor is backed by a thread pool, so tasks can be
run concurrently.

Finally, the ordering is based on real-clock time - not user-provided
timefunc and delayfunc: so the probability of having identical
scheduled time (priority is only used for ties) is virtually 0.

  and absolute time.

If you want and absolute time, you can simply do:

p.schedule(abstime - time(), fn, args)

I don't see the need to complicate the API.

 2. Subclass sched.scheduler from this interface and implement missing methods.

There again, I don't see the need.
The goal of ScheduledExecutor is to be consistent with the Executor
interface and futures, not being backward-compatible with the sched
module.

Also, the sched module simply can't support some operations: for
example, it's impossible to have the schedule.run() method wake up
when a new event with a deadline easiest than the current one is
inserted.

Really, there is now reason to make it compatible or similar to the
sched module: this will - it it gets accepted - effectively deprecate
threading.Timer and the sched module (except that the later supports
user-provided time and delay functions, I don't know how often those
are used).

--
Added file: http://bugs.python.org/file30233/scheduled-3.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17956
___diff -r 4b3238923b01 Lib/concurrent/futures/__init__.py
--- a/Lib/concurrent/futures/__init__.pyFri May 10 19:57:44 2013 -0700
+++ b/Lib/concurrent/futures/__init__.pySun May 12 18:49:56 2013 +0200
@@ -15,4 +15,5 @@
   wait,
   as_completed)
 from concurrent.futures.process import ProcessPoolExecutor
-from concurrent.futures.thread import ThreadPoolExecutor
+from concurrent.futures.thread import (ScheduledThreadPoolExecutor,
+   ThreadPoolExecutor)
diff -r 4b3238923b01 Lib/concurrent/futures/_base.py
--- a/Lib/concurrent/futures/_base.py   Fri May 10 19:57:44 2013 -0700
+++ b/Lib/concurrent/futures/_base.py   Sun May 12 18:49:56 2013 +0200
@@ -4,6 +4,7 @@
 __author__ = 'Brian Quinlan (br...@sweetapp.com)'
 
 import collections
+import functools
 import logging
 import threading
 import time
@@ -499,6 +500,87 @@
 self._condition.notify_all()
 self._invoke_callbacks()
 
+
+@functools.total_ordering
+class ScheduledFuture(Future):
+A future whose execution can be delayed, one-shot or periodic.
+
+ScheduledFutures support mutual ordering based on their scheduled execution
+time, which makes them easy to use in e.g. priority queues.
+
+
+def __init__(self, init_time, period=0, delay=0):
+Initializes the future. Should not be called by clients.
+
+Args:
+init_time: The initial absolute execution time, in seconds since
+   epoch.
+period:The execution period, in seconds.
+delay: The execution delay, in seconds.
+
+If a period is given, then the task will be scheduled every `period`
+seconds: each execution will start `period` seconds after the starting
+time of the previous execution: there will be no drift incurred by the
+amount of time the task takes to execute.
+Conversely, if a delay is given, then there will always be `delay`
+seconds between sequential executions: each execution will start
+`delay` seconds after the ending time of the previous execution: there
+will be a drift incurred by the amount of time the task takes to
+execute.
+If neither a period nor a delay are specified, then the execution will
+occur exactly once (one-shot).
+
+The future's result can only be retrieved for one-shot execution,
+since there's no meaningful result for periodic execution (for those,
+calling result()/exception() will block until the future is cancelled).
+
+super().__init__()
+self._sched_time = init_time
+if period  0:
+# step  0 = fixed rate
+self._step = period
+elif delay  0:
+# step  0 = fixed delay
+self._step = -delay
+else:
+# step == 0 = one-shot
+self._step = 0
+
+def is_periodic(self):
+Return True if the future execution is periodic.
+return self._step != 0
+
+def get_delay(self):
+Return the delay until the next scheduled execution, in seconds.
+with self._condition:
+return self._sched_time - time.time()
+
+def _get_sched_time(self):
+with self._condition:
+return 

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2013-05-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Some comments for the first patch (I haven't really looked at the second):

- I would much prefer PyLong_AsIntMax_t not to use nb_int;  it should work only 
for instances of 'int' (just as PyLong_AsSsize_t and PyLong_AsSize_t currently 
do).

- There's a missing 'versionadded' for PyLong_AsIntMax_t in the docs.

- Will AC_CHECK_SIZEOF(intmax_t) work on platforms that don't define intmax_t?  
I don't know whether the #define created by the earlier AC_TYPE_INTMAX_T is 
available at that point.  We'll probably find out from the buildbots.

- Do we also need an addition to PC/pyconfig.h to define (u)intmax_t and 
SIZEOF_(U)INTMAX_T on Windows?

- For the PyLong_As* functions, it may be more efficient to code the conversion 
directly instead of using _PyLong_AsByteArray.

- The PyLong_As* functions assume that intmax_t and uintmax_t have no padding 
bits, no trap representation, and (in the case of intmax_t) use two's 
complement.  I think it's fine to assume all these things, but we should also 
either document or test those assumptions.

- The patch lacks tests.

--
nosy: +skrah

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



[issue17962] Broken OpenSSL version in Windows builds

2013-05-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d047928ae3f6 by Georg Brandl in branch '3.3':
Closes #17962: Build with OpenSSL 1.0.1e on Windows.
http://hg.python.org/cpython/rev/d047928ae3f6

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

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



[issue17914] add os.cpu_count()

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

@STINNER:
I don't understand. Where exactly should the patch handle this?

--

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



[issue17890] argparse: mutually exclusive groups full of suppressed args can cause AssertionErrors

2013-05-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Argparse is out of my area of competence/experience. I have added a couple of 
people who have worked on argparse in the past and should be better able to 
review or suggest another reviewer.

--
nosy: +bethard, r.david.murray

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



  1   2   >