[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

Alexander:  applying this is fine by me.  As a user-visible change, yes, I 
think it should have a Misc/NEWS entry.  (It's too small a change to be worth 
mentioning in the 'whatsnew' documents though.)

--

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



[issue18642] enhancement for operator 'assert'

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

Okay, I'm closing this for now.  Al Korgun and mrDoctorWho0 .: if you think 
this idea deserves wider discussion, you should feel free to bring it up again 
on the python-ideas mailing list;  that's a better forum to discuss these sorts 
of language changes anyway (too few developers will look at any particular bug 
on the bug tracker; many more read python-ideas).  It seems unlikely to me that 
the idea would receive widespread acceptance, but I may well be wrong.

--
resolution:  - rejected
status: open - closed

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman

Ethan Furman added the comment:

I don't understand.

Type checks are already performed throughout the code (int, float, True, False, 
NaN, Inf, etc.).

What will opereator.index buy us?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18264
___
___
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-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

 With that fixed, I am inclined to close this.

Agreed.  I'll try to find some time for a PEP at some point in the next few 
weeks.

 I had thought of a set-mode function (method), but anticipate objection
 to such modal action-at-distance behavior.

Yes;  I'm not a big fan of global state[*] either in general, but there aren't 
many other good options:  specifying the mode to each operation individually 
would be painful and prevent natural use of infix operators, generally making 
code more unreadable.  There *would* need to be some kind of set-mode function 
(or perhaps writable sys module attribute) as you suggest, but the context 
manager could be promoted as the recommended way to change the state in a 
manner that's reasonably safe and explicit.


[*] We'd want it to be thread-local rather than global, of course.

--

___
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 in division: wrong message

2013-08-04 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
resolution:  - postponed
status: open - closed

___
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



[issue11033] ElementTree.fromstring doesn't work with Unicode

2013-08-04 Thread Brendan O'Connor

Brendan O'Connor added the comment:

Sure, go ahead and close it.  I was just trying to be helpful and report a bug 
in the Python standard library.  I don't use Python 3.3 so cannot test it.

--
nosy: +Brendan.OConnor

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The two isinstance checks that bother me are the ones for int and float. 
However, given that the JSON serialiser *already* includes those explicit 
checks, I now think it makes sense to just do the minimal fix of coercing 
subclasses to the base type for both of those cases, especially since such a 
change should be able to be ported to simplejson as well.

Anything more elaborate (including making JSON explicitly enum aware, or else 
offering a new encoder that supports singledispatch) should be handled in a 
separate issue.

--

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which replace the open ... close idiom to the with open 
idiom in IDLE.

--
stage: commit review - patch review
Added file: http://bugs.python.org/file31144/idle_with_open.patch

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which replace the open ... close idiom to the with open 
idiom in IDLE.

--
Added file: http://bugs.python.org/file31145/idle_with_open.patch

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



[issue14012] Misc tarfile fixes

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated for 3.4 patch.

--
Added file: http://bugs.python.org/file31146/tarfile-misc-bugs-3.4.diff

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



[issue8865] select.poll is not thread safe

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Gregory, could you commit the patch or allow me to do this?

--

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



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

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

See the related python-dev discussion started by Mark Shannon here:

http://mail.python.org/pipermail/python-dev/2013-March/125022.html

and continuing well into April here:

http://mail.python.org/pipermail/python-dev/2013-April/125042.html

The consensus that emerged from that thread seems to be that calls to 
operator.index and to int() should always return something of exact type int.

The attached patch:

- Raises TypeError for implicit calls to nb_int that fail to return something 
of exact type int.  (Results of direct calls to __int__ are not checked.)

- Ensures that *all* conversions from a non-int to an int via nb_int make use 
of the nb_int slot, even for int subclasses.  Prior to this patch, some of the 
PyLong_As... functions would bypass __int__ for int subclasses.

- Adds a new private _PyLong_FromNbInt function to Objects/longobject.c, so 
that we have a single place for performing these conversions and making type 
checks, and refactors existing uses of the nb_int slot to go via this function.

- Makes corresponding changes for nb_index, which should address the original 
bug report.

I guess this may be too dangerous a change for Python 3.4.  In that case, I 
propose raising warnings instead of TypeErrors for Python 3.4 and turning those 
into TypeErrors in Python 3.5.

One other question:  should direct calls to __int__ and __index__ also have 
their return values type-checked?  That doesn't seem to happen at the moment 
for other magic methods (see below), so it would seem consistent to only do the 
type checking for interpreter-generated implicit calls to __int__ and 
__index__.  Nick: any opinion?

 class A:
... def __len__(self): return a string
... def __bool__(self): return another string
... 
 a = A()
 a.__len__()
'a string'
 a.__bool__()
'another string'
 len(a)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'str' object cannot be interpreted as an integer
 bool(a)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: __bool__ should return bool, returned str

--
assignee: docs@python - mark.dickinson
components: +Interpreter Core -Documentation
keywords: +patch
nosy: +ncoghlan
Added file: http://bugs.python.org/file31147/issue17576.patch

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



[issue18651] test failures on KFreeBSD

2013-08-04 Thread Matthias Klose

New submission from Matthias Klose:

Some tests fail on KFreeBSD, attaching a first patch from Petr Salinger. 

see http://bugs.debian.org/708653 for further issues.

Ronald, could you check if that this works for OSX too?

--
components: Tests
files: kfreebsd.diff
keywords: patch
messages: 194336
nosy: doko, ronaldoussoren
priority: normal
severity: normal
status: open
title: test failures on KFreeBSD
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31148/kfreebsd.diff

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



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

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

New patch that replaces the TypeErrors with warnings and fixes a refleak in the 
original patch.

--
Added file: http://bugs.python.org/file31149/issue17576_v2.patch

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Hynek Schlawack

New submission from Hynek Schlawack:

Let met try to get you sold on adding the “first” function I released on PyPI 
roughly a year ago:

https://github.com/hynek/first

It’s a very nice complement to functions like `any()` or itertools. I consists 
effectively of 9 lines of code but it proved extremely handy in production.

***

It returns the first true value from an iterable or a default:

 first([0, None, False, [], (), 42])
42

 first([0, None, False, [], ()], default=42)
42

Additionally it also allows for a key function:

 first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
4

***

First happens to be especially useful together with the re module:

import re

from first import first


re1 = re.compile('b(.*)')
re2 = re.compile('a(.*)')

m = first(regexp.match('abc') for regexp in [re1, re2])
if not m:
   print('no match!')
elif m.re is re1:
   print('re1', m.group(1))
elif m.re is re2:
   print('re2', m.group(1))


All the knee-jerk alternatives to it have some shortcomings:

next(itertools.ifilter(None, (regexp.match('abc') for regexp in [re1, re2])), 
None)
next((regexp.match('abc') for regexp in [re1, re2] if regexp.match('abc')), 
None)

None of them is Pythonic and the second one even has to call match() twice, 
which is *not* a cheap method to call.

Here the first version for comparison again:

first(regexp.match('abc') for regexp in [re1, re2])

It doesn’t even exhaust the iterator if not necessary.

***

I don’t cling to neither the name or the exact function signature (although it 
got polished with the help of several people, two of them core developers).  I 
also don’t really care whether it gets added along of any() or put into 
itertools.  I just know that I and several other people would appreciate to 
have such a handy function in the stdlib – I even got an e-mail from OpenStack 
folks asking when it will be added because they would like to use it and 
there’s even a debian package by now: 
http://packages.debian.org/unstable/python-first

There’s also this question on StackOverflow: 
http://stackoverflow.com/questions/1077307/why-is-there-no-firstiterable-built-in-function-in-python
 which is nice but doesn’t fix the subtleties like when there is no true value 
etc which makes it useless for production code and one has to write boilerplate 
code every single time.

It was even one of five Python packages Lukasz Langa deemed worthy to be 
highlighted in his PyCon 2013 lightning talk: 
http://youtu.be/1vui-LupKJI?t=20m40s

FWIW, SQL has a similar function called COALESCE ( 
https://en.wikipedia.org/wiki/Null_(SQL)#COALESCE ) which only handles NULL 
though.

***

I’ll happily respond to any questions or concerns that may arise and supply a 
patch as soon as we agree on a place to add it.

--
assignee: hynek
components: Library (Lib)
messages: 194338
nosy: hynek, lukasz.langa, ncoghlan, rhettinger
priority: normal
severity: normal
status: open
title: Add a “first” function to the stdlib
type: enhancement
versions: Python 3.4

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e2ba4592ce3a by Serhiy Storchaka in branch '2.7':
Issue #18647: Temporary disable the nothing to repeat check to make buildbots 
happy.
http://hg.python.org/cpython/rev/e2ba4592ce3a

--

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



[issue13612] xml.etree.ElementTree says unknown encoding of a regular encoding

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch for 2.7.

--
Added file: http://bugs.python.org/file31150/expat_buffer_overflow-2.7.patch

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The function name looks a little misleading. I expected first([0, None, False, 
[], (), 42]) returns 0.

--
nosy: +serhiy.storchaka

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



[issue18201] distutils write into symlinks instead of replacing them

2013-08-04 Thread Michał Górny

Michał Górny added the comment:

Oh, sorry. I've looked throughout the code again and it seems that distutils is 
doing the right thing. It's setuptools/distribute that is broken.

--
resolution:  - invalid
status: open - closed

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

It's a direct counterpart to any() and all() - first([0, [], ()]) is None for 
the same reason that any([0, [], ()]) and all([0, [], ()]) are both False.

If first returned the actual first item in the iterable (regardless of truth 
value), then it would just be next under a different name, which would be 
rather pointless.

That said, if first is deemed too ambiguous, then I believe filterednext 
would be a reasonable more explicit name:

 filterednext([0, None, False, [], (), 42])
42

 filterednext([0, None, False, [], ()], default=42)
42

 filterednext([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
4

 m = filterednext(regexp.match('abc') for regexp in [re1, re2])

I also believe itertools would be a more appropriate initial home than the 
builtins.

--

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



[issue13238] Add shell command helpers to subprocess module

2013-08-04 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

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



[issue17684] Skip tests in test_socket like testFDPassSeparate on OS X

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Charles-Francois: why did you commit this to default only, and not to 3.3?
(see also issue18651)

--
nosy: +loewis

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



[issue18651] test failures on KFreeBSD

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Note that 3.4 will need a different patch, due to issue17684.

--
nosy: +loewis

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In this case it would be pointless too. It is just

next(filter(key, iterable), default)

Are you need a special function for combination of two builtins?

--

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



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

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The deprecation warning version looks good to me.

Something I'll mention explicitly (regarding the PyCon discussions that Eric 
mentioned above), is that we unfortunately couldn't do something like this for 
the various concrete APIs with overly permissive subclass checks. For those 
APIs, calling them directly was often the *right* thing for simple subtypes 
implemented in C to use to call up to the parent implementation.

This case is different, as it's the *abstract* APIs that currently have the 
overly permissive checks.

--

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Hynek Schlawack

Hynek Schlawack added the comment:

`filter()` exhausts the full iterator which is potentially very expensive – 
like in conduction with regular expressions.

--

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I also think it should go to itertools.

I also found the name first confusing, in particular since it means what 
Serhiy assumes in LISP, which might be familiar to people interested in 
functional list processing. Also, Ruby and Smalltalk use first in that sense.

To add to the bike shedding, I propose find_if (from LISP), coalesce (from 
SQL), or detect (from Smalltalk).

-1 on calling the filter function key=. How about pred= (like all other 
itertools predicates) or filter=?

--
nosy: +loewis

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Serhiy, Hynek covered the issue with the status quo in the original
proposal.The existing alternative are painful to try and decipher by
comparison with the named function:

filterednext([0, None, False, [], (), 42])
vs
next(filter(None, [0, None, False, [], (), 42]))

filterednext([0, None, False, [], ()], default=42)
vs
next(filter(None, [0, None, False, [], (), 42]), 42)

filterednext([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
vs
next(filter(lambda x: x % 2 == 0, [1, 1, 3, 4, 5]))

m = filterednext(regexp.match('abc') for regexp in [re1, re2])
vs
m = next(filter(None, (regexp.match('abc') for regexp in [re1, re2])))

Hynek - the Python 3 filter is an iterator, so it works like the
itertools.ifilter version in Python 2.

--

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Hynek Schlawack

Hynek Schlawack added the comment:

Ah ok sorry. Anyhow, it’s just a very common idiom that should be easy and 
readable.

As said, I’m not married to any names at all and would happily add a 
compatibility package to PyPI with the new names/parameters.

--

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Nick: that the code is difficult to decipher is really the fault of functional 
programming, which is inherently difficult to decipher (since last function 
applied is written first).

Explicit iteration is easier to read. I would write Hynek's example as

for r in (re1, re2):
m = r.match('abc')
if not m:
print('No match)
elif r is re1:
print('re1', m.group(1))
elif r is re2:
print('re1', m.group(1))
break # always

This is only two additional lines, very Pythonic (IMO), and doesn't invoke 
match unnecessarily.

--

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



[issue18652] Add a “first” function to the stdlib

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Regarding the key parameter name, I believe this is closer to itertools.groupby 
(which uses key= as an optional argument, akin to min, max and sorted) than 
it is to filterfalse, dropwhile or takewhile (which use pred as the first 
positional argument)

The only use of pred in the optional key argument sense appears to be the 
quantify recipe.

+1 for itertools.coalesce, taking the name from SQL. It's designed to serve 
exactly the same purpose as COALESCE does there, doesn't risk confusion with 
next-like behaviour the way first does and hints strongly at the fact it is a 
reduction operation from an iterable to a single value.

--

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



[issue18652] Add a “first”-like function to the stdlib

2013-08-04 Thread Hynek Schlawack

Hynek Schlawack added the comment:

Martin, I don’t find the loop easier to read because you have to *remember* the 
`break` otherwise “weird stuff happens”.

Coalesce seems common enough, I would +1 on that too.

--
title: Add a “first” function to the stdlib - Add a “first”-like function to 
the stdlib

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

(Updated the issue title to reflect the currently proposed name and location 
for the functionality)

While I'm a fan of explicit iteration as well (inside every reduce is a loop 
trying to get out), I think the fact Martin's explicit loop is buggy (it will 
never match re2 as it always bails on the first iteration) helps make the case 
for coalesce. The correct explicit loop looks something like this:

for r in (re1, re2):
m = r.match('abc')
if m is None:
continue
if r is re1:
print('re1', m.group(1))
elif r is re2:
print('re1', m.group(1))
break # Matched something
else:
print('No match')

(Or the equivalent that indents the loop body further and avoids the continue 
statement)

The coalesce version has a definite advantage in not needing a loop else clause 
to handle the nothing matched case:

m = coalesce(regexp.match('abc') for regexp in [re1, re2])
if m is None:
print('no match!')
elif m.re is re1:
print('re1', m.group(1))
elif m.re is re2:
print('re2', m.group(1))

--
title: Add a “first”-like function to the stdlib - Add itertools.coalesce

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Simplicity is in the eye of the beholder, yet... you need to remember the break 
when *writing* the code, so the loop might be more difficult to write (but 
then, I need to remember/lookup the function name and parameters for 
coalesce)... when reading the code, the break is already there, and easy to 
notice. With Nick's remark, it's even more obvious that it is difficult to 
write :-)

If an unknown (to the reader) function is used, reading the code becomes 
actually difficult, since the reader either needs to guess what the function 
does, or look it up.

Note that I'm not objecting the addition of the function (I'm neutral), just 
the claim that there are no simple alternatives. I'm neutral because it falls 
under the not every two-line function needs to go into the standard library 
rule; but then, if it is really popular, it helps readability if it is in the 
library (rather than duplicated by users).

--

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



[issue1300] subprocess.list2cmdline doesn't do pipe symbols

2013-08-04 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

Maybe the solution is to make what I was trying to do easier without
fooling with the shell instead of playing the fool's game of trying to
improve the ability to deal with the shell so we can pass things
through it unnecessarily.

You are too harsh for yourself :) We should be able to make use of shell easily 
the same way it's possible in other languages like Perl or Ruby.

It sure would be nice on Windows to have an equivalent of
list2cmdline() that works for the shell.

I agree. See issue 13238 for a list of libraries which make is easier to use 
shell from Python.

--
nosy: +piotr.dobrogost

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



[issue18653] mingw-meta: build core modules

2013-08-04 Thread Roumen Petrov

New submission from Roumen Petrov:

split of issue3871 - this is meta issue only for part related to build core. 
Remark: build of interpreter core is in issue17605 .

Now split is:
- 01 issue13756 : Python make fail on cygwin
- 02 issue17219 : add current dir in library path if building python standard 
extensions
- 03 issue6672   : Add Mingw recognition to pyport.h to allow building 
extensions
- 04 issue18485 : configure for shared build
- 05 issue18486 : dynamic loading support
- 06 issue18487 : implement exec prefix
- 07 issue18495 : ignore main program for frozen scripts
- 08 issue18496 : setup exclude termios module
- 09 issue18497 : setup _multiprocessing module
- 10 issue18498 : setup select module
- 11 issue18499 : setup _ctypes module with system libffi
- 12 issue18500 : defect winsock2 and setup _socket module
- 13 issue18630 : exclude unix only modules
- 14 issue18631 : setup msvcrt and _winapi modules
- 15 issue18632 : build extensions with GCC
- 16 issue18633 : use Mingw32CCompiler as default compiler for mingw* build
- 17 issue18634 : find import library
- 18 issue18636 : setup _ssl module
- 19 issue18637 : export _PyNode_SizeOf as PyAPI for parser module
- 20 issue18638 : generalization of posix build in sysconfig.py
- 21 issue18639 : avoid circular dependency from time module during native 
build of extentions
- 22 issue18640 : generalization of posix build in distutils/sysconfig.py
- 23 issue18641 : customize site
- 24 after above patches user must regenerate configure script.

Hints:
a) at configure time define environment variable CPPFLAGS with minimum 
supported version like this   -DWINVER=0x501 -D_WIN32_WINNT=0x501  
-DMS_COREDLL=1, i.e XP is now minimum. MS_COREDLL is required for ctype module
b) at configure time define environment variable CCSHARED with minimum 
supported version like this: -DWINVER=0x501 -D_WIN32_WINNT=0x501. Remark use 
same values as CPPFLAGS
c) use --without-libm
d) use --enable-shared
e) use --with-system-ffi

