[issue21197] venv does not create lib64 directory and appropriate symlinks

2014-05-28 Thread Vinay Sajip

Vinay Sajip added the comment:

Issue #18807 relates to symlinks not being available, or not being wanted by 
the user creating the environment. The lib64 symlink is (currently) the only 
case where we symlink to a directory (in the other cases, such as aliases for 
the interpreter, we can use copies rather than symlinks). I propose to make a 
change such that if copying rather than symlinking is specified, the lib64 link 
simply isn't created - a copy would be of no use here.

--

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ce1b8b2ddf07 by Vinay Sajip in branch '3.4':
Issue #18807: If copying (no symlinks) specified for a venv, then the python 
interpreter aliases (python, python3) are now created by copying rather than 
symlinking.
http://hg.python.org/cpython/rev/ce1b8b2ddf07

New changeset f2adaccc13ab by Vinay Sajip in branch 'default':
Issue #18807: Merged fix from 3.4.
http://hg.python.org/cpython/rev/f2adaccc13ab

--

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-28 Thread Vinay Sajip

Vinay Sajip added the comment:

I've made the change - not exactly the same as your patch, which was missing an 
os.chmod() and doing an unnecessary os.path.join() - but thanks for submitting 
a patch :-).

However, note that on 64-bit Linux systems (actually any POSIX other than OS X) 
a symlink lib64 - lib is still created. Perhaps this could be omitted, but I'm 
not sure if that would cause problems with pip. I've posted a note on the 
relevant issue - #21197.

--

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



[issue21591] exec(a, b, c) not the same as exec a in b, c in nested functions

2014-05-28 Thread Robert Jordens

New submission from Robert Jordens:

According to the documentation the exec a in b, c is equivalent to exec(a, 
b, c). But in the testcase below the tuple form causes a SyntaxError while the 
statement form works fine.


diff -r e770d8c4291c Lib/test/test_compile.py
--- a/Lib/test/test_compile.py  Tue May 27 03:30:44 2014 -0400
+++ b/Lib/test/test_compile.py  Wed May 28 02:45:31 2014 -0600
@@ -90,6 +90,22 @@
 with self.assertRaises(TypeError):
 exec(a = b + 1, g, l) in g, l
 
+def test_nested_qualified_exec(self):
+# Can use qualified exec in nested functions.
+code = [
+def g():
+def f():
+if True:
+exec  in {}, {}
+, 
+def g():
+def f():
+if True:
+exec(, {}, {})
+]
+for c in code:
+compile(c, code, exec)
+
 def test_exec_with_general_mapping_for_locals(self):
 
 class M:


SyntaxError: unqualified exec is not allowed in function 'f' it is a nested 
function (code, line 5)

--
components: Interpreter Core
messages: 219259
nosy: Robert.Jordens
priority: normal
severity: normal
status: open
title: exec(a, b, c) not the same as exec a in b, c in nested functions
type: behavior
versions: Python 2.7

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6e2833ae1718 by Serhiy Storchaka in branch '2.7':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particular
http://hg.python.org/cpython/rev/6e2833ae1718

New changeset 6af865f1a59d by Serhiy Storchaka in branch '3.4':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particulr
http://hg.python.org/cpython/rev/6af865f1a59d

New changeset 474c97a5f0c8 by Serhiy Storchaka in branch 'default':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particulr
http://hg.python.org/cpython/rev/474c97a5f0c8

--
nosy: +python-dev

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Claudiu for your contribution.

But please be more careful, your patches contained trailing whitespaces.

Thank you Paul for your report.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue21208] Change default behavior of arguments with type bool when options are specified

2014-05-28 Thread Karl Richter

Karl Richter added the comment:

@paul.j3 That's interesting [1]. Documenting argparse.register seems crucial to 
me (- reopen or file a new request?). 

After dealing more with the very sophisticated and complex functionality of 
argparse I'm sure that this is the only use case where such an unintuitive 
result may happen, so it's worth adding an explicit negative example in the 
docs of argparse.add_argument with a hint to the docs about way that argparse 
handles types.

--
[1] (and a very good example for missing capabilities of QA sites with regard 
to the relation of votes of your much better answer and the one with the 
highest number of votes)

--

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Thomas Heller

Thomas Heller added the comment:

 As for progress, the answer is no as the hope is to eventually replace
 zipimport with something in pure Python thanks to importlib.

Does this mean there is no chance to put this into 3.4 and 3.3, do we really 
have to wait until 3.5 with it's pure-python zipimport?

I (together with the py2exe-users) have the same usecase as Ryan Kelly in 
msg110014:

 I want to digitally sign a frozen python program with appended zipfile,
 which involves appending the signature to the EXE.  Simple to do if
 only zipimport would support appended comments.

--
nosy: +theller

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



[issue20430] Make argparse.SUPPRESS work as an argument dest

2014-05-28 Thread jzwinck

jzwinck added the comment:

Yes, I have a practical need for dest=SUPPRESS.  One of the reasons is 
basically what you said: to implement things analogous to --help.  In those 
cases you want to be able to invoke a function (e.g. via type=myfunc) but not 
store anything.  Or you may need to ignore an argument completely for 
compatibility, but you have logic which expects all the arguments returned by 
parse_args() to be known and meaningful.  In any case, I wrote this ticket 
because I ran into a concrete need that argparse didn't readily support (which 
almost never happens!).

As for what the usage statement should show: it should behave as if 
dest=SUPPRESS were not present.  If metavar is specified, use that, otherwise 
use the option name as if dest were not passed in.  And we already have the 
behavior that help=SUPPRESS will hide it from the usage entirely, so that 
should still work (i.e. dest=SUPPRESS, help=SUPPRESS should hide the option 
both from --help and the result of parse_args()).

--

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Thomas Dybdahl Ahle

New submission from Thomas Dybdahl Ahle:

The statistics module currently contains the following comment:

FIXME: investigate ways to calculate medians without sorting? Quickselect?

This is important, because users expect standard library functions to use state 
of the art implementations, and median by sorting has never been that.

There are many good linear time alternatives, the classical median-of-k 
algorithm was posted to the mailing list in a nice version by David Eppstein in 
2002 [1]. The fastest method in practice is probably Quick Select in the 
Floyd-Rivest version [2] which is similar to quick sort.

These algorithms also have the feature of letting us select any k-th order 
statistic, not just the median. This seems conceptually a lot simpler than the 
current median/median_low/median_high split.

However, sticking with the current api, a new implementation would have to 
support calculating a median as the average of n//2 and (n+1)//2'th order 
statistics. This could be implemented either by calling the select function 
twice, or by implementing a multi-select algorithm, which is also a well 
studied problem [3].

I'll be happy to contribute code, or help out in any other way.

