[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2013-09-11 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This is fixed in all versions. Thank you!

--
nosy: +orsenthil
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2013-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 82bdd5fc7a71 by Senthil Kumaran in branch '2.7':
Improve the docstring of random.shuffle. Inform users not to provide int arg.
http://hg.python.org/cpython/rev/82bdd5fc7a71

New changeset 4782faf29480 by Senthil Kumaran in branch '3.3':
Improve the docstring of random.shuffle. Inform users not to provide int arg.
http://hg.python.org/cpython/rev/4782faf29480

New changeset 15096b93ae5a by Senthil Kumaran in branch 'default':
merge from 3.3
http://hg.python.org/cpython/rev/15096b93ae5a

--
nosy: +python-dev

___
Python tracker 

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



[issue18844] allow weights in random.choice

2013-09-11 Thread Neil Girdhar

Neil Girdhar added the comment:

Should this really be implemented using the cumulative distribution and binary 
search algorithm?  Vose's Alias Method has the same initialization and memory 
usage cost (O(n)), but is constant time to generate each sample.

An excellent tutorial is here: http://www.keithschwarz.com/darts-dice-coins/

--
nosy: +neil.g

___
Python tracker 

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



[issue18995] Enum does not work with reversed

2013-09-11 Thread Ethan Furman

Ethan Furman added the comment:

Yes, I was aware of that method (not that we would add it that way).  
__reversed__ is definitely better for Enum.

--

___
Python tracker 

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



[issue18995] Enum does not work with reversed

2013-09-11 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Simplified unit test. I reused enum Season in the test class.

By the way, there is another way to add support for enum without implementing 
__reversed__ method, which is adding support indexing by number (in __getitem__ 
method), e.g. Season[1] => Season.SPRING. But I prefer using __reversed__ 
method.

--
Added file: 
http://bugs.python.org/file31733/add_reversed_support_for_enum_v2.patch

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot

Mateusz Loskot added the comment:

On 12 September 2013 00:06, Antoine Pitrou  wrote:
>> Shortly, is_valid_fd always returns true because fd < 0 is always
>> false as my tests with Visual Studio 2012
>
> Well, that's not all there is, is_valid_fd() does other checks before 
> returning true.

Given the function:

is_valid_fd(int fd)
{
int dummy_fd;
if (fd < 0 || !_PyVerify_fd(fd))
return 0;
dummy_fd = dup(fd);
if (dummy_fd < 0)
return 0;
close(dummy_fd);
return 1;
}

for fd values of 0, 1 or 2

1. fd < 0 is always false
2. _PyVerify_fd(fd) is always true. Given the current definition:
#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)
for those values of fd _get_osfhandle(fd) >= 0, always.
3. for those fd values, dup() never returns fd < 0

--

___
Python tracker 

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



[issue13107] Text width in optparse.py can become negative

2013-09-11 Thread Elazar Gershuni

Elazar Gershuni added the comment:

ok. how about argparse_ugly.patch? below some width it simply won't do any 
wrapping.

(I hadn't touch optparse yet)

--
Added file: http://bugs.python.org/file31731/argparse_ugly.patch

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Shortly, is_valid_fd always returns true because fd < 0 is always
> false as my tests with Visual Studio 2012

Well, that's not all there is, is_valid_fd() does other checks before returning 
true.

--

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-09-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +georg.brandl, ncoghlan

___
Python tracker 

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



[issue18988] Tab key doesn't work sometimes.

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy:  -serhiy.storchaka

___
Python tracker 

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



[issue18844] allow weights in random.choice

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue18844] allow weights in random.choice

2013-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The proposed patch add two methods to the Random class and two module level 
functions: weighted_choice() and weighted_choice_generator().

weighted_choice(data) accepts either mapping or sequence and returns a key or 
index x with probability which is proportional to data[x].

If you need several elements with same distribution, use 
weighted_choice_generator(data) which returns an iterator which produces random 
keys or indices of the data. It is more faster than calling 
weighted_choice(data) repeatedly and is more flexible than generating a list of 
random values at specified size (as in NumPy).

--
Added file: http://bugs.python.org/file31732/weighted_choice_generator.patch

___
Python tracker 

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



[issue18988] Tab key doesn't work sometimes.

2013-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c882395e8ed8 by Serhiy Storchaka in branch '3.3':
Issue #18988: The "Tab" key now works when a word is already autocompleted.
http://hg.python.org/cpython/rev/c882395e8ed8

New changeset 7d38784092d8 by Serhiy Storchaka in branch 'default':
Issue #18988: The "Tab" key now works when a word is already autocompleted.
http://hg.python.org/cpython/rev/7d38784092d8

New changeset 8d320204d5d6 by Serhiy Storchaka in branch '2.7':
Issue #18988: The "Tab" key now works when a word is already autocompleted.
http://hg.python.org/cpython/rev/8d320204d5d6

--
nosy: +python-dev

___
Python tracker 

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



[issue18911] minidom does not encode correctly when calling Document.writexml

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2013-09-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In the current 3.3.2 docs, 'STOP' has been replaced by '', so there is a 
change, and no infinite loop. However, this is still does not strike me as an 
example of 'useful' as 
  for line in iter(fp.readline, "STOP"): # is a bad version of
  for line in fp:
It does illustrate the behavior though.

--
stage:  -> needs patch
versions: +Python 3.4 -Python 3.1, Python 3.2

___
Python tracker 

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



[issue19006] UnitTest docs should have a single list of assertions

2013-09-11 Thread Ezio Melotti

Ezio Melotti added the comment:

One reason is that if I list all those assert methods first and keep the 
assertRaises/Warns in a separate group, they will be pushed way down, and 
people might miss them.
I'll try to prepare a patch that adds links to the other tables and/or changes 
the wording to make it clear that there are more assert methods.

--

___
Python tracker 

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



[issue19006] UnitTest docs should have a single list of assertions

2013-09-11 Thread Roy Smith

Roy Smith added the comment:

Adding a note that there are more methods in the tables below would be useful.  
Otherwise, you assume you've seen them all when you've read the first table.

I agree that the assertions about exceptions and warnings belong in a different 
group, but I don't see any fundamental reason to put assertGreater in a 
different table from assertEqual.

--

___
Python tracker 

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



[issue19006] UnitTest docs should have a single list of assertions

2013-09-11 Thread Roy Smith

New submission from Roy Smith:

http://docs.python.org/2/library/unittest.html#assert-methods

The docs say, "The TestCase class provides a number of methods to check for and 
report failures, such as", and then when you scroll a couple of screens down, 
there's another list, "There are also other methods used to perform more 
specific checks, such as".  These should be merged into a single list.  There's 
nothing fundamentally different about the two lists and breaking them into two 
parts just makes it harder to find what you want.

--
assignee: docs@python
components: Documentation
messages: 197492
nosy: docs@python, roysmith
priority: normal
severity: normal
status: open
title: UnitTest docs should have a single list of assertions
versions: Python 2.7

___
Python tracker 

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



[issue18995] Enum does not work with reversed

2013-09-11 Thread Ethan Furman

Ethan Furman added the comment:

Cool, I didn't even know __reversed__ existed!

--
assignee:  -> ethan.furman
stage:  -> patch review

___
Python tracker 

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Nick, could you help me with documentation? I'm sure my wording needs improving.

And there is one question left. Is this change appropriate for 2.7 and 3.3, or 
only for 3.4?

--

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2013-09-11 Thread purplezephyr

purplezephyr added the comment:

This does not seem to have been changed in any version, per msg135246.  If it's 
not going to be replaced, there's another issue, which is that the link to 
readline() in the text is incorrect - it goes to the readline module, not 
file.readline().

--
nosy: +purplezephyr

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread R. David Murray

R. David Murray added the comment:

That's not how people use it at the interactive prompt, though.  I call 
dir(str) to find what methods I can call on an str object, not what methods I 
can call on the str class object. Same goes for my own classes.  Yes, I also 
call it on instances, but it would be very surprising, especially at this point 
in Python's history, for this to change.

It would also screw up pydoc and inspect.  Screwing up inspect is an issue 
Ethan has already brought up as a possible problem regardless, but that doesn't 
really enter into this discussion, because those two examples indicate how 
badly such a change would break existing python code outside the stdlib.

I'm going to close this issue as rejected.  The provision of a differently 
named builtin with the alternate semantics requested here could be raised on 
python-ideas, but I doubt it will get much traction since you can just do 
dir(xxx.__class__ for the rare cases where you want that info.

Aside: I haven't looked at what jedi is, but perhaps you need to rethink your 
dependence on dir, just as we (may be?) rethinking inspect's dependence on dir.

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

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot

Mateusz Loskot added the comment:

On 11 September 2013 12:34, Antoine Pitrou  wrote:
>> I'm not sure which minor version of Python 3.2 it was, but in my
>> comment in msg187362, I confirmed that I have tested the later
>> version with added is_valid_fd function. As far as I understand, the
>> changes in http://hg.python.org/cpython/rev/f15943505db0/ introduce
>> that is_valid_fd function, which does not seem to solve the problem.
>
> Could you try to investigate this a bit further? Does is_valid_fd()
> return true, and why?

I have already checked that (see msg187362)

Shortly, is_valid_fd always returns true because fd < 0 is always
false as my tests with Visual Studio 2012 (Visual C++ 11.0 (1700)
confirmed (see also bug report linked in msg188117)

assert(fdi == 0);
assert(fdo == 1);
assert(fde == 2);

IOW, fd is always larger than 0.

--

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ramchandra Apte

Ramchandra Apte added the comment:

-1 classes themselves are objects, so dir should list the attributes/methods of 
the class object, not the instances.

--
nosy: +Ramchandra Apte

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ramchandra Apte

Ramchandra Apte added the comment:

On 11 September 2013 21:41, Ethan Furman  wrote:

>
> Ethan Furman added the comment:
>
> So when you do a `dir(int)` you don't want to know what you can call on 7?
>  You'd rather know what you can call on 'type'?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

Yes, as that is more consistent.

--

___
Python tracker 

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



[issue19006] UnitTest docs should have a single list of assertions

2013-09-11 Thread Ezio Melotti

Ezio Melotti added the comment:

> There's nothing fundamentally different about the two lists

I made that division because the ones in the first table are the most common 
and widely used, and are quite general too.
The second table contains assert methods about catching exceptions and 
warnings, and, while still common, they are different from the first group. 
The third table has additional assertions that are quite specific and not used 
too often, and many of these have been added later on.
There's also a fourth table with additional type-specific assertions, but they 
shouldn't be used directly.

Also note that the list of methods is different on 3.x, even though I kept the 
same division on all the branches.

> These should be merged into a single list.

Having a table with all the assert methods would indeed provide a better 
overview, but it would be quite a big table (25 assert methods on 3.4, 
excluding the type-specific ones) and might make navigation more difficult 
while scrolling through the methods.  Something could be done to make clear 
that there are other tables down below though (e.g. adding links or using 
sub-sections with an index).

--
nosy: +ezio.melotti, michael.foord
type:  -> enhancement
versions: +Python 3.3, Python 3.4

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ethan Furman

Ethan Furman added the comment:

So when you do a `dir(int)` you don't want to know what you can call on 7?  
You'd rather know what you can call on 'type'?

--

___
Python tracker 

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2013-09-11 Thread Yuri Bochkarev

Changes by Yuri Bochkarev :


--
nosy: +Yuri.Bochkarev

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2013-09-11 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-11 Thread Vlad Shcherbina

Changes by Vlad Shcherbina :


Removed file: http://bugs.python.org/file31697/tempfile_collision_tests.patch

___
Python tracker 

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-11 Thread Vlad Shcherbina

Changes by Vlad Shcherbina :


Added file: http://bugs.python.org/file31730/tempfile_collision_tests.patch

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ethan Furman

Ethan Furman added the comment:

It's going to take more than "I think that that's not true," to get a change 
made.

>From http://docs.python.org/2/library/functions.html#dir :
> 
> Because dir() is supplied primarily as a convenience for use at an
> interactive prompt, it tries to supply an interesting set of names
> more than it tries to supply a rigorously or consistently defined
> set of names [...] .

Currently, `dir(cls)` returns information that tells us how instances of that 
class will behave.  Because metaclass methods have no direct effect on instance 
behavior, having dir return metaclass methods and attributes would be confusing.

If you want to know how a class is going to behave you need to 
`dir(cls.__class__)`.

--

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2013-09-11 Thread Nick Coghlan

Nick Coghlan added the comment:

I don't think I've *ever* had NEWS successfully merge when working on
a bug fix (even after the move to hg). It's one of the reasons I
prefer working on new features, or bugs where the fix is too intrusive
for a maintenance release :P

--

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I'm not sure which minor version of Python 3.2 it was, but in my
> comment in msg187362, I confirmed that I have tested the later
> version with added is_valid_fd function. As far as I understand, the
> changes in http://hg.python.org/cpython/rev/f15943505db0/ introduce
> that is_valid_fd function, which does not seem to solve the problem.

Could you try to investigate this a bit further? Does is_valid_fd()
return true, and why?

--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2013-09-11 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +perey

___
Python tracker 

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



[issue19004] datetime: Read in isoformat() output

2013-09-11 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> datetime: add ability to parse RFC 3339 dates and times
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread R. David Murray

R. David Murray added the comment:

As far as I know dir has always worked this way with classes (certainly back as 
far as 2.4, which is the oldest python I have on my dev system).  So I doubt 
that this behavior can be open to change, whether or not we think the original 
decision was correct.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2013-09-11 Thread Ezio Melotti

Ezio Melotti added the comment:

IMHO the status quo is fine.
Most of the time HG gets the merge right on its own.  Some times kdiff3 pops up 
and asks me to solve the conflict [0].  Rarely something goes wrong so I just 
revert Misc/NEWS and re-add the entry manually.

> It seems to me that they are much rarer than they were with svn.

I agree -- I think many of us still see merges as something "bad" that should 
be avoided, while this is generally no longer true with HG (it was with SVN).
A similar argument is "whitespace/PEP8 changes on 3.4 should be avoided because 
it makes merging changes from 3.3 more difficult".  While it's true that it 
makes 3.4 diverge from 3.3, IME this doesn't really bother HG and merges 
usually goes smoothly (there are other arguments against that kind of changes, 
but I think this is not a very strong one).

[0]: this usually happens when there is an entry in 3.4 only and I'm merging 
from 3.3.  kdiff3 asks me if it should use the entry I added in 3.3 or the one 
that is in 3.4, and all I have to do is telling it to keep them both 
(ctrl+3/ctrl+2).

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18999] Robustness issues in multiprocessing.{get, set}_start_method

2013-09-11 Thread Olivier Grisel

Olivier Grisel added the comment:

> Maybe it would be better to have separate contexts for each start method.  
> That way joblib could use the forkserver context without interfering with the 
> rest of the user's program.

Yes in general it would be great if libraries could customize the 
multiprocessing default options without impacting any of the module singletons. 
That also include the ForkingPickler registry for custom: now it's a class 
attribute. It would be great to be able to scope custom reducers registration 
to a given multiprocessing.Pool or multiprocessing.Process instance.

Now how to implement that kind of isolation: it could either be done by adding 
new constructor parameters or new public methods to the Process and Pool 
classes to be able to customize their behavior while sticking to the OOP 
paradigm if possible or by using a context manager as you suggested.

I am not sure which option is best. Prototyping both is probably the best way 
to feel the tradeoffs.

--

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2013-09-11 Thread R. David Murray

R. David Murray added the comment:

I agree with Antoine, but then as I said I don't run into huge merge conflicts 
very often.

--

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Daniel

Daniel added the comment:

Sorry, I used the latest Python3.4 branch, I haven't tested this with prior 
versions.

--

___
Python tracker 

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



[issue19005] PyIter_Next crashes if passed a non-iterator

2013-09-11 Thread Evgeny Kapun

New submission from Evgeny Kapun:

According to the documentation, PyIter_Next should raise TypeError if passed an 
object which is not an iterator as an argument. Instead, it calls a function 
through a null pointer, which leads to a crash.

--
components: Interpreter Core
messages: 197483
nosy: abacabadabacaba
priority: normal
severity: normal
status: open
title: PyIter_Next crashes if passed a non-iterator
type: crash
versions: Python 3.3

___
Python tracker 

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



[issue19004] datetime: Read in isoformat() output

2013-09-11 Thread Timothy Pederick

New submission from Timothy Pederick:

At present, the datetime module does not provide the capability to parse its 
own output from the isoformat() methods.

strptime() can't handle timezones with colons in them (and anyway it seems to 
me you'd need to try several possible format strings depending on ' ' vs 'T' 
separators, presence/absence of microseconds, pres/abs timezone...). Adding 
this capability would be one option (%f already establishes a precedent for 
adding codes outside of what C supports).

Another, perhaps superior option would be a specific method for parsing the 
output of isoformat().

--
components: Library (Lib)
messages: 197482
nosy: perey
priority: normal
severity: normal
status: open
title: datetime: Read in isoformat() output
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot

Mateusz Loskot added the comment:

@Antoine (Re msg197480)

I'm not sure which minor version of Python 3.2 it was, but in my comment in 
msg187362, I confirmed that I have tested the later version with added 
is_valid_fd function. As far as I understand, the changes in 
http://hg.python.org/cpython/rev/f15943505db0/ introduce that is_valid_fd 
function, which does not seem to solve the problem.

--
status: pending -> open

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Which 3.2 version does this break with? As far as I can tell, it should be 
fixed in 3.2.3: see changeset f15943505db0, issue #7111.

--
nosy: +pitrou
resolution:  -> fixed
stage: needs patch -> 
status: open -> pending
versions: +Python 3.2 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
priority: normal -> high
resolution: out of date -> 
stage:  -> needs patch
versions: +Python 3.3, Python 3.4 -Python 3.2

___
Python tracker 

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +brian.curtin, tim.golden, tim.peters

___
Python tracker 

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



[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file31729/ctransformdict.patch

___
Python tracker 

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



[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: http://bugs.python.org/file31728/ctransformdict.patch

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2013-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Automatic generation of NEWS file from commit logs.

Commit messages can't be modified after being published, this would be annoying 
to fix typos etc.

>From what I record of the ML discussions, the proposed solutions actually 
>sounded more annoying than the occasional merge annoyance.

--
nosy: +pitrou

___
Python tracker 

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



[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a preliminary C implementation.

--
Added file: http://bugs.python.org/file31728/ctransformdict.patch

___
Python tracker 

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



[issue16564] email.generator.BytesGenerator fails with bytes payload

2013-09-11 Thread Alexander Kruppa

Alexander Kruppa added the comment:

Opened #19003.

--

___
Python tracker 

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



[issue19003] email.generator.BytesGenerator corrupts data by changing line endings

2013-09-11 Thread Alexander Kruppa

New submission from Alexander Kruppa:

This is a follow-up to #16564. In that issue, BytesGenerator was changed to 
accept a bytes payload, however processing binary data that way leads to data 
corruption.

Repost of the update I posted in #16564:

***
~/build/Python-3.3.2$ ./python --version
Python 3.3.2

When modifying the test case in Lib/test/test_email/test_email.py like this:

--- Lib/test/test_email/test_email.py   2013-05-15 18:32:55.0 +0200
+++ Lib/test/test_email/test_email_mine.py  2013-09-10 14:22:08.160089440 
+0200
@@ -1461,17 +1461,17 @@
 # Issue 16564: This does not produce an RFC valid message, since to be
 # valid it should have a CTE of binary.  But the below works in
 # Python2, and is documented as working this way.
-bytesdata = b'\xfa\xfb\xfc\xfd\xfe\xff'
+bytesdata = b'\x0b\xfa\xfb\xfc\xfd\xfe\xff'
 msg = MIMEApplication(bytesdata, _encoder=encoders.encode_noop)
 # Treated as a string, this will be invalid code points.
-self.assertEqual(msg.get_payload(), '\uFFFD' * len(bytesdata))
+# self.assertEqual(msg.get_payload(), '\uFFFD' * len(bytesdata))
 self.assertEqual(msg.get_payload(decode=True), bytesdata)
 s = BytesIO()
 g = BytesGenerator(s)
 g.flatten(msg)
 wireform = s.getvalue()
 msg2 = email.message_from_bytes(wireform)
-self.assertEqual(msg.get_payload(), '\uFFFD' * len(bytesdata))
+# self.assertEqual(msg.get_payload(), '\uFFFD' * len(bytesdata))
 self.assertEqual(msg2.get_payload(decode=True), bytesdata)

then running:

./python ./Tools/scripts/run_tests.py test_email

results in:

==
FAIL: test_binary_body_with_encode_noop (test_email_mine.TestMIMEApplication)
--
Traceback (most recent call last):
  File 
"/localdisk/kruppaal/build/Python-3.3.2/Lib/test/test_email/test_email_mine.py",
 line 1475, in test_binary_body_with_encode_noop
self.assertEqual(msg2.get_payload(decode=True), bytesdata)
AssertionError: b'\x0b\n\xfa\xfb\xfc\xfd\xfe\xff' != 
b'\x0b\xfa\xfb\xfc\xfd\xfe\xff'

The '\x0b' byte is incorrectly translated to '\x0b\n', i.e., a New Line 
character is inserted.

Encoding the bytes array:
bytes(range(256))

results output data (MIME Header stripped):

000: 0001 0203 0405 0607 0809 0a0b 0a0c 0a0a  
010: 0e0f 1011 1213 1415 1617 1819 1a1b 1c0a  
020: 1d0a 1e0a 1f20 2122 2324 2526 2728 292a  . !"#$%&'()*
030: 2b2c 2d2e 2f30 3132 3334 3536 3738 393a  +,-./0123456789:
040: 3b3c 3d3e 3f40 4142 4344 4546 4748 494a  ;<=>?@ABCDEFGHIJ
050: 4b4c 4d4e 4f50 5152 5354 5556 5758 595a  KLMNOPQRSTUVWXYZ
060: 5b5c 5d5e 5f60 6162 6364 6566 6768 696a  [\]^_`abcdefghij
070: 6b6c 6d6e 6f70 7172 7374 7576 7778 797a  klmnopqrstuvwxyz
080: 7b7c 7d7e 7f80 8182 8384 8586 8788 898a  {|}~
090: 8b8c 8d8e 8f90 9192 9394 9596 9798 999a  
0a0: 9b9c 9d9e 9fa0 a1a2 a3a4 a5a6 a7a8 a9aa  
0b0: abac adae afb0 b1b2 b3b4 b5b6 b7b8 b9ba  
0c0: bbbc bdbe bfc0 c1c2 c3c4 c5c6 c7c8 c9ca  
0d0: cbcc cdce cfd0 d1d2 d3d4 d5d6 d7d8 d9da  
0e0: dbdc ddde dfe0 e1e2 e3e4 e5e6 e7e8 e9ea  
0f0: ebec edee eff0 f1f2 f3f4 f5f6 f7f8 f9fa  
100: fbfc fdfe ff .

That is, a '\n' is inserted after '\x0b', '\x1c', '\x1d', and '\x1e', 
and '\x0d' is replaced by '\n\n'.

***

I suspect this is due to the use of self._write_lines(msg._payload) in 
BytesGenerator._handle_text(); since _write_lines() mangles line endings.

--
components: email
messages: 197476
nosy: Alexander.Kruppa, barry, r.david.murray
priority: normal
severity: normal
status: open
title: email.generator.BytesGenerator corrupts data by changing line endings
type: behavior
versions: Python 3.2, Python 3.3

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ethan Furman

Changes by Ethan Furman :


--
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.5

___
Python tracker 

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



[issue19002] ``dir`` function does not work correctly with classes.

2013-09-11 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2013-09-11 Thread Sam Ferencik

Sam Ferencik added the comment:

Unfortunately, I don't have a patch.

Some thoughts:

To discover a 32-bit interpreter running on a 64-bit system, we could use
platform.architecture(), which returns
>>> platform.architecture()
('32bit', 'ELF')

What then, though? How do you turn '32bit' to 'linux-i386'? The naive solution
would be to hard-code this as an exception:
- if 32-on-64, use 'i386'
- otherwise, use os.uname()[4], i.e. 'i386' or 'x86_64'

I suspect that's ultra naive, though. The get_platform() code deals with a
number of Unix-like systems (Solaris, AIX, ...). Even if we accepted this
solution only for Linux, leaving the other OSs broken, is 'i386' always the
right answer, or would 'i586' or similar be appropriate in some cases?

We could also take inspiration from Mac OS (_osx_support.get_platform_osx()),
which basically ignores os.uname()[4] completely and constructs the return value
from a set of hard-coded values ('i386' being one of them).

What do you think?

--

___
Python tracker 

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