--
components: Build, Cross-Build, Extension Modules
messages: 194358
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw-meta: build core modules
type: enhancement
versions: Python 3.4

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

[Nick]
 Regarding the key parameter name, I believe this is closer to
 itertools.groupby ...

Isn't this mostly about the return type?  `pred` is an indication that a 
boolean is being returned (or that the return value will be interpreted in a 
boolean context), while `key` is used for more general transformations.  In 
that sense, `pred` makes more sense here.

--
nosy: +mark.dickinson

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Eli Bendersky

Eli Bendersky added the comment:

I also think that exchanging the explicit type checks by __index__ merits more 
thought and is outside the scope of this local fix. The proposed patch does not 
add any new type checks, but acts within the bounds of code for which the type 
is already established.

--

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Mark's rationale makes sense to me. I believe that would make the
latest version of the proposed API (in the itertools module):

def coalesce(iterable, default=None, pred=None):
...

--

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



[issue18624] Add alias for iso-8859-8-i which is the same as iso-8859-8

2013-08-04 Thread Dan Søndergaard

Dan Søndergaard added the comment:

Is it satisfactory to just add the -i and -e variants to ALIASES in charset.py? 
Or don't they qualify as Aliases for other commonly-used names for character 
sets?

--
nosy: +das

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



[issue18654] modernize mingwcygwin compiler classes