[1]: https://mail.python.org/pipermail/python-list/2002-May/132170.html
[2]: https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm
[3]: 
https://domino.mpi-inf.mpg.de/intranet/ag1/ag1publ.nsf/0/59C74289A2291143C12571C30017DEA8/$file/Mehlhorn_a_2005_o.pdf

--
components: Library (Lib)
messages: 219265
nosy: Thomas.Dybdahl.Ahle
priority: normal
severity: normal
status: open
title: Make statistics.median run in linear time
type: performance
versions: Python 3.4, Python 3.5

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
nosy: +steven.daprano
stage:  - needs patch

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Brett Cannon

Brett Cannon added the comment:

I actually stopped development of a pure Python zip importer so it won't be in 
Python 3.5 either (http://bugs.python.org/issue17630). The motivation simply 
wasn't there if zipimport is going to be sticking around for bootstrapping 
reasons. This can still get fixed in 3.5 (3.4 is Larry's call).

I have added Thomas Wouters and Greg Smith who have done the most work with 
zipimport to the nosy list to see if they have interest in taking a look at the 
patch.

--
nosy: +gregory.p.smith, twouters

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Peter Otten

Changes by Peter Otten __pete...@web.de:


--
nosy: +peter.otten

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c69e8ea3bf10 by Serhiy Storchaka in branch 'default':
Issue #3015: _tkinter.create() now creates tkapp object with wantobject=1 by
http://hg.python.org/cpython/rev/c69e8ea3bf10

--

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Lita Cho, originally reported issue is fixed.

I asked Martin (and Guilherme if he is here). Are you agree to close this 
issue? See issue21585 about extending testing.

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

OK, O_TMPFILE is not related. But Windows is related.

--

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



[issue21593] Clarify re.search documentation first match

2014-05-28 Thread Joshua Landau

New submission from Joshua Landau:

The documentation for re.search does not state that it returns the first match. 
This should be added, or a clarification added if this is 
implementation-defined.

https://docs.python.org/3/library/re.html#re.search

---

See also

http://stackoverflow.com/questions/23906400/is-regular-expression-search-guaranteed-to-return-first-match

--
assignee: docs@python
components: Documentation
messages: 219270
nosy: Joshua.Landau, docs@python
priority: normal
severity: normal
status: open
title: Clarify re.search documentation first match
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Thomas Dybdahl Ahle

Thomas Dybdahl Ahle added the comment:

I have written some proof of concept code here [1], I would appreciate you 
commenting on it, before I turn it into a patch, as I haven't contributed code 
to Python before.

I have tried to write it as efficiently as possible, but it is of course 
possible that the c-implemented `sorted()` code will be faster than even the 
smartest python-implemented select.

[1]: http://pastebin.com/30x0j39a

--

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

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


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

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Terry J. Reedy

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


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

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

Guido van Rossum added the comment:

If you don't know enough about the base class you shouldn't be subclassing it. 
In this particular case you should be overriding __init__, not __new__.

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Марк Коренберг

Марк Коренберг added the comment:

So, maybe API change? like delete=True|False|Maybe ? don't think that this is 
good decisions.

My approach is based on ext4 behaviour about delayed allocation and atomic file 
replacements.
In my case, either old file (with contents) or new file appear.
In any case, corrupted data cannot appear.
This is required behaviour for my application.


https://www.kernel.org/doc/Documentation/filesystems/ext4.txt
http://lwn.net/Articles/322823/

===
auto_da_alloc(*)Many broken applications don't use fsync() when 
noauto_da_alloc replacing existing files via patterns such as
fd = open(foo.new)/write(fd,..)/close(fd)/
rename(foo.new, foo), or worse yet,
fd = open(foo, O_TRUNC)/write(fd,..)/close(fd).
If auto_da_alloc is enabled, ext4 will detect
the replace-via-rename and replace-via-truncate
patterns and force that any delayed allocation
blocks are allocated such that at the next
journal commit, in the default data=ordered
mode, the data blocks of the new file are forced
to disk before the rename() operation is
committed.  This provides roughly the same level
of guarantees as ext3, and avoids the
zero-length problem that can happen when a
system crashes before the delayed allocation
blocks are forced to disk.
===

So, this is essential functionality.

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Марк Коренберг

Марк Коренберг added the comment:

why not to make tmpfileobj.delete as property that really sets 
self._closer.delete ? this will fix my problem.

--

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



[issue21493] Add test for ntpath.expanduser

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e599b301ebd by Serhiy Storchaka in branch '2.7':
Issue #21493: Added test for ntpath.expanduser().  Original patch by
http://hg.python.org/cpython/rev/5e599b301ebd

New changeset a981a088512c by Serhiy Storchaka in branch '3.4':
Issue #21493: Added test for ntpath.expanduser().  Original patch by
http://hg.python.org/cpython/rev/a981a088512c

New changeset 5a71a7e60fe6 by Serhiy Storchaka in branch 'default':
Issue #21493: Added test for ntpath.expanduser().  Original patch by
http://hg.python.org/cpython/rev/5a71a7e60fe6

--
nosy: +python-dev

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

From what I see, you do not need to change either __new__ or __init__, just 
add __enter__ and __exit__ , and you only need to do that in 2.6. Since 
Zipfile is written in Python, you could monkey-patch instead of subclassing, 
if that is easier in your particular case.

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-28 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Looks good to me.

--

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Eric Snow

Eric Snow added the comment:

 If you don't know enough about the base class you shouldn't be subclassing it.

That's important when overriding any API in subclass and absolutely
always essential when it comes to __new__ and __init__!  That's
something that isn't very obvious at first. :(

 In this particular case you should be overriding __init__, not __new__.

Jason's code is doing something like OSError.__new__ does now, which
returns an instance of a subclass depending on the errno.  However,
while the language supports it, I see that as a viable hack only when
backward-compatibilty is a big concern.  Otherwise I find factory
classmethods to be a much better solution for discoverability and
clarity of implementation.

--
nosy: +eric.snow

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



[issue21402] tkinter.ttk._val_or_dict assumes tkinter._default_root exists

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8e5c65719c12 by Serhiy Storchaka in branch '2.7':
Issue #21402: tkinter.ttk now works when default root window is not set.
http://hg.python.org/cpython/rev/8e5c65719c12

New changeset 4a0987b8f630 by Serhiy Storchaka in branch '3.4':
Issue #21402: tkinter.ttk now works when default root window is not set.
http://hg.python.org/cpython/rev/4a0987b8f630

New changeset c112a91ad609 by Serhiy Storchaka in branch 'default':
Issue #21402: tkinter.ttk now works when default root window is not set.
http://hg.python.org/cpython/rev/c112a91ad609

--
nosy: +python-dev

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



[issue21493] Add test for ntpath.expanduser

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Claudiu.

--
resolution:  - fixed
stage:  - resolved
status: open - closed
versions: +Python 2.7, Python 3.4

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 95207bcd8298 by Serhiy Storchaka in branch '3.4':
Restore performance of some dumb database methods (regression introduced by 
#19385).
http://hg.python.org/cpython/rev/95207bcd8298

New changeset 2e59e0b579e5 by Serhiy Storchaka in branch 'default':
Restore performance of some dumb database methods (regression introduced by 
#19385).
http://hg.python.org/cpython/rev/2e59e0b579e5

--

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



[issue21402] tkinter.ttk._val_or_dict assumes tkinter._default_root exists

2014-05-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue21402] tkinter.ttk._val_or_dict assumes tkinter._default_root exists

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report Stephen.

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Claudiu.

--
stage: patch review - resolved
status: open - closed

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



[issue21343] os.path.relpath returns inconsistent types

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

OK. I say the original issue is not a bug.

--
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue21594] asyncio.create_subprocess_exec raises OSError

2014-05-28 Thread Sebastian Kreft

New submission from Sebastian Kreft:

In some cases asyncio.create_subprocess_exec raises an OSError because there 
are no file descriptors available.

I don't know if that is expected, but IMO I think it would be better to just 
block until the required numbers of fds are available. Otherwise one would need 
to do this handling, which is not a trivial task.

This issue is happening in Debian 7, with a 3.2.0-4-amd64 kernel, and python 
3.4.1 compiled from source.

--
messages: 219285
nosy: Sebastian.Kreft.Deezer
priority: normal
severity: normal
status: open
title: asyncio.create_subprocess_exec raises OSError
versions: Python 3.4

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



[issue21594] asyncio.create_subprocess_exec raises OSError

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

I don't know if that is expected, but IMO I think it would be better to just 
block until the required numbers of fds are available.

Does it mean that it can block forever? It sounds strange to try to make such 
error silent.

Why not retrying in case of such error in your application? asyncio has no idea 
how to release file descriptors.

--
nosy: +haypo

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

All works to me.

 import tkinter
 b = tkinter.Button()
 with open('Lib/test/imghdrdata/python.gif', 'rb') as f: data = f.read()
... 
 img = tkinter.PhotoImage(data=data)
 b['image'] = img
 b.pack()

Could you please provide an example which demonstrates the issue?

--
stage:  - test needed

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



[issue21595] Creating many subprocess generates lots of internal BlockingIOError

2014-05-28 Thread Sebastian Kreft

New submission from Sebastian Kreft:

Using the asyncio.create_subprocess_exec, generates lost of internal error 
messages. These messages are:

Exception ignored when trying to write to the signal wakeup fd:
BlockingIOError: [Errno 11] Resource temporarily unavailable

Getting the messages depeneds on how many subprocesses are active at the same 
time. In my system (Debian 7, kernel 3.2.0-4-amd64, python 3.4.1), with 3 or 
less processes at the same time I don't see any problem, but with 4 or more I 
got lot of messages.

On the other hand, these error messages seem to be innocuous, as no exception 
seems to be raised.

Attached is a test script that shows the problem.

It is run as:
bin/python3.4 test_subprocess_error.py MAX_PROCESSES ITERATIONS

it requires to have the du command.


Let me know if there are any (conceptual) mistakes in the attached code.

--
files: test_subprocess_error.py
messages: 219288
nosy: Sebastian.Kreft.Deezer
priority: normal
severity: normal
status: open
title: Creating many subprocess generates lots of internal BlockingIOError
versions: Python 3.4
Added file: http://bugs.python.org/file35385/test_subprocess_error.py

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, it would be easy to restore this behavior on Posix.

--
keywords: +easy
stage:  - needs patch

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



[issue21596] asyncio.wait fails when futures list is empty

2014-05-28 Thread Sebastian Kreft

New submission from Sebastian Kreft:

Passing an empty list/set of futures to asyncio.wait raises an Exception, which 
is a little annoying in some use cases.

Probably this was the intended behavior as I see there's a test case for that. 
If such, then I would propose to document that behavior.

--
assignee: docs@python
components: Documentation
messages: 219290
nosy: Sebastian.Kreft.Deezer, docs@python
priority: normal
severity: normal
status: open
title: asyncio.wait fails when futures list is empty
versions: Python 3.4

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



[issue20689] socket.AddressFamily is absent in pydoc output

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We should discuss this suggestion on Python-Dev. It affects the use of enums in 
other modules.

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-28 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

Summary for 
htest-28052014-34.diff and htest-28052014-27.diff

1. Add htest for GrepDialog,UndoDelegator and configDialog
2. Makes changes to the way the help string is displayed. The label has been 
replaced by a text widget made to look like a label, and also scrollable. The 
result is that the htest root dialog stays in the same place and same size 
throughout.(See the code for more information).
3. Some minor change to spec dict strings and in ObjectBrowser for child dialog 
placement.

With this, it leaves AutoCompleteWindow, TkMessageBoxes, Debugger(from 
21477-htest.txt) to be tested. 

OutputWindow - already being tested from GrepDialog. There is nothing extra to 
be tested separately.

FileList - Is it already being tested through EditorWindow?
In case there is a need to test them, please say so. The code is ready.

RemoteDebugger and RemoteObjectBrowser - I need some input on how to begin with 
them.


Next: Apart from the above htest, a way to destroy the child when user clicks 
'next', for certain modules like ClassBrowser, which don't work by the method 
of http://bugs.python.org/msg219161

--
Added file: http://bugs.python.org/file35386/htest-28052014-34.diff

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



[issue21477] Idle: improve idle_test.htest

2014-05-28 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Added file: http://bugs.python.org/file35387/htest-28052014-27.diff

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

Guido van Rossum added the comment:

Sorry, I didn't realize why __new__ was being used. But what Jason's code is 
doing isn't any cleaner than monkey-patching.

--

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



[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My worry about the patch is that is is a bandage covering up a problem 
elsewhere.

1. You indicate that you only have a problem with your custom build, but not on 
a standard build. This seems odd. Perhaps the problem is with your build.

2. turtledemo.__main__ only calls root.destroy indirectly via
root.wm_protocol(WM_DELETE_WINDOW, self._destroy)
def _destroy(self):
self.root.destroy()
sys.exit()
Let's assume that .destroy is called when the exception happens (verifiable by 
adding print('destroy called').)

3. The purpose of Tk.destroy is to cleanly deconstruct the gui before python's 
random cleanup. Should it have cleared PhotoImage?

Image and Variable (and subclasses) are the only classes in tkinter.__init__ 
with __del__ methods. Both have a tcl.call, so Variable potentially has the 
same problem as Image. But neither seem to have a problem in routine tkinter 
use.

4. Why is there a PhotoImage to be deleted? Idle Find in Files does not find 
'PhotoImage' in turtledemo/*.py. I believe it is created as follows. 
turtledemo.DemoWindonw.__init__ contains this odd pair of lines that 
initializes a turtle.Screen instance with turtle.TurtleScreen.__init__ 
(TurtleScreen subclasses TurtleScreenBase, not Screen).
self.screen = _s_ = turtle.Screen()
turtle.TurtleScreen.__init__(_s_, _s_._canvas)
The latter call creates a collection of default turtles (_shapes) that includes 
'blank', a 1x1 (pixel) blank PhotoImage that gets tkinter._default_root as 
(default) master.

I suspect that adding either of these lines to _destroy would prevent the 
TclError.
del self.screen  # before self.root.destroy()
import tkinter; tkinter._default_root.destroy()  # after self.root

5. While it seems like a buglet for turtle to create a hidden PhotoImage, with 
an anonymous master, and not clean it up somehow; and while I am puzzled if 
this never happens with standard builds; it seems plausible that we could patch 
Variable/Image.__delete__ to be sure they do not leak an exception.

Serhiy, what do you think?

--
nosy:  -gpolo

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



[issue21585] Run Tkinter tests with wantobjects=False

2014-05-28 Thread Lita Cho

Changes by Lita Cho lita@gmail.com:


--
nosy: +Lita.Cho, jesstess

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



[issue18132] buttons in turtledemo disappear on small screens

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

On my widescreen, the buttons are completely gone when I shrink vertically to 
about 720 pixels. So they must be gone on a 600x800 screen or 720x1280 small 
widescreen and perhaps on a non-fullscreen window on a 780x10xx screen. I agree 
with fixing this if possible.

The patch applies cleanly to 3.4 and fixes the problem with the buttons. 
However, it introduces a problem with the vertical canvas scrollbar, on the 
right. It does not appear when it should and does not scroll the entire canvas 
when it does appear. Try it with bytedesign, and see if you can fix it with an 
altered patch.

--
stage:  - patch review
versions: +Python 3.5 -Python 3.3

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



[issue21597] Allow turtledemo code pane to get wider.

2014-05-28 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Turtledemo (python -m turtledemo) has a text pane for code and a canvas pane 
for the actual demo. The code pane is fixed at about 60% of the width needed to 
display full-width code lines. If the window is expanded horizontally, all the 
expansion goes to the canvas pane, where it is mostly not needed or used. 
Almost all the examples are a fixed size on the canvas, independent of the size 
of the window on the canvas. 

Having the text pane too narrow makes it harder to read and copy the code than 
it would be if entire code lines were visible. The default width of the overall 
window is about 1250 pixels on my big monitor. Many people have more pixels 
than that. Even on smaller screen, people might like to temporarily allocate 
more space to the text. So I think the best solution, if possible with tkinter, 
would be a movable divider.

--
messages: 219296
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Allow turtledemo code pane to get wider.
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2014-05-28 Thread Samuel Bronson

Changes by Samuel Bronson naes...@gmail.com:


--
nosy: +SamB

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



[issue21596] asyncio.wait fails when futures list is empty

2014-05-28 Thread STINNER Victor

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


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2014-05-28 Thread Stefan Krah

Stefan Krah added the comment:

Sunny, is there a definition of visible positional fields? Currently,
it seems to me that in os.stat_result we have the opposite problem, namely
visible non-positional fields:

For example, st_atime_ns is visible but not indexable:

os.stat_result(st_mode=33188, st_ino=524840, st_dev=64513, st_nlink=1, 
st_uid=0, st_gid=0, st_size=2113, st_atime=1401225421, st_mtime=1398786163, 
st_ctime=1398786163)
 x[9]
1398786163
 x.st_atime_ns
1401225421887116783
 x[10] 
Traceback (most recent call last):
  File stdin, line 1, in module
IndexError: tuple index out of range

--

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



[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

1. 3.3 is in security fixes only mode and shutdowning mechanism was changed in 
3.4.

2. Looks as some Tk root was not explicitly destroyed and deleted during 
shutdown stage.

3. Tk.destroy does nothing with images, it destroys only subcomponents and 
commands. In any case it destroys only Tcl/Tk objects, not Python objects 
which wrap them.

4. I think we shouldn't use _default_root outside the tkinter package. This is 
implementation detail.

5. Agree, we could patch Variable/Image.__del__, and proposed patch looks 
correct (other way is pass TclError as default value for optional parameter: 
def __del__(self, TclError=TclError), both ways are widely used). But I 
prefer first try to reproduce this in tests.

--

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



[issue21595] Creating many subprocess generates lots of internal BlockingIOError

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

Exception ignored when trying to write to the signal wakeup fd message comes 
from the signal handler in Modules/signalmodule.c. The problem is that Python 
gets a lot of SIGCHLD signals (the test scripts creates +300 processes per 
second on my computer). The producer (signal handler writing the signal number 
into the self pipe) is faster than the consumer 
(BaseSelectorEventLoop._read_from_self callback).

Attached patch should reduce the risk of seeing the message Exception ignored 
when trying to write to the signal wakeup fd. The patch reads all pending of 
the self pipe, instead of just trying to read a signal byte.

The test script doesn't write the error message anymore when the patch is 
applied (the script creates more than 300 processes per second).

The patch doesn't solve completly the issue. Other possible enhancements:

* Add a flag in the signal handler to notify that a signal was received, and 
write a single byte until the flag is reset to False. It would avoid to fill 
the pipe. It requires to implement a custom signal handler implemented in C, 
different from signal handlers of the Python module.

* Add an higher priority to callbacks of signal handlers. Asyncio doesn't 
support priority on callbacks right now.

* Increaze the size of the pipe. On Linux, it looks like fcntl(fd, 
F_SETPIPE_SZ, size); can be used. The maximum size is 
/proc/sys/fs/pipe-max-size (ex: 1 MB of my Fedora 20).

--
keywords: +patch
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov
Added file: http://bugs.python.org/file35388/asyncio_read_from_self.patch

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Maybe I should have focused on a more trivial example to demonstrate the place 
where my expectation was violated. The use of a real-world example is 
distracting from my intended point. Consider instead this abstract example:

class SomeClass(SomeParentClass):
def __new__(cls, *args, **kwargs):
return super(SomeClass, cls).__new__(cls, *args, **kwargs)

def __init__(self, *args, **kwargs):
super(SomeClass, self).__init__(*args, **kwargs)

Ignoring for a moment the incongruity of the invocation of __new__ with 'cls' 
due to __new__ being a staticmethod, the naive programmer expects the above 
SomeClass to work exactly like SomeParentClass because both overrides are 
implemented as a trivial pass-through.

And indeed that technique will work just fine if the parent class implements 
both __init__ and __new__, but if the parent class (or one of its parents) does 
not implement either of those methods, the technique will fail, because the 
fall through to 'object' class.

I believe this incongruity stems from the fact that __new__ and __init__ are 
special-cased not to be called if they aren't implemented on the class.

Therefore, to write SomeClass without knowledge of the SomeParentClass 
implementation, one could write this instead:

class SomeClass(SomeParentClass):
def __new__(cls, *args, **kwargs):
super_new = super(SomeClass, cls).__new__
if super_new is object.__new__:
return super_new(cls)
return super_new(cls, *args, **kwargs)

def __init__(self, *args, **kwargs):
super_init = super(SomeClass, self).__init__
if super_init.__objclass__ is object:
return
super_init(*args, **kwargs)

Now that implementation is somewhat ugly and perhaps a bit brittle 
(particularly around use of __objclass__). Ignoring that for now, it does have 
the property that regardless of the class from which it derives, it will work, 
including:

SomeParentClass = datetime.datetime # implements only __new__
SomeParentClass = zipfile.ZipFile # implements only __init__
class SomeParentClass: pass # implements neither __init__ nor __new__

While I would prefer a language construct that didn't require this dance for 
special casing (or similarly require the programmer to hard-code the dance to a 
specific implementation of a specific parent class as Guido recommends), at the 
very least I would suggest that the documentation better reflect this somewhat 
surprising behavior.

Currently, the documentation states 
[https://docs.python.org/2/reference/datamodel.html#object.__new__] effectively 
Typical implementations of __new__ invoke the superclass’ __new__() method 
with appropriate arguments. It's left as an exercise to the reader to 
ascertain what 'appropriate arguments' are, and doesn't communicate that the 
introduction or omission of __new__ or __init__ to a class hierarchy affects 
the process by which a class is constructed/initialized.

Greg Smith's blog demonstrates some even more dangerous cases. I don't 
understand why his concerns weren't addressed, because they seem legitimate, 
and I agree with his conclusion that the older behavior is more desirable, 
despite the concerns raised by the OP.

--

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



[issue21595] Creating many subprocess generates lots of internal BlockingIOError

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

BaseProactorEventLoop._loop_self_reading() uses an overlapped read of 4096 
bytes. I don't understand how it wakes up the event loop. When the operation is 
done, _loop_self_reading() is scheduled with call_soon() by the Future object. 
Is it enough to wake up the event loop?

Is BaseProactorEventLoop correct?

--

Oh, I forgot to explain this part of asyncio_read_from_self.patch:

+data = self._ssock.recv(4096)
+if not data:
+break

This break should never occur. It should only occur if _ssock is no more 
blocking. But it would be a bug, because this pipe is private and set to 
non-blocking at its creation.

I chose to add the test because it should not hurt to add it just in case 
(and to avoid an unlimited busy loop).

--

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



[issue20430] Make argparse.SUPPRESS work as an argument dest

2014-05-28 Thread paul j3

paul j3 added the comment:

In the attached file I tried another approach - a custom Action class.  It 
gives you the custom behavior now, instead of 2-3 releases in the future.

class Action2(Action):
# custom action
def __init__(self, *args, **kwargs):
super(Action2, self).__init__(*args, **kwargs)
self.default = SUPPRESS 
def __call__(self, parser, namespace, values, option_string=None):
   print('Action2', argparse._get_action_name(self), values)

'self.default=SUPPRESS' keeps the dest out of the namespace without affecting 
help display.  And as with '_HelpAction', the __call__ can do its own thing 
without modifying the namespace.

One thing that this custom Action class does not do well is let you modify the 
handling of the argument after it is created.  For example if an argument is 
created by an imported parent parser, attributes like 'dest' and 'default' can 
be changed after the fact, but the argument class can't.

In   http://bugs.python.org/issue14191  I wrestled with the issue of 
temporarily disabling subsets of the arguments, first the positionals, and then 
the optionals, so I could run 'parse_known_args' separately on the two groups.

For optionals it was enough to ensure that 'required=False'.  For positionals I 
first used 'nargs=0', and latter enabled a 'nargs=SUPPRESS' option to suppress 
them.

--
Added file: http://bugs.python.org/file35389/issue20430.py

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



[issue1641] asyncore delayed calls feature

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

asyncore documentation now starts with this note (which was approved by the 
asyncore maintainer):
This module exists for backwards compatibility only. For new code we recommend 
using asyncio.

Since asyncio is now part of the stdlib, I don't think that it's worth to 
enhance asyncore. asyncore has design flaws like its poll() function which 
doesn't scale well with the number of file descriptors.

The latest patch for this issue was written 5 years ago, I don't think that 
many people are waiting for this feature in asyncore. Delayed calls are part of 
asyncio core, it's well designed and *efficient*.

So I'm now closing this issue. Upgrade your code to asyncio!

--
nosy: +haypo
resolution:  - wont fix
status: open - closed

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



[issue777588] asyncore is broken for windows if connection is refused

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

This issue was opened 11 years ago, when Windows 95, 98, Me, 2000 and XP were 
used. Python is going to drop support of Windows XP, and most older versions 
are already no more supported. Does this issue still exist in recent Windows 
versions? I'm not aware of such bug.

Does asyncio have the bug?

--
nosy: +haypo

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



[issue21208] Change default behavior of arguments with type bool when options are specified

2014-05-28 Thread paul j3

paul j3 added the comment:

In http://bugs.python.org/issue11588#msg212243  I explore the option of using 
decorators to 'register' custom functions with the parser.  There I was adding 
exclusive/inclusive tests, but the same approach could be used to register 
custom types and actions.

I should start a new issue re. documenting the use of 'register'.

--

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Based on the example above, I've created a blog post to publish my 
recommendation for overriding these special methods in a way that's safe 
regardless of the parent implementation, given the status quo:

http://blog.jaraco.com/2014/05/how-to-safely-override-init-or-new-in.html

--

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



[issue21119] asyncio create_connection resource warning

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

Can someone review close-3.patch please?

--

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



[issue19662] smtpd.py should not decode utf-8

2014-05-28 Thread Maciej Szulik

Maciej Szulik added the comment:

I'm attaching file issue19662_v1.patch. David please have a look at it and let 
me know if this is it, if not I'm waiting for your suggestions.

--
Added file: http://bugs.python.org/file35390/issue19662_v1.patch

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

A first patch to fill remaining XXX docstring of events.py.

--
keywords: +patch
Added file: http://bugs.python.org/file35391/asyncio_events_docstring.patch

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



[issue21376] asyncio docs refer to wrong TimeoutError

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6d90e8df01f4 by Victor Stinner in branch '3.4':
Issue #21376: document asyncio.TimeoutError
http://hg.python.org/cpython/rev/6d90e8df01f4

New changeset 03bb1077b362 by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21376: document asyncio.TimeoutError
http://hg.python.org/cpython/rev/03bb1077b362

--
nosy: +python-dev

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



[issue21376] asyncio docs refer to wrong TimeoutError

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for the report. In fact, asyncio.TimeoutError was not documented at all. 
It should now be fixed.

--
resolution:  - fixed
status: open - closed

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



[issue21443] asyncio logging documentation clarifications

2014-05-28 Thread STINNER Victor

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


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue21443] asyncio logging documentation clarifications

2014-05-28 Thread Guido van Rossum

Guido van Rossum added the comment:

Good idea.

--

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



[issue21454] asyncio's loop.connect_read_pipe makes pipes non-blocking contrary to the documentation

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16f399588b2a by Victor Stinner in branch '3.4':
Issue #21454: Fix asyncio.BaseEventLoop.connect_read_pipe doc
http://hg.python.org/cpython/rev/16f399588b2a

New changeset 8391f99208f6 by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21454: Fix asyncio.BaseEventLoop.connect_read_pipe doc
http://hg.python.org/cpython/rev/8391f99208f6

--
nosy: +python-dev

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



[issue21454] asyncio's loop.connect_read_pipe makes pipes non-blocking contrary to the documentation

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

Yes, the documentation was wrong. It should now be fixed. Thanks for the report.

--
resolution:  - fixed
status: open - closed

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



[issue15014] smtplib: add support for arbitrary auth methods

2014-05-28 Thread Milan Oberkirch

Milan Oberkirch added the comment:

Done.

--
Added file: http://bugs.python.org/file35392/smtplib_auth.patch

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



[issue13451] sched.py: speedup cancel() method

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

 Serhiy, perhaps it would be useful to see if such optimizations can apply to 
 Tulip's (or asyncio's) event loop, since it will probably be the new standard 
 in 3.4.

asyncio was designed differently. Cancelling a task doesn't remove it from a 
list of pending tasks. Cancelled tasks are just skipped when the event loop 
executes tasks.

If you look more closely, a task can be a Handle, Future or Task object. A 
Handle object has a _cancelled attribute, its cancel() method just sets this 
attribute to True. It's almost the same for a Future object. In the context of 
a Task object, cancel() is very different because it sends a CancelledError 
exception into the running code.

I see no possible optimization here.

--
nosy: +haypo

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



[issue15014] smtplib: add support for arbitrary auth methods

2014-05-28 Thread Milan Oberkirch

Changes by Milan Oberkirch milan...@oberkirch.org:


--
nosy: +jesstess

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-05-28 Thread Martin Panter

Martin Panter added the comment:

Thanks for looking at this. Originally the issue was found by reading the GIF 
and PNG images on various web pages, such as 
http://www.weatherzone.com.au/vic/north-central/castlemaine. However I was 
also able to produce the problem with the other formats of that Python logo:

$ python3 -Wall -bt
Python 3.4.1 (default, May 19 2014, 17:40:19) 
[GCC 4.9.0 20140507 (prerelease)] on linux
Type help, copyright, credits or license for more information.
 import tkinter; tk = tkinter.Tk(); text = tkinter.Text(tk); text.pack()
 with open(/lib/python3.4/test/imghdrdata/python.png, rb) as file: data 
 = file.read()
... 
 image = tkinter.PhotoImage(format=png, data=data)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/tkinter/__init__.py, line 3384, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
  File /usr/lib/python3.4/tkinter/__init__.py, line 3340, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: CRC check failed
 u8png = tkinter.PhotoImage(format=png, 
 data=data.decode(latin-1).encode(utf-8))
 text.image_create(tkinter.END, image=u8png)
'pyimage2'

The same problem occurs with the PGM and PPM logos, and the Base-64 encoding 
trick does not work with those; only UTF-8 encoding. However as you discovered, 
the GIF format logo works no problem when passed unencoded, although it 
continues to work if I use my UTF-8 encoding trick, which is a bit strange. 
Perhaps the internal UTF-8 decoding step is passing the invalid UTF-8 straight 
through?

--

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



[issue17172] Add turtledemo to IDLE menu

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

0. My general interest is in running external programs and in particular, for 
this issue, python modules intended to be run as main. Some other scripts I 
would like to be able to easily launch from Idle include 
List/test.test_idle.py, Tools/Scripts/patchcheck.py, and a possible 
'idle_tour.py' (in progress) that would be a live demo/tutorial of some Idle 
widgets and functions. I would like the list to be user-configurable for other 
choices.

1. As with any python script, turtledemo can be run now, without modification, 
in a separate process, asynchronously, from within idle, by loading the file 
into an editor window and selecting Run / Run Module or hitting F5. 
Communication and cleanup issues are already solved. Having output appear in 
the Shell window obviates the need for a separate console window to receive 
output, keeps it visible even after the external process quits. One thing that 
remains impossible is to run two separate modules at the same time.

A possible inplementation of 'easy to launch' would be to load turtledemo.py 
into an editor window and generate a 'run-module' event.

This, of course, does more than is needed and has the danger of a user 
accidentally overwriting the original module code. An alternative would be a 
stripped down version of ScriptBinding.ScriptBinding._run_module_event.

2. This feature should be implemented as an extension rather than being 'baked' 
into Idle. Run-module itself is an extension (ScriptBinding.py), as are several 
other functions (see config-extensions.def). A possible name would be 
'external_module.py'

An advantage of an extension is that it can be turned off if someone, such as a 
college course instructor, does not like it present. This change could be made 
before considering point 1.

I would like to have one extension that could handle multiple external modules 
listed in the config entry. After reading config-bindings.def and some of the 
extension files, especially RstripExtension.py, I believe this is possible. 
However, I would expect to add this after there is a patch just for turtledemo.

3. If Run were on the menu of Shell windows, that would be the appropriate 
place for 'run external module' as opposed 'run editor module'. This would be 
especially true with multiple entries.

--

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



[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2014-05-28 Thread Terry J. Reedy

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


--
versions: +Python 3.5 -Python 3.3

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



[issue21326] asyncio: request clearer error message when event loop closed

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

I proposed a patch upstream (in Tulip) to solve this issue:
http://code.google.com/p/tulip/issues/detail?id=169

--
nosy: +haypo

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

Guido van Rossum added the comment:

Hrm. I've always thought that the key point of cooperative MI was the term 
*cooperative*. Consider a regular (non-constructor) method. You must have a 
common base class that defines this method, and *that* method shouldn't be 
calling the super-method (because there isn't one). All cooperative classes 
extending this method must derive from that base class.

It's the same for __init__ and __new__, except that you may treat each 
(keyword) argument as a separate method. But you must still have a point in the 
tree to eat that argument, and that point must not pass it up the super call 
chain.

If in a particular framework you want unrecognized keyword arguments to the 
constructor to be ignored, you should define a common base class from which all 
your cooperative subclasses inherit. But given the prevalence of *single* 
inheritance, 'object' shouldn't be that common base class.

--

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-05-28 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch to address Guido's remarks.

FYI I copied the documentation from the Doc repository and 
Lib/asyncio/unix_events.py (for child watchers), and so I copied typos :-) I 
tried to fix all copies of the documentation in my new patch.

I didn't mention the API of a child watcher because the class is not 
documented yet... nor get_child_watcher and set_child_watcher functions! (I 
mean not documented in the Doc/ directory). I suggest to open a new issue to 
enhance the documentation of this part of the part.

--
Added file: http://bugs.python.org/file35393/asyncio_events_docstring-2.patch

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



[issue21585] Run Tkinter tests with wantobjects=False

2014-05-28 Thread Lita Cho

Lita Cho added the comment:

So I don't know what the best way to do this, but I changed the widget_tests.py 
in order to set tkinter.wantobjects = 0 if a 'wantobjects' flag was passed 
through test.support.use_resources. 

Then I added a new test called test_ttk_guionly_wantobj, where it turns on 
wantobjects. If we create a new module, then we start off with a clean tkinter 
object.

Before I go this route for all the tests, I wanted to make sure if this was the 
correct way to go about it.

--

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



[issue21585] Run Tkinter tests with wantobjects=False

2014-05-28 Thread Lita Cho

Lita Cho added the comment:

Patches lived in my Linux machine. I've attached my patch. I will add my module 
next.

--
keywords: +patch
Added file: http://bugs.python.org/file35394/test_wantobj.patch

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



[issue21585] Run Tkinter tests with wantobjects=False

2014-05-28 Thread Lita Cho

Changes by Lita Cho lita@gmail.com:


Added file: http://bugs.python.org/file35395/test_ttk_guionly_wantobj.py

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Wed, May 28, 2014 at 02:43:29PM +, Thomas Dybdahl Ahle wrote:

 I have written some proof of concept code here [1], I would appreciate 
 you commenting on it, before I turn it into a patch, as I haven't 
 contributed code to Python before.

Thanks Thomas! I will try to look at this over the weekend (today is 
Thursday my time). If I haven't responded by Monday your time, please 
feel free to send me a reminder.

 I have tried to write it as efficiently as possible, but it is of 
 course possible that the c-implemented `sorted()` code will be faster 
 than even the smartest python-implemented select.

My quick-and-dirty tests suggest that you need at least 10 million items 
in the list before a pure Python median-of-median algorithm is as fast 
as the median algorithm based on sorting in C.

 [1]: http://pastebin.com/30x0j39a

--

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



[issue3991] urllib.request.urlopen does not handle non-ASCII characters

2014-05-28 Thread Graham Oliver

Graham Oliver added the comment:

hello
I came across this bug when using 'ā' in a url
To get around the problem I used the 'URL encoded' version '%C4%81' instead of 
'ā'
See this page
http://www.charbase.com/0101-unicode-latin-small-letter-a-with-macron
I tried using the 'puny code' for 'ā' 'xn--yda' but that didn't work

--
nosy: +Graham.Oliver

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



[issue21598] Is __getitem__ and __len__ implementations enough to make a user-defined class sliceable?

2014-05-28 Thread Santoso Wijaya

New submission from Santoso Wijaya:

The reference doc for Python data model says that __getslice__ is deprecated 
[1], and that __getitem__ should be used instead:



Deprecated since version 2.0: Support slice objects as parameters to the 
__getitem__() method. (However, built-in types in CPython currently still 
implement __getslice__(). Therefore, you have to override it in derived classes 
when implementing slicing.)



But I'm getting the following behavior when I try it myself. Is there something 
I'm missing?



$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
 class tup(object):
... def __getitem__(self, i):
... if i == 0: return 0
... if i == 1: return 1
... 
KeyboardInterrupt
 class tup(object):
... def __getitem__(self, i):
... if i in (0, 1): return i
... else: raise IndexError()
... def __len__(self):
... return 2
... 
 t = tup()
 len(t)
2
 t[0], t[1]
(0, 1)
 t[:2]
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 4, in __getitem__
IndexError
 t[:1]
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 4, in __getitem__
IndexError



[1] https://docs.python.org/2/reference/datamodel.html#object.__getslice__

--
components: Library (Lib)
messages: 219326
nosy: santa4nt
priority: normal
severity: normal
status: open
title: Is __getitem__ and __len__ implementations enough to make a user-defined 
class sliceable?
type: behavior
versions: Python 2.7

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



[issue21598] Is __getitem__ and __len__ implementations enough to make a user-defined class sliceable?

2014-05-28 Thread Santoso Wijaya

Santoso Wijaya added the comment:

Hm. The docstring for __getitem__ doesn't mention it can/should be accepting 
slice object as argument. That's what I'm missing. Doc patch?

--

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



[issue21598] Is __getitem__ and __len__ implementations enough to make a user-defined class sliceable?

2014-05-28 Thread Santoso Wijaya

Changes by Santoso Wijaya santoso.wij...@gmail.com:


--
resolution:  - not a bug
status: open - closed

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



[issue21599] Argument transport in attach and detach method in Server class in base_events file is not used

2014-05-28 Thread Vajrasky Kok

New submission from Vajrasky Kok:

In Lib/asyncio/base_events.py, we have these lines of code:

---
def attach(self, transport):
assert self.sockets is not None
self.active_count += 1

def detach(self, transport):
assert self.active_count  0
self.active_count -= 1
if self.active_count == 0 and self.sockets is None:
self._wakeup()


The transport is not used. We can remove them. Here is the patch to remove the 
arguments.

If for higher philosophical reason, we need this unused argument, maybe we can 
comment it.

--
components: Library (Lib)
files: remove_transport_in_base_events.patch
keywords: patch
messages: 219328
nosy: haypo, vajrasky
priority: normal
severity: normal
status: open
title: Argument transport in attach and detach method in Server class in 
base_events file is not used
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file35396/remove_transport_in_base_events.patch

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Yeah, I remember I tried to improve the performance of the median in the past 
using median-of-k algorithm. But too bad I could not beat sorted C function 
efficiency. Maybe you have a better luck!

--
nosy: +vajrasky

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



[issue17172] Add turtledemo to IDLE menu

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I withdraw my suggestion that turtledemo get anything added just for moving 
code to Idle. What is does need is the ability to widen the code pane so one 
can more easily read or cut (by normal means). See #21597.

One of my concerns about putting turtledemo on the Idle menu is that people 
will see it as part of Idle. Fine it it works well ;-). Not so fine if it does 
not. The solution is to fix any important current problems. #18132 (buttons 
disappear on small screens) has a patch that fixes the problem but creates 
another. I have not yet looked at the other open turtledemo issues.

--

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



[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-05-28 Thread fumihiko kakuma

New submission from fumihiko kakuma:

It seems that stopall doesn't work when do start patch.dict to sys.modules.
I show sample scripts the following.

Using stopall test case seems to always refer the first mock foo object.
But using stop it refers a new mock foo object.

$ cat test_sampmod.py
import foo

def myfunc():
print myfunc foo=%s % foo
return foo
$ cat test_samp.py
import mock
import sys
import unittest


class SampTestCase(unittest.TestCase):
def setUp(self):
self.foo_mod = mock.Mock()
self.m = mock.patch.dict('sys.modules', {'foo': self.foo_mod})
self.p = self.m.start()
print foo_mod=%s % self.foo_mod
__import__('test_sampmod')
self.test_sampmod = sys.modules['test_sampmod']

def tearDown(self):
if len(sys.argv)  1:
self.m.stop()
print  stop patch
else:
mock.patch.stopall()
print  stopall patch

def test_samp1(self):
self.assertEqual(self.foo_mod, self.test_sampmod.myfunc())

def test_samp2(self):
self.assertEqual(self.foo_mod, self.test_sampmod.myfunc())

def test_samp3(self):
self.assertEqual(self.foo_mod, self.test_sampmod.myfunc())

if __name__ == '__main__':
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(SampTestCase))
unittest.TextTestRunner(verbosity=2).run(suite)
$ python test_samp.py stop
test_samp1 (__main__.SampTestCase) ... foo_mod=Mock id='41504336'
myfunc foo=Mock id='41504336'
 stop patch
ok
test_samp2 (__main__.SampTestCase) ... foo_mod=Mock id='41504464'
myfunc foo=Mock id='41504464'
 stop patch
ok
test_samp3 (__main__.SampTestCase) ... foo_mod=Mock id='41504720'
myfunc foo=Mock id='41504720'
 stop patch
ok

--
Ran 3 tests in 0.004s

OK
$ python test_samp.py
test_samp1 (__main__.SampTestCase) ... foo_mod=Mock id='19152464'
myfunc foo=Mock id='19152464'
 stopall patch
ok
test_samp2 (__main__.SampTestCase) ... foo_mod=Mock id='19152592'
myfunc foo=Mock id='19152464'
FAIL
 stopall patch
test_samp3 (__main__.SampTestCase) ... foo_mod=Mock id='19182096'
myfunc foo=Mock id='19152464'
FAIL
 stopall patch

==
FAIL: test_samp2 (__main__.SampTestCase)
--
Traceback (most recent call last):
  File test_samp.py, line 27, in test_samp2
self.assertEqual(self.foo_mod, self.test_sampmod.myfunc())
AssertionError: Mock id='19152592' != Mock id='19152464'

==
FAIL: test_samp3 (__main__.SampTestCase)
--
Traceback (most recent call last):
  File test_samp.py, line 30, in test_samp3
self.assertEqual(self.foo_mod, self.test_sampmod.myfunc())
AssertionError: Mock id='19182096' != Mock id='19152464'

--
Ran 3 tests in 0.003s

FAILED (failures=2)
$

--
components: Tests
messages: 219331
nosy: kakuma
priority: normal
severity: normal
status: open
title: mock.patch.stopall doesn't work with patch.dict to sys.modules
type: behavior
versions: Python 2.7

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2014-05-28 Thread paul j3

paul j3 added the comment:

This is not getting much attention for several reasons:

- there's quite a backlog of argparse patches and issues

- 'set_defaults' is not commonly used.  Setting default in 'add_argument' seems 
more common.

- defining the same argument for both the parser and subparser can create other 
difficulties.

- in Bethard's example, 'set_default' sets an attribute that has no connection 
to any argument.  It's a cleaver trick that few users will think to use, and 
probably won't be of much value.

The idea proposed here of using a subnamespace for the subparser is 
interesting.  It reminds me of a StackOverflow question about implementing 
nested namespaces.

http://stackoverflow.com/questions/18668227

--

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



[issue21601] Cancel method for Asyncio Task is not documented

2014-05-28 Thread Vajrasky Kok

New submission from Vajrasky Kok:

https://docs.python.org/3.5/library/asyncio-task.html#task

The cancel method is not documented although it is a part of public API. Here 
is the patch to fix the doc.

--
assignee: docs@python
components: Documentation
files: fix_doc_asyncio_task.patch
keywords: patch
messages: 219333
nosy: docs@python, haypo, vajrasky
priority: normal
severity: normal
status: open
title: Cancel method for Asyncio Task is not documented
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35397/fix_doc_asyncio_task.patch

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



[issue21602] smtplib.py socket.create_connection() also doesn't handle EINTR properly

2014-05-28 Thread Syou Ei

New submission from Syou Ei:

The smtplib.py also has the same problem.
The EINTR cannot be handled properly.

2014-05-21 19:20:15,631 ERROR actions: Notification 'socket_noti' FAILED to 
send emails to set(['mailt...@tscoss.com']): class 'socket.error' - [Errno 4] 
Interrupted system calltrace:Traceback (most recent call last):
  File Utils.py, line 719, in sendEmail
server = smtplib.SMTP(host, port, timeout=DEFAULT_SOCKET_TIMEOUT)
  File /opt/zenoss/lib/python2.7/smtplib.py, line 242, in __init__
(code, msg) = self.connect(host, port)
  File /opt/zenoss/lib/python2.7/smtplib.py, line 302, in connect
self.sock = self._get_socket(host, port, self.timeout)
  File /opt/zenoss/lib/python2.7/smtplib.py, line 277, in _get_socket
return socket.create_connection((port, host), timeout)
  File /opt/zenoss/lib/python2.7/Write failed: Broken pipecreate_connection

--
components: Library (Lib)
messages: 219334
nosy: flox, gregory.p.smith, haypo, meishao, neologix, pitrou, tholzer
priority: normal
severity: normal
status: open
title: smtplib.py socket.create_connection() also doesn't handle EINTR properly
type: behavior
versions: Python 2.7

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



[issue21477] Idle: improve idle_test.htest

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 90dab7696e89 by Terry Jan Reedy in branch '2.7':
Issue #21477: Add htests for GrepDialog, UndoDelegator, and configDialog.
http://hg.python.org/cpython/rev/90dab7696e89

New changeset d90905960803 by Terry Jan Reedy in branch '3.4':
Issue #21477: Add htests for GrepDialog, UndoDelegator, and configDialog.
http://hg.python.org/cpython/rev/d90905960803

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Ned, this patch includes a call to macosxSupport. 
_initializeTkVariantTests(root) in htest.run. Does this work on mac or is 
something else needed (like doing the same for individual tests that create 
another root)?

--

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