2013-08-04 Thread Roumen Petrov

New submission from Roumen Petrov:

Python mingw and cygwin compiler classes tests for outdated features. Also 
python code set some flags like zero optimization level and etc. that prevent 
users to build optimized python or even worse build to fail.

This issue is part of split of issue3871 with clean-up and enhancements:
- archive contain set of 10 patches - remove of outdated (15 years old ) 
features one by one.
- enhance unix compiler customization with mingw and cygwin compilers

--
assignee: eric.araujo
components: Build, Cross-Build, Distutils
files: modernize-mingw+cygwin-compiler-class.tar.gz
messages: 194363
nosy: eric.araujo, rpetrov, tarek
priority: normal
severity: normal
status: open
title: modernize mingwcygwin compiler classes
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file31151/modernize-mingw+cygwin-compiler-class.tar.gz

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



[issue13612] xml.etree.ElementTree says unknown encoding of a regular encoding

2013-08-04 Thread Eli Bendersky

Eli Bendersky added the comment:

Thanks, Serhiy.

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

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



[issue13612] xml.etree.ElementTree says unknown encoding of a regular encoding

2013-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b3efc140d8a6 by Eli Bendersky in branch '2.7':
Issue #13612: Fix a buffer overflow in case of a multi-byte encoding.
http://hg.python.org/cpython/rev/b3efc140d8a6

--

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Eli Bendersky

Eli Bendersky added the comment:

Would it not be better to temporarily-fix the test rather than the code?

--
nosy: +eli.bendersky

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



[issue18654] modernize mingwcygwin compiler classes

2013-08-04 Thread Roumen Petrov

Roumen Petrov added the comment:

Proposed customization allow users to build extension module for windows with 
GNU compiler in all environments:
- native with installed official build of python for windows
- native either MSYS or CYGWIN enviroment and python build with GCC
- cross-build in cygwin using official build of python for windows
- cross-build in cygwin or linux with use of preset configuration from 
distribution
- cross-build in linux and cross build python with GCC

In addition patch allow user to build (native or cross) core modules with 
recent gnu compilers.

--
keywords: +patch
Added file: 
http://bugs.python.org/file31152/0011-MINGW-compiler-customize-mingw-cygwin-compilers.patch

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



[issue18653] mingw-meta: build core modules

2013-08-04 Thread Roumen Petrov

Roumen Petrov added the comment:

This patch require modernize mingwcygwin compiler classes now opened as 
separate issue18654 .

--

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

def coalesce(iterable, default=None, pred=None):
return next(filter(pred, iterable), default)

Are you sure you want add this one-line function to the itertools module rather 
then to recipes?

--

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

All doctests affected.

--

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



[issue17684] Skip tests in test_socket like testFDPassSeparate on OS X

2013-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b7d764807343 by Charles-Francois Natali in branch '3.3':
Issue #17684: Fix some test_socket failures due to limited FD passing support
http://hg.python.org/cpython/rev/b7d764807343

--

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Eli Bendersky

Eli Bendersky added the comment:

Wonderfully terse, as usual. Can you be so kind to elaborate just a tiny bit 
more? Is the amount of doctests this affects so large that it's better to 
change the implementation? What are the plans for this temporary stage - is 
there an intention to fix the code soon and revert the disabling of this 
error check?

--

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



[issue17684] Skip tests in test_socket like testFDPassSeparate on OS X

2013-08-04 Thread Charles-François Natali

Charles-François Natali added the comment:

 Charles-Francois: why did you commit this to default only, and not
 to 3.3?

I overlooked it (apparently, the issue was tagged 3.4 only, and I didn't 
double-check that the code was present in 3.3 as well).

Should be better now!

--
versions: +Python 3.3

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



[issue18655] GUI apps take long to launch on Windows

2013-08-04 Thread netrick

New submission from netrick:

On both Python 2 or 3, when you have GUI app (for example something in pygame 
or pyside or tk), when you launch it on Windows it takes about 4-6 seconds to 
display the Window for the first run. The next runs are faster, but only untill 
you reboot the PC.

The thing is that on Linux even when launching the script for first time ever, 
the GUI Window shows instantly. 

Something how Python displays windows on Windows is wrong, there is something 
that causes the serious lag.

You can see it very easy with IDLE. On Linux it launches instantly, on Windows 
XP on the same PC takes about 6 seconds to launch. I asked other people with 
different config and they have the same issue on Windows.

--
components: Windows
messages: 194374
nosy: netrick
priority: normal
severity: normal
status: open
title: GUI apps take long to launch on Windows
type: performance
versions: Python 2.7, Python 3.3

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



[issue9148] os.execve puts process to background on windows

2013-08-04 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

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



[issue17605] mingw-meta: build interpeter core

2013-08-04 Thread Roumen Petrov

Roumen Petrov added the comment:

please follow build of core modules - issue18653 .

--

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Firstly, list2cmdline() takes a list as its argument, not a string:

   import subprocess
   print subprocess.list2cmdline([r'\1|2\'])
  \\\1|2\\\

But the problem with passing arguments to a batch file is that cmd.exe parses 
arguments differently from how normal executables do.  In particular, | is 
treated specially and ^ is used as an escape character.

If you define test.bat as

  @echo off
  echo %1

then

  subprocess.call(['test.bat', '1^|2'])

prints

  1|2

as expected.

This is a duplicate of http://bugs.python.org/issue1300.

--
nosy: +sbt
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue6335] Add support for mingw

2013-08-04 Thread Roumen Petrov

Roumen Petrov added the comment:

I would like to config that path to this issue is one of those for issue3871 - 
my patch for 2.6/2.7  enhanced by ?? (sorry I forgot user :( )  for 3.0 .

Now as requested all in one patch is split and first set is listed in 
issue17605 build interpeter core, second issue18653 build core modules plus 
modernization of mingwcygwin compiler classes in scope of issue18654 .

--

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



[issue9148] os.execve puts process to background on windows

2013-08-04 Thread Matt Joiner

Changes by Matt Joiner anacro...@gmail.com:


--
nosy: +anacrolix

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



[issue17684] Skip tests in test_socket like testFDPassSeparate on OS X

2013-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Thanks!

--

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2013-08-04 Thread Roumen Petrov

Changes by Roumen Petrov bugtr...@roumenpetrov.info:


--
nosy: +rpetrov

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread Hynek Schlawack

Hynek Schlawack added the comment:

 def coalesce(iterable, default=None, pred=None):
return next(filter(pred, iterable), default)
 
 Are you sure you want add this one-line function to the itertools module 
 rather then to recipes?

Well, for many – including me – it would mean to have this one-line function in 
every other project or a PyPI dependency.  I’m certain there are other short 
but useful functions in the stdlib.

--

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



[issue15315] Can't build Python extension with mingw32 on Windows

2013-08-04 Thread Roumen Petrov

Changes by Roumen Petrov bugtr...@roumenpetrov.info:


--
nosy: +rpetrov

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



[issue4709] Mingw-w64 and python on windows x64

2013-08-04 Thread Roumen Petrov

Changes by Roumen Petrov bugtr...@roumenpetrov.info:


--
nosy: +rpetrov

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



[issue9148] os.execve puts process to background on windows

2013-08-04 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

This is unexpected and makes people wonder what's going on. See 
http://stackoverflow.com/q/7004687/95735 and 
http://stackoverflow.com/q/7264571/95735.

--

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

I think you're missing the point. The implementation is wrong as it does not do 
what documentation says which is A double quotation mark preceded by a 
backslash is interpreted as a literal double quotation mark. How the output of 
list2cmdline interacts with the cmd.exe is another issue (It just happens here 
that if implementation of list2cmdline were in line with its documentation then 
there wouldn't be any subsequent problem with cmd.exe). Also issue 1300 is 
about escaping a pipe character (|) on the basis of how it's treated by cmd.exe 
and does not even refer to the docstring of list2cmdline function.

--
resolution: invalid - 
status: closed - open

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



[issue18655] GUI apps take long to launch on Windows

2013-08-04 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Can you provide a short script that reproduces this problem?
AFAIK, Python doesn't display windows, the tcl/pygame libraries' C code creates 
the windows.

--
nosy: +Ramchandra Apte

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



[issue2445] Use The CygwinCCompiler Under Cygwin

2013-08-04 Thread Roumen Petrov

Roumen Petrov added the comment:

Hi, 
Now issue18654 modernize mingwcygwin compiler classes contain enhancement 
that could be reused by this issue: patch 
0007-MINGW-compiler-cygwin-provides-its-own-C-runtime.patch
 from archive , i.e. lets avoid change in get_msvcr() that return. Mingw is 
also impacted but is addresses in another patches.  As separate patch is 
'compiler customization' -  more advanced version then proposed by Jeevan 
Varshney (jayvee)

A separate issue18634 find import library address .dll.a suffix based on 
existing distutil functionality.

Also issue18633 Mingw32CCompiler as default compiler for mingw* build adds 
same fixes from unix compiler class into Cygwin one - ref '# Chop off the drive'

So with above I think that cygwin compiler could be switched back from unix to 
own.

--

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



[issue18418] Thread.isAlive() sometimes True after fork

2013-08-04 Thread A. Jesse Jiryu Davis

A. Jesse Jiryu Davis added the comment:

I'm back from a Zen retreat--no email!--will address your comments
momentarily.

On Fri, Aug 2, 2013 at 3:07 AM, Charles-François Natali 
rep...@bugs.python.org wrote:


 Charles-François Natali added the comment:

 I've posted another review (not sure you receive notifications).

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue18418
 ___


--

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



[issue18635] Enum sets _member_type_ to instantiated values but not the class

2013-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b034418e840b by Ethan Furman in branch 'default':
Close #18635: Move class level private attribute from instance to class.
http://hg.python.org/cpython/rev/b034418e840b

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

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



[issue18624] Add alias for iso-8859-8-i which is the same as iso-8859-8

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

This issue is actually about adding the aliases to the codecs module.  I'm not 
entirely sure at this point what the canonical character set name should be for 
email output (which is what the ALIASES table controls).

--

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



[issue18418] Thread.isAlive() sometimes True after fork

2013-08-04 Thread A. Jesse Jiryu Davis

A. Jesse Jiryu Davis added the comment:

New patch for 3.3 branch after Charles-François's critique: use _enumerate() 
where appropriate, and join the test thread before finishing the test.

--
Added file: http://bugs.python.org/file31153/issue18418-3.patch

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



[issue18655] GUI apps take long to launch on Windows

2013-08-04 Thread netrick

netrick added the comment:

The simplest way to reproduce it is:

1) Reboot your PC
2) Launch IDLE (pre-installed with Python)
3) Look how long it takes to launch and then compare that with instant launch 
on Linux

--

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

This is a only a duplicate of issue 1300 in the sense that that issue points 
out that list2cmdline has nothing to do with passing/quoting strings for 
cmd.exe.

list2cmdline is an internal function of the subprocess module.  Its docstring 
documents the MS C quoting rules, *not* the input quoting rules.  So its output 
is correct according to its doc string.  If you pass [test.bat, r'\1|2\'] 
to Popen using Richard's version of test.bat, you should get

  \1|2\

as the output, which would be correct, since that is what you passed in as the 
argument to test.bat in the Popen call.  The point is that the arguments 
specified in the list (shell=False) Popen call is supposed to be exactly what 
arguments get passed to the called program, and list2cmdline takes care of the 
MS C quoting to make that happen. (I don't use Windows much, so it is a bit of 
a pain for me to confirm the above example, but I'm nearly certain it will work 
as I say, modulo whatever quoting rule 'echo' uses for output.)

--
components: +Benchmarks -Library (Lib)
resolution:  - invalid
status: open - closed

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

The first line above is incomplete.  I meant that issue 1300 is only a 
duplicate in the sense that it points out that list2cmdline implements the MS C 
quoting rules, *not* the cmd.exe quoting rules.

--

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 I think you're missing the point. The implementation is wrong as it 
 does not do what documentation says which is A double quotation mark 
 preceded by a backslash is interpreted as a literal double quotation 
 mark.

That docstring describes how the string returned by list2cmdline() is 
interpreted by the MS C runtime.  I assume you mean this bit:

3) A double quotation mark preceded by a backslash is
   interpreted as a literal double quotation mark.

This looks correct to me: it implies that list2cmdline() must convert a double 
quotation mark to a double quotation mark preceded by a backslash.  e.g.

   print(subprocess.list2cmdline(['']))
  \

 How the output of list2cmdline interacts with the cmd.exe is another 
 issue (It just happens here that if implementation of list2cmdline were 
 in line with its documentation then there wouldn't be any subsequent 
 problem with cmd.exe).

As I said, list2cmdline() behaves as expected.  Whatever else happens, | must 
be escaped with ^ or else cmd will interpret it specially.

--

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



[issue18652] Add itertools.coalesce

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

I'm not going to object to the name, since I see that it is used elsewhere in 
programming for the proposed meaning.  But allow me to rant about the 
corruption of the English language here.  To me, coalesce should involve a 
computation based on all of the elements of a list, not just picking out the 
first non-false value.

--
nosy: +r.david.murray

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

The list form of Popen should never be used with shell=True.

It would be very good if someone would propose a 'cmd.exe quote' function for 
the stdlib.

But both of these points don't have anything to do with this issue, as far as I 
can see :)

--

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



[issue18484] No unit test for iso2time function from http.cookiejar module

2013-08-04 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue18656] setting function.__name__ doesn't affect repr()

2013-08-04 Thread Guido van Rossum

New submission from Guido van Rossum:

In Python 3.2 and earlier:

 def f(): pass
...
 f.__name__ = 'g'
 f
function g at 0x100487628

However in Python 3.3 and later, the last line shows 'f' instead of 'g'.

--
components: Interpreter Core
messages: 194394
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: setting function.__name__ doesn't affect repr()
type: behavior
versions: Python 3.3, Python 3.4

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



[issue18656] setting function.__name__ doesn't affect repr()

2013-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

I guess this is a direct consequence of PEP 3155 [1].  From the PEP:


The repr() and str() of functions and classes is modified to use __qualname__ 
rather than __name__.


[1] http://www.python.org/dev/peps/pep-3155/

--
nosy: +mark.dickinson, pitrou

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



[issue18656] setting function.__name__ doesn't affect repr()

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

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue18656] setting function.__name__ doesn't affect repr()

2013-08-04 Thread STINNER Victor

STINNER Victor added the comment:

Python 3.4.0a0 (default:62658d9d8926+, Aug  1 2013, 23:05:18) 
[GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux
Type help, copyright, credits or license for more information.
 def func(): pass
... 
 func
function func at 0xb7698a54

 func.__qualname__=PEP 3155
 func
function PEP 3155 at 0xb7698a54

--
nosy: +haypo

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Tim Peters

Tim Peters added the comment:

Serhiy, I don't see the regexp '(?:.*$\n?)*' anywhere in doctest.py.  Are you 
talking about the _EXAMPLE_RE regexp?  That's the closest I see.

If that's the case, the nothing to repeat error is incorrect:  _EXAMPLE_RE 
also contains a negative lookahead assertion '(?![ ]*$)' to ensure that the 
later '.*$\n?' part never tries to match an empty string.

That said, it takes some intelligence to realize that the negative lookahead 
assertion prevents repeating an empty match in this regexp, so it may not be 
easy to fix this false positive.

A compromise may be to replace

.*$\n?

with

.+$\n? | .*$\n

Both branches then obviously consume at least one character.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Matt McClure

Matt McClure added the comment:

Michael Foord fuzzyman at voidspace.org.uk writes:
 On 2 Aug 2013, at 19:19, Antoine Pitrou solipsis at pitrou.net wrote:
  The patch is basically ready for commit, except for a possible doc
  addition, no?
 
 Looks to be the case, reading the patch it looks fine. I'm currently on
 holiday until Monday. If anyone is motivated to do the docs too and 
 commit that would be great. Otherwise I'll get to it on my return.

It looks like the patch is based on what will become 3.4. Would backporting it 
to 2.7 be feasible?  What's involved in doing so?

I took a crack at the docs. I'm attaching an updated patch.

--
nosy: +matthewlmclure

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



[issue8865] select.poll is not thread safe

2013-08-04 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Matt McClure

Changes by Matt McClure matthewlmccl...@gmail.com:


Added file: 
http://bugs.python.org/file31154/11798-20130803-matthewlmcclure.patch

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



[issue18651] test failures on KFreeBSD

2013-08-04 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The doctest engine uses a regexp which contains subpattern which now considered 
as illegal be the regexp engine (due to unlucky coincidence MAXREPEAT == 
sys.maxsize on 32-bit platforms). We should rewrite the _simple() function in 
the re module to be more smart. But if this assumption is correct and this 
subpattern is really dangerous we should also rewrite a regular expression in 
the doctest module. In any case we should fix SubPattern.getwidth() so that the 
behavior on 32-bit and 64-bit platforms should be the same.

--

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Tim Peters

Tim Peters added the comment:

Serhiy, I'm asking you to be very explicit about which regexp in doctest.py 
you're talking about.  If you're talking about the _EXAMPLE_RE regexp, I 
already explained what's going on with that.  If you're talking about some 
other regexp, I have no idea which one you're talking about.

--

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman

Ethan Furman added the comment:

This patch handles both float and int subclasses, and includes 
fixes/improvements from the review.

--
Added file: http://bugs.python.org/file31155/issue18264.stoneleaf.02.patch

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



[issue18656] setting function.__name__ doesn't affect repr()

2013-08-04 Thread Madison May

Madison May added the comment:

Yup, here are the relevant lines of the diff for PEP 3155:

@@ -568,7 +607,7 @@
 func_repr(PyFunctionObject *op)
 {
 return PyUnicode_FromFormat(function %U at %p,
-   op-func_name, op);
+   op-func_qualname, op);
 }

--
nosy: +madison.may

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman

Ethan Furman added the comment:

Forgot to add float tests.  Included in this patch.

--
Added file: http://bugs.python.org/file31156/issue18264.stoneleaf.03.patch

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



[issue16692] Support TLS 1.1 and TLS 1.2

2013-08-04 Thread Wes Turner

Wes Turner added the comment:

http://docs.python.org/3.4/whatsnew/3.4.html#ssl

re: Backporting to Python 2.7: maybe something like:

backports.ssl (like backports.ssl_match_hostname)

https://pypi.python.org/pypi/backports/

--
nosy: +westurner

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



[issue11033] ElementTree.fromstring doesn't work with Unicode

2013-08-04 Thread Alexander Belopolsky

Changes by Alexander Belopolsky alexander.belopol...@gmail.com:


--
status: open - closed

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
resolution:  - invalid
status: open - closed

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray

R. David Murray added the comment:

Using the same rules as the MS C runtime means that, given a sequence (list) 
of arguments, create a string that uses the same quoting that the MS C runtime 
uses.  That is, if you have a sequence of arguments in a C program, and you 
want to call another windows program, you quote that sequence into a string 
using the same rules that list2cmdline uses.

Can you suggest a wording for the doctring that would make this clearer?

--

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



[issue18647] re.error: nothing to repeat

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Serhiy, I don't see the regexp '(?:.*$\n?)*' anywhere in doctest.py.  Are you 
 talking about the _EXAMPLE_RE regexp?  That's the closest I see.

Yes, it is. In my previous message I answered Eli.

 If that's the case, the nothing to repeat error is incorrect:  _EXAMPLE_RE 
 also contains a negative lookahead assertion '(?![ ]*$)' to ensure that the 
 later '.*$\n?' part never tries to match an empty string.

Thank you for explanation. Unlucky the getwidth() method is not smart enough to 
detect that minimal length of matched string is not 0. We should made either 
the getwidth() method or the _simple() function (or both) more smart.

 A compromise may be to replace
 .*$\n?
 with
 .+$\n? | .*$\n

I'm sure similar patterns are used in third-party code. We shouldn't break 
them, therefore we should fix _simple()/getwidth().

--

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

The docstring starts with this statement
Translate a sequence of arguments into a command line string, using the same 
rules as the MS C runtime:
which clearly makes the impression that function list2cmdline uses the same 
rules as the MS C runtime. However after reading comments in this issue I 
believe I misunderstood the true meaning as the docstring is highly misleading. 
According to your comments, the word using was meant to pertain to the 
command line string (which is the output of the list2cmdline function) and 
_not_ to the translation phase itself. This makes sense taking into account the 
flow of events which is; a list of arguments - list2cmdline - CreateProcess.

--
components: +Library (Lib) -Benchmarks
resolution: invalid - 
status: closed - open

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



[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

Sure, something like
The purpose of this function is to construct a string which will be later 
interpreted by MS C runtime as denoting a sequence of arguments. Because of 
this the string is built in such a way as to preserve the original characters 
when interpreted by MS C runtime. For example a double quotation mark is 
preceded by the backslash so that MS C runtime would translate this back to the 
original double quotation mark according to its rules which are given below as 
a reference:

--

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



[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

2013-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f7c84ef35b00 by Alexander Belopolsky in branch 'default':
Fixes #8860: Round half-microseconds to even in the timedelta constructor.
http://hg.python.org/cpython/rev/f7c84ef35b00

--
nosy: +python-dev

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



[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

2013-08-04 Thread Alexander Belopolsky

Changes by Alexander Belopolsky alexander.belopol...@gmail.com:


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

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



  1   2   >