[issue25505] undefined name 'window' in Tools/scripts/fixdiv.py

2015-10-28 Thread John Mark Vandenberg

Changes by John Mark Vandenberg :


Added file: http://bugs.python.org/file40889/fixdiv-remove-truncate.diff

___
Python tracker 

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



[issue25505] undefined name 'window' in Tools/scripts/fixdiv.py

2015-10-28 Thread John Mark Vandenberg

New submission from John Mark Vandenberg:

Tools/scripts/fixdiv.py 's `FileContext.truncate` has used `window` since it 
was created, when it is supposed to use self.window.

https://hg.python.org/cpython/annotate/60f290a7eae8/Tools/scripts/fixdiv.py#l195

`truncate` is unused, so an alternative fix is to remove it, as it has never 
worked, and nobody has complained.

--
components: Demos and Tools
files: fixdiv.diff
keywords: patch
messages: 253661
nosy: John.Mark.Vandenberg
priority: normal
severity: normal
status: open
title: undefined name 'window' in Tools/scripts/fixdiv.py
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40888/fixdiv.diff

___
Python tracker 

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



[issue25503] inspect.getdoc does find inherited property __doc__

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you John for your report and your patch.

Committed tests are slightly changed because "contradiction" was originally 
purposed to test properties.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25503] inspect.getdoc does find inherited property __doc__

2015-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bbf00faf25ff by Serhiy Storchaka in branch '3.5':
Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.
https://hg.python.org/cpython/rev/bbf00faf25ff

New changeset e80d1e9737d4 by Serhiy Storchaka in branch 'default':
Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.
https://hg.python.org/cpython/rev/e80d1e9737d4

--
nosy: +python-dev

___
Python tracker 

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



[issue25502] unnecessary re-imports

2015-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dec0a26d0b4d by Benjamin Peterson in branch '3.5':
remove duplicated imports (closes #25502)
https://hg.python.org/cpython/rev/dec0a26d0b4d

New changeset 695c50c8cc92 by Benjamin Peterson in branch 'default':
merge 3.5 (#25502)
https://hg.python.org/cpython/rev/695c50c8cc92

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25482] signal.set_wakeup_fd() doesn't work if the signal don't have handler

2015-10-28 Thread Benjamin Peterson

Benjamin Peterson added the comment:

The OP probably wants something like the Linux-specific signalfd() syscall.

--

___
Python tracker 

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



[issue25504] undefined name 'modules' in Tools/freeze/checkextensions_win32.py

2015-10-28 Thread John Mark Vandenberg

New submission from John Mark Vandenberg:

All versions of Tools/freeze/checkextensions_win32.py have had an error due to 
accessing 'modules.sourceFiles' instead of 'module.sourceFiles'.

https://hg.python.org/cpython/diff/8e9d5e5103f5/Tools/freeze/checkextensions_win32.py#l1.96

Presumably there is something which makes this block of code rather 
infrequently used.

--
components: Demos and Tools
files: checkextensions_win32.diff
keywords: patch
messages: 253656
nosy: John.Mark.Vandenberg, mhammond
priority: normal
severity: normal
status: open
title: undefined name 'modules' in Tools/freeze/checkextensions_win32.py
type: crash
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40887/checkextensions_win32.diff

___
Python tracker 

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



[issue25502] unnecessary re-imports

2015-10-28 Thread John Mark Vandenberg

Changes by John Mark Vandenberg :


Added file: http://bugs.python.org/file40886/re-imports.diff

___
Python tracker 

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



[issue25496] tarfile: Default value for compresslevel is not documented

2015-10-28 Thread Sworddragon

Sworddragon added the comment:

At tarfile, but the compresslevel argument is mentioned there but not its 
default value.

--
title: Default value for compresslevel is not documented -> tarfile: Default 
value for compresslevel is not documented

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun

Changes by eryksun :


Removed file: http://bugs.python.org/file40884/ctypes_from_buffer_1.patch

___
Python tracker 

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



[issue24805] Python installer having problem in installing Python for all users in Windows

2015-10-28 Thread mandeep

mandeep added the comment:

Team,

Please let me know , if there is a workaround to this.

--

___
Python tracker 

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



[issue25503] inspect.getdoc does find inherited property __doc__

2015-10-28 Thread John Mark Vandenberg

Changes by John Mark Vandenberg :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25503] inspect.getdoc does find inherited property __doc__

2015-10-28 Thread John Mark Vandenberg

New submission from John Mark Vandenberg:

inspect.getdoc's helper _finddoc raises an AttributeError on encountering a 
property, which is silently discarded.

>>> class Foo(object):
... @property
... def foo(self):
... """foobar."""
... return 'foo'
... 
>>> class Bar(Foo):
... @property
... def foo(self):
... return 'bar'
... 
>>> import inspect
>>> inspect.getdoc(Foo.foo)
'foobar.'
>>> inspect.getdoc(Bar.foo)
>>>

How I came upon this was doing static code analysis, and the f.fget on line 522 
here looks very wrong.

http://bugs.python.org/review/15582/diff/14140/Lib/inspect.py

This code dedicated to supporting `property` does not work because of that, but 
also because a property is also a data descriptor so the 'property' branch is 
never executed.

>>> inspect.isdatadescriptor(property())
True

--
components: Library (Lib)
files: getdoc-property.diff
keywords: patch
messages: 253653
nosy: John.Mark.Vandenberg
priority: normal
severity: normal
status: open
title: inspect.getdoc does find inherited property __doc__
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40885/getdoc-property.diff

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun

Changes by eryksun :


--
keywords: +patch
Added file: http://bugs.python.org/file40884/ctypes_from_buffer_1.patch

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun

Changes by eryksun :


Added file: http://bugs.python.org/file40883/ctypes_crash.py

___
Python tracker 

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



[issue25486] Resurrect inspect.getargspec() in 3.6

2015-10-28 Thread John Mark Vandenberg

Changes by John Mark Vandenberg :


--
nosy: +John.Mark.Vandenberg

___
Python tracker 

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



[issue25395] SIGSEGV using json.tool: highly nested OrderedDict

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

Left a comment about a minor English grammar problem.

The existing comment Serhiy mentioned was added way back in 2003 for Issue 
668433. It appears to use the same underlying technique, reverting the nesting 
level before calling the base class dealloc. One paragraph talks about the 
extra increment used there compared to Serhiy’s method:

'''
But now it's possible that a chain of objects consisting solely of objects 
whose deallocator is subtype_dealloc() will defeat the trashcan mechanism 
completely: the decremented level means that the effective level never reaches 
the limit.  Therefore, we *increment* the level *before* entering the trashcan 
block, and matchingly decrement it after leaving.  This means the trashcan code 
will trigger a little early, but that's no big deal.
'''

I think we may not have to worry about this for ordered dict, assuming that 
PyDict_Type.tp_dealloc() can only recursively invoke odict_dealloc() from 
within its own trashcan block.

So as far as I can tell, this patch is good to apply, unless someone with more 
knowledge of garbage collection has any comments.

--

___
Python tracker 

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



[issue25502] unnecessary re-imports

2015-10-28 Thread John Mark Vandenberg

New submission from John Mark Vandenberg:

The following four modules re-import another module unnecessarily as it is 
already imported in the global scope.

Lib/getpass.py : msvcrt
Lib/pickletools.py : sys
Lib/smtplib.py : sys
PC/testpy.py : os

In each case, the import being removed in the attached patch existed in the 
source code before the import which now occurs first.  i.e. an import was added 
and the same import elsewhere in the module was not removed.

--
components: Library (Lib)
files: re-imports.diff
keywords: patch
messages: 253651
nosy: John.Mark.Vandenberg
priority: normal
severity: normal
status: open
title: unnecessary re-imports
versions: Python 3.6
Added file: http://bugs.python.org/file40882/re-imports.diff

___
Python tracker 

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



[issue25156] shutil.copyfile should internally use os.sendfile when possible

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

Also, the os.sendfile() doc suggests that some platforms only support writing 
to sockets, so I definitely think a backup plan is needed.

--
stage:  -> patch review

___
Python tracker 

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



[issue25156] shutil.copyfile should internally use os.sendfile when possible

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

I’ve never used sendfile() nor shutil.copyfile(), but my immediate reaction is 
maybe we need a backup plan if os.sendfile() is available but not supported in 
the circumstances. E.g. if it is practical to use copyfile() to copy from a 
named socket in the filesystem, the Linux man page 
 says it will raise 
EINVAL in this case. Maybe a test case would be good to prove this is still 
handled.

--

___
Python tracker 

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



[issue25156] shutil.copyfile should internally use os.sendfile when possible

2015-10-28 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Adding interested parties from earlier ticket.

--
nosy: +josh.r, martin.panter, r.david.murray

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

Please see Issue 25498 for a crash possibly caused by the memoryview hack in 
CDataType_from_buffer().

--

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

I traced this down to part of revision 1da9630e9b7f (Issue #22896). If I revert 
the changes to CDataType_from_buffer() at 
, the crash no longer 
happens. I suspect the offending code is this, that is trying to stash the 
original buffer protocol supporting object into a memory view:

mv = PyMemoryView_FromBuffer(&buffer);
if (mv == NULL) {
PyBuffer_Release(&buffer);
return NULL;
}
/* Hack the memoryview so that it will release the buffer. */
((PyMemoryViewObject *)mv)->mbuf->master.obj = buffer.obj;
((PyMemoryViewObject *)mv)->view.obj = buffer.obj;
//~ Py_INCREF(buffer.obj);
if (-1 == KeepRef((CDataObject *)result, -1, mv))
result = NULL;

If I enable my INCREF() line it also stops the crash, but I guess at the 
expense of a memory leak.

--
components: +ctypes -Interpreter Core
keywords: +3.4regression
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25501] Use async/await through asyncio docs

2015-10-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

We have dropped 3.3 in aiohttp BTW.
Proper handling of resource leaks is too annoying without PEP 442 which don't 
crash with core dump starting from Python 3.4.1

--

___
Python tracker 

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



[issue25501] Use async/await through asyncio docs

2015-10-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Also sphinx (pygments actually) still do not support async/await syntax 
highlighting yet.

--
nosy: +asvetlov

___
Python tracker 

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



[issue25156] shutil.copyfile should internally use os.sendfile when possible

2015-10-28 Thread desbma

desbma added the comment:

Thoughts anyone?
Here is a patch that implements the change.

My tests show a 30-40% performance improvement for 128KB-512MB single file copy:

128 KB file copy:

$ dd if=/dev/urandom of=/tmp/f1 bs=1K count=128

Without the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
1 loops, best of 3: 109 usec per loop

With the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
1 loops, best of 3: 75.7 usec per loop


8 MB file copy:

$ dd if=/dev/urandom of=/tmp/f1 bs=1M count=8

Without the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
100 loops, best of 3: 4.99 msec per loop

With the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
100 loops, best of 3: 3.03 msec per loop


512 MB file copy:

$ dd if=/dev/urandom of=/tmp/f1 bs=1M count=512

Without the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
10 loops, best of 3: 305 msec per loop

With the patch:
$ ./python -m timeit -s 'import shutil; p1 = "/tmp/f1"; p2 = "/tmp/f2"' 
'shutil.copyfile(p1, p2)'
10 loops, best of 3: 178 msec per loop

--
keywords: +patch
Added file: http://bugs.python.org/file40881/issue25156.patch

___
Python tracker 

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



[issue25500] docs claim __import__ checked for in globals, but IMPORT_NAME bytecode does not

2015-10-28 Thread R. David Murray

R. David Murray added the comment:

Fix the docs.

--
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



[issue25501] Use async/await through asyncio docs

2015-10-28 Thread Guido van Rossum

Guido van Rossum added the comment:

It makes it more awkward to keep the asyncio docs in sync between 3.4 and 3.5. 
Also it makes copying examples harder for users who need compatibility with 3.4 
or 3.3.

--

___
Python tracker 

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



[issue24765] Move .idlerc to %APPDATA%\IDLE on Windows

2015-10-28 Thread Mark Roseman

Mark Roseman added the comment:

Further to Terry's backwards compatibility issues (also discussed in #8231).

Storing things in the "correct" location (%APPDATA% on Windows, and Application 
Support on OS X) would presumably be the "right" thing to do if backwards 
compatibility weren't an issue.  

If "APPDATA" is the "correct" place, and "HOME" is what we've been using now, 
consider a solution like this:

- check if prefs exist in APPDATA; if so, use that
- check if prefs exist in HOME; if so, use that
- if neither, create prefs in APPDATA

This handles the common cases of existing user upgrading to new scheme (things 
stay stored in old location), new user upgrading to newer versions in future 
(things go in new place), but fails on the case of user starts with new version 
and then later uses an older version (results in two separate preferences, one 
used by newer versions, one used by older).

I think it's a legitimate question as to whether that latter case is common 
enough or problematic enough to worry about it (given "fails" doesn't break 
anything).

--
nosy: +markroseman

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Martin Panter

Martin Panter added the comment:

Crashes on Linux x86-64 for me with and without --with-pydebug, with the 
default 3.6 branch, 3.5.0, and 3.4 tip. No extra debugging output though in the 
--with-pydebug cases though.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25500] docs claim __import__ checked for in globals, but IMPORT_NAME bytecode does not

2015-10-28 Thread Brett Cannon

Brett Cannon added the comment:

I think the documentation is wrong. Going all the way back to Python 2.7, you 
will see that importing a module emits IMPORT_NAME as the bytecode. That 
bytecode only looks for __import__ in the builtin  namespace: 
https://hg.python.org/cpython/file/2.7/Python/ceval.c#l2588 . That then calls 
PyImport_ImportModuleLevel(): 
https://hg.python.org/cpython/file/2.7/Python/bltinmodule.c#l49 . That then 
just ends up executing import.

If you look at PyImport_Import() in Python 2.7 that comes the closest to what 
the docs reference, but that still uses __builtins__.__import__ based on 
finding __builtins__ from the global namespace: 
https://hg.python.org/cpython/file/2.7/Python/import.c#l2825 . But that isn't 
directly called by import itself and is just a C-level API.

If you look in Python 3, then you will see that as far back as Python 3.3 the 
code in importlib is more or less the same: __import__ is used when importing a 
parent and then importlib is used for the rest: 
https://hg.python.org/cpython/file/default/Lib/importlib/_bootstrap.py#l944 . 
This was introduced so that the accelerated C version of __import__ would be 
used to import the parent rather than automatically going down the pure Python 
path for stuff such as resolving names and such. This was never done to 
explicitly import using something defined in the globals namespace (although 
this does lead to supporting it).

And if you go all the way back to Python 3.0 you will notice that getting 
__import__ from the builtins namespace only has been in place: 
https://hg.python.org/cpython/file/3.0/Python/ceval.c#l1959 .

So I think the key point here is that the bytecode for IMPORT_NAME doesn't 
match the docs. So the question is do we want to add the feature to Python 3 to 
look for import in the globals or would we rather leave it as is and fix the 
docs?

--
title: _find_and_load_unlocked doesn't always use __import__ -> docs claim 
__import__ checked for in globals, but IMPORT_NAME bytecode does not

___
Python tracker 

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



[issue8231] Unable to run IDLE without write-access to home directory

2015-10-28 Thread Mark Roseman

Mark Roseman added the comment:

Just a note that the 'store things in APPDATA' is issue #24765

--

___
Python tracker 

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



[issue25501] Use async/await through asyncio docs

2015-10-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
nosy: +ezio.melotti
type:  -> enhancement

___
Python tracker 

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



[issue25501] Use async/await through asyncio docs

2015-10-28 Thread Brett Cannon

New submission from Brett Cannon:

The asyncio docs still use `yield from` and @asyncio.coroutine all over the 
place instead of async/await. It would be best to update the docs to follow 
best practices (unless there is some reason I can't think of as to why this 
hasn't happened yet).

--
assignee: docs@python
components: Documentation
messages: 253636
nosy: brett.cannon, docs@python, giampaolo.rodola, gvanrossum, haypo, pitrou, 
yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: Use async/await through asyncio docs
versions: Python 3.6

___
Python tracker 

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



[issue25500] _find_and_load_unlocked doesn't always use __import__

2015-10-28 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +brett.cannon, eric.snow

___
Python tracker 

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



[issue25500] _find_and_load_unlocked doesn't always use __import__

2015-10-28 Thread Sergei Lebedev

New submission from Sergei Lebedev:

According to the current import system documentation

> When calling ``__import__()`` as part of an import statement, the import 
> system first checks the module global namespace for a function by that name. 
> If it is not found, then the standard builtin ``__import__()`` is called.

However, one can easily verify this isn't (always) the case::

import sys

assert "glob" not in sys.modules
__import__ = print
   
import glob  # Doesn't print anything.

I've traced the import statement from ``ceval.c`` to the frozen 
``importlib._bootstrap`` and it seems the cause of the problem is in 
``_find_and_load_unlocked``, which simply ignores the ``_import`` argument in 
the case above::

def _find_and_load_unlocked(name, import_):
path = None
# ... parent processing ...
spec = _find_spec(name, path)
if spec is None:
raise ImportError(_ERR_MSG.format(name), name=name)
else:
# XXX import_ is not used.
module = _SpecMethods(spec)._load_unlocked()
# ... more parent processing ...
return module

I'm not sure if this is a bug in the documentation or implementation, so any 
feedback is appreciated.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 253635
nosy: docs@python, superbobry
priority: normal
severity: normal
status: open
title: _find_and_load_unlocked doesn't always use __import__
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread desbma

desbma added the comment:

I was actually writing a patch with a test, but since Stéphane beat me to it, 
I'll let him do the job :)

--

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

totally agree, I will work on this issue tomorrow

--

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread SilentGhost

SilentGhost added the comment:

This probably needs test

--
nosy: +SilentGhost

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Maybe, modify the documentation or improve the current examples.

--

___
Python tracker 

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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith

Eric V. Smith added the comment:

Thanks, Serihy. I looked at those, and neither one is a great fit. But not 
having a better option, I went with ceval.h. Here's the patch.

--
Added file: http://bugs.python.org/file40880/format-opcode-2.diff

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Here is a small patch

--
keywords: +patch
nosy: +matrixise
Added file: http://bugs.python.org/file40879/issue25485.patch

___
Python tracker 

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



[issue18973] Use argparse in the calendar module

2015-10-28 Thread SilentGhost

Changes by SilentGhost :


--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue18973] Use argparse in the calendar module

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Serhiy,

I just reviewed your patch, works fine with 3.6.

--
nosy: +matrixise

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-10-28 Thread Mouse

Mouse added the comment:

Thank you for the quick turn-around, and for taking care of this issue!

--

___
Python tracker 

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



[issue25499] use argparse for the calendar module

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Because we need only one issue for every feature.

Tests was committed in issue18982. The patch in issue18973 just waits for 
review.

--

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Here is a patch with the submitted description.

--
keywords: +patch
nosy: +matrixise
Added file: http://bugs.python.org/file40878/issue25495.patch

___
Python tracker 

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



[issue25496] Default value for compresslevel is not documented

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Sworddragon,

Where compresslevel is not mentioned in the doc ?

Thank you

--
nosy: +matrixise

___
Python tracker 

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



[issue25499] use argparse for the calendar module

2015-10-28 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Why do you close it ? Ok, it's a duplicated issue, but the other issue is not 
closed. So, in that issue, there is no tests, maybe we can add some tests and 
re-submit a new patch.

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



[issue25499] use argparse for the calendar module

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue18973.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Use argparse in the calendar module

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Robert for your report and patch.

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

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset faeeb8dbe432 by Serhiy Storchaka in branch '3.4':
Issue #21827: Fixed textwrap.dedent() for the case when largest common
https://hg.python.org/cpython/rev/faeeb8dbe432

New changeset c307ae7b3d9f by Serhiy Storchaka in branch '2.7':
Issue #21827: Fixed textwrap.dedent() for the case when largest common
https://hg.python.org/cpython/rev/c307ae7b3d9f

New changeset 3f29be82c944 by Serhiy Storchaka in branch '3.5':
Issue #21827: Fixed textwrap.dedent() for the case when largest common
https://hg.python.org/cpython/rev/3f29be82c944

New changeset 8d3932671e48 by Serhiy Storchaka in branch 'default':
Issue #21827: Fixed textwrap.dedent() for the case when largest common
https://hg.python.org/cpython/rev/8d3932671e48

--
nosy: +python-dev

___
Python tracker 

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



[issue25499] use argparse for the calendar module

2015-10-28 Thread Stéphane Wirtel

New submission from Stéphane Wirtel:

optparse is marked as deprecated. 

I have moved argparse for the calendar module.

Need reviews.

--
components: Library (Lib)
files: calendar_move_to_argparse.patch
keywords: patch
messages: 253619
nosy: matrixise
priority: normal
severity: normal
status: open
title: use argparse for the calendar module
versions: Python 3.6
Added file: http://bugs.python.org/file40877/calendar_move_to_argparse.patch

___
Python tracker 

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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does the dis module need these constants? If no, you can use either ceval.h or 
compile.h.

--

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Zachary Ware

Zachary Ware added the comment:

I get the crash on OSX with recent builds of 3.4 and 3.6:

Assertion failed: (self->exports == 0), function mbuf_dealloc, file 
Objects/memoryobject.c, line 115.
Abort trap: 6

--
nosy: +jnoller, sbt, zach.ware
stage:  -> needs patch
type:  -> crash
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread R. David Murray

R. David Murray added the comment:

The program does not crash for me on gentoo running python 3.4 tip 
(--with-pydebug).  It does crash running gentoo's stock 3.4.3.  So, perhaps 
this bug has already been fixed.

--
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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith

Eric V. Smith added the comment:

Brett: I'll take a look.

Serhiy: I'm looking for a place to put some #defines related to the bit masks 
and bit values that my FORMAT_VALUE opcode is using for opargs. One option is 
to just put them in Tools/scripts/generate_opcode_h.py, so that they end up in 
the generated opcode.h, but that seems a little sleazy. I can't find a better 
place they'd belong, though.

Specifically, I want to put these lines into a .h file to use by ceval.c and 
compile.c:

/* Masks and values for FORMAT_VALUE opcode. */
#define FVC_MASK  0x3
#define FVS_MASK  0x4
#define FVC_NONE  0x0
#define FVC_STR   0x1
#define FVC_REPR  0x2
#define FVC_ASCII 0x3
#define FVS_HAVE_SPEC 0x4

--

___
Python tracker 

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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I'll try to find some reasonable .h file to use and submit a new patch soon.

It's Lib/opcode.py.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Jake Montgomery

New submission from Jake Montgomery:

We are seeing a consistent "invalid memory access" crash in Python3.4.3. 

*Test setup* 
This is occurring on Ubuntu 14.04.1 LTS. It is occurring on multiple unrelated 
installs, but has not been tested with any other operating system. It occurs 
using the "Python 3.4.3 (default, Oct 14 2015, 20:28:29)" that is installed 
using apt-get. It does *not* appear to occur using Python 3.4.0. Other versions 
of python were not tested. 

*Reproducing*
I was able to reduce the code needed to a pretty minimal python program, which 
is attached. Running this as "pyton3 ./pythoncrash.py" will trigger the crash, 
and a core dump if enabled. 

If run under python3.4.3-dbg The error is:

python3.4-dbg: ../Objects/memoryobject.c:115: mbuf_dealloc: Assertion 
`self->exports == 0' failed.

In some versions of this code, it had to be run twice, since it would only 
occur when the pyc files were already created. The attached version does not 
appear to have this behavior, but run it twice, at least, if you do not see the 
crash. 

The code supplied is "minimal", in that removing any line will cause the crash 
not to occur.

*More clues*
I suspect that the key is the multiprocessing.Value object, and its 
destruction. The other "import" statements may just be happenstance needed to 
create the correct memory conditions for the crash. I was able to start 
"stubbing out" the actual code in those imported packages, and the crash 
continued as long as the number of functions, classes, and class dependencies 
were maintained. But that became too tedious. In earlier versions of the test 
code, adding or removing significant numbers of function or classes could make 
the crash not manifest. 

*Stack trace*
Running under python3.4.3-dbg, gdb gives the following stack trace:

#0  0x7fc0425b4cc9 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x7fc0425b80d8 in __GI_abort () at abort.c:89
#2  0x7fc0425adb86 in __assert_fail_base (
fmt=0x7fc0426fe830 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x707199 "self->exports == 0",
file=file@entry=0x70715a "../Objects/memoryobject.c", line=line@entry=115,
function=function@entry=0x708923 <__PRETTY_FUNCTION__.10355> 
"mbuf_dealloc") at assert.c:92
#3  0x7fc0425adc32 in __GI___assert_fail (assertion=0x707199 "self->exports 
== 0",
file=0x70715a "../Objects/memoryobject.c", line=115,
function=0x708923 <__PRETTY_FUNCTION__.10355> "mbuf_dealloc") at 
assert.c:101
#4  0x004beb92 in mbuf_dealloc (self=0x7fc042068058) at 
../Objects/memoryobject.c:115
#5  0x004cd67b in _Py_Dealloc (op=)
at ../Objects/object.c:1749
#6  0x004c0ec6 in memory_clear (self=0x7fc042026bf8) at 
../Objects/memoryobject.c:1079
#7  0x004409c3 in delete_garbage (collectable=0x7fff21065180,
old=0x9a4f40 ) at ../Modules/gcmodule.c:866
#8  0x00440f56 in collect (generation=2, n_collected=0x7fff210651e8,
n_uncollectable=0x7fff210651f0, nofail=0) at ../Modules/gcmodule.c:1032
#9  0x0044144e in collect_with_callback (generation=2) at 
../Modules/gcmodule.c:1140
#10 0x004421f2 in PyGC_Collect () at ../Modules/gcmodule.c:1616
#11 0x004226a0 in Py_Finalize () at ../Python/pythonrun.c:607
#12 0x00428f38 in Py_Exit (sts=0) at ../Python/pythonrun.c:2713
#13 0x00426077 in handle_system_exit () at ../Python/pythonrun.c:1812
#14 0x004260a2 in PyErr_PrintEx (set_sys_last_vars=1) at 
../Python/pythonrun.c:1822
#15 0x00425cef in PyErr_Print () at ../Python/pythonrun.c:1718
#16 0x004255c4 in PyRun_SimpleFileExFlags (fp=0x29824c0,
filename=0x7fc042442b68 "./pythoncrash.py", closeit=1, flags=0x7fff21065520)
at ../Python/pythonrun.c:1611
#17 0x00424418 in PyRun_AnyFileExFlags (fp=0x29824c0,
filename=0x7fc042442b68 "./pythoncrash.py", closeit=1, flags=0x7fff21065520)
at ../Python/pythonrun.c:1292
#18 0x0043e9fb in run_file (fp=0x29824c0, filename=0x28b62f0 
L"./pythoncrash.py",
p_cf=0x7fff21065520) at ../Modules/main.c:319
#19 0x0043f781 in Py_Main (argc=2, argv=0x28b5020) at 
../Modules/main.c:751
#20 0x0041e6d6 in main (argc=2, argv=0x7fff21065798) at 
../Modules/python.c:69

The full core dump is available, if it would help.

--
components: Interpreter Core
files: pythoncrash.py
messages: 253613
nosy: JakeMont
priority: normal
severity: normal
status: open
title: Python 3.4.3 core dump with simple sample code
versions: Python 3.4
Added file: http://bugs.python.org/file40876/pythoncrash.py

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread R. David Murray

Changes by R. David Murray :


--
versions: +Python 3.4

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread R. David Murray

R. David Murray added the comment:

You are right, I'd forgotten we hadn't done 3.4 final yet.

--

___
Python tracker 

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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Brett Cannon

Brett Cannon added the comment:

I know this issue is slowly turning into "make Eric update outdated docs", but 
if you find that 
https://docs.python.org/devguide/compiler.html#introducing-new-bytecode is 
outdated, could you update that doc?

--

___
Python tracker 

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



[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith

Eric V. Smith added the comment:

Oops. Forgot to include the diff with that last message. But it turns out it 
doesn't work, anyway, because I put the #define's in opcode.h, which is 
generated (so my code got deleted!).

I'll try to find some reasonable .h file to use and submit a new patch soon.

--

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I thought that 3.4 will switch to "security fixes only" mode after releasing 
first release since releasing 3.5.0. It was so with 3.2 and 3.3.

--

___
Python tracker 

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



[issue21333] Document recommended exception for objects that shouldn't be pickled

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PicklingError is raised in following cases:

1. Programmical Pickler error (Pickler.__init__() was not called by subclass' 
__init__()).

2. Due to protocol or implementation limitations: memoizing more than 2**32 
objects, saving non-ASCII globals with protocol < 3, etc. Exception type is 
implementation depended. Sometimes OverflowError or struct.error can be raised 
instead.

3. When __reduce__/__reduce_ex__ returns invalid value: neither str or tuple, a 
tuple has wrong size, first tuple element is not a callable, first argument for 
__newobj__/__newobj_ex__ has no __new__ or doesn't match a type of pickled 
object, global lookup is failed or doesn't match pickled object, etc.

4. When extension code is not an integer or out of range.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-10-28 Thread Mouse

Mouse added the comment:

Yes I know where this came from. :-)

Here is my proposed change.

Replace the statement 

The length of data should be at most 57 to adhere to the base64 standard.

with:

To be MIME-compliant, the Base64 output (as defined in RFC4648) should be 
broken into lines of at most 76 characters long. This post-processing of the 
output is the responsibility of the caller. Note that the original PEM 
context-transfer encoding limited line length to 64 characters.


Would this change be agreeable to you?

--

___
Python tracker 

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



[issue21333] Document recommended exception for objects that shouldn't be pickled

2015-10-28 Thread Michael Crouch

Michael Crouch added the comment:

When pickling an object fails on line 70 of copy_reg.py, a "TypeError" is 
raised. However, according to section 11.1.3 of the Standard Library 
documentation, when an unpicklable object is passed to the dump() method the 
"PicklingError" exception will be raised.

--
components: +Library (Lib) -Documentation
nosy: +Michael Crouch
versions: +Python 2.7 -Python 3.5

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Serhiy, your way looks best.  Go ahead with it.

--
assignee: rhettinger -> serhiy.storchaka

___
Python tracker 

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



[issue25489] sys.exit() caught in exception handler

2015-10-28 Thread Guido van Rossum

Guido van Rossum added the comment:

How about we extend loop.stop() so that you can pass it an exception to
raise once the loop is stopped? This exception would then be thrown out of
run_forever(). There may be some delay (callbacks already scheduled will
run first) but it is how things were meant to be.

FWIW this isn't really enough to ensure cleanup happens before destructors
run -- when the loop exits, tasks may still be active unless you keep track
of all of them and explicitly cancel them (and run the loop until they have
processed the cancellation).

--

___
Python tracker 

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



[issue8231] Unable to run IDLE without write-access to home directory

2015-10-28 Thread Mark Roseman

Mark Roseman added the comment:

Checked on Linux and Mac - doesn't work correctly. mkdtemp() returns a 
different name every time it's called, and GetUserCfgDir() is called in three 
places, meaning we end up with three different tmp directories (which on quick 
examination didn't all get cleaned up at end).

I'd suggest changing it so that GetUserCfgDir() caches its result and returns 
the cached version on subsequent calls. Running out the door so don't have time 
to try this myself right now...

--

___
Python tracker 

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



[issue25489] sys.exit() caught in exception handler

2015-10-28 Thread R. David Murray

R. David Murray added the comment:

Using sys.exit means you are depending on garbage collection to clean up all of 
your program's resources.  In the general case this is a bad idea.  A better 
design is to call loop.stop, and then do cleanup (which might involve calling 
some wait_closed functions via loop.run_until_complete).  If you just call 
sys.exit, your resources may not get cleaned up correctly, or may not get 
cleaned up correctly somewhat randomly due to the indeterminacies in the order 
in which garbage collection is done.  This may not matter for a simple program, 
but I find it makes it easier for me if I just do it "the right way" always :)

--

___
Python tracker 

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



[issue25482] signal.set_wakeup_fd() doesn't work if the signal don't have handler

2015-10-28 Thread STINNER Victor

STINNER Victor added the comment:

> IMO this reduces usefulness of set_wakeup_fd(). (...)

Sorry, I don't understand your use case. Could you elaborate. What do you need?

--

According to the GNU libc doc, the signal SIGWINCH is *ignored* by default:
"Window size change. This is generated on some systems (including GNU) when the 
terminal driver’s record of the number of rows and columns on the screen is 
changed. The default action is to ignore it."
https://www.gnu.org/software/libc/manual/html_node/Miscellaneous-Signals.html

For signal.set_wakeup_fd() I agree that the doc can be enhanced. It's not 
explicit that only signals with a *Python* signal handler (at least, a signal 
handler registered by signal.signal) write into the "wakeup FD".

--

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread R. David Murray

R. David Murray added the comment:

It's one of the PEPs (I forget which one).  We only apply non-security fixes to 
the most recent non-development branch...except that for now we also apply bug 
fixes to 2.7.  So, 2.7, 3.5, and 3.6 are the targets for this issue.

--
versions:  -Python 3.4

___
Python tracker 

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



[issue25497] Rewrite test_robotparser

2015-10-28 Thread Berker Peksag

New submission from Berker Peksag:

The attached patch rewrites test_robotparser to use a class based approach.

Other changes:

* Added support.reap_threads to PasswordProtectedSiteTestCase
* Reenabled testPythonOrg since the python.org problem has already been fixed

--
components: Tests
files: test_robotparser.diff
keywords: patch
messages: 253599
nosy: berker.peksag
priority: normal
severity: normal
stage: patch review
status: open
title: Rewrite test_robotparser
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40875/test_robotparser.diff

___
Python tracker 

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



[issue20519] Replace uuid ctypes usage with an extension module.

2015-10-28 Thread Gustavo J. A. M. Carneiro

Gustavo J. A. M. Carneiro added the comment:

New patch that:

1. adds assert(sizeof(uuid_t) == 16); to the extension module;

2. fixes the code path when ctypes has to be used instead of the extension 
module (needed a bit more refactoring, apologies if it makes the diff harder to 
read);

3. Adjusts the uuid module tests to account for the possibility of ctypes not 
being imported.

--
Added file: http://bugs.python.org/file40874/uuid.diff

___
Python tracker 

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



[issue25485] Add a context manager to telnetlib.Telnet

2015-10-28 Thread Berker Peksag

Berker Peksag added the comment:

This seems like a reasonable request to me.

See https://docs.python.org/devguide/ to learn how to contribute to Python.

--
nosy: +berker.peksag
stage:  -> needs patch

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. But the implementation can be more efficient. Here is optimized patch.

34e88a05562f.diff:
$ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" 
"*100)' -- 'textwrap.dedent(s)'
1 loops, best of 3: 87.5 usec per loop
$ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" 
"*1000)' -- 'textwrap.dedent(s)'
1000 loops, best of 3: 780 usec per loop

issue21827.patch:
$ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" 
"*100)' -- 'textwrap.dedent(s)'
1 loops, best of 3: 51 usec per loop
$ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" 
"*1000)' -- 'textwrap.dedent(s)'
1000 loops, best of 3: 395 usec per loop

--
nosy: +serhiy.storchaka
stage: needs patch -> patch review
versions:  -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file40873/issue21827.patch

___
Python tracker 

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



[issue25482] signal.set_wakeup_fd() doesn't work if the signal don't have handler

2015-10-28 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +haypo

___
Python tracker 

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



[issue20607] multiprocessing cx_Freeze windows GUI bug (& easy fixes)

2015-10-28 Thread Mark Summerfield

Mark Summerfield added the comment:

I've now signed the contributor agreement.

However, with Python 3.4 I don't seem to get the same problem anymore even 
though there are a few places in the code where sys.std{err,out} are used 
without if ... is not None guards.

--

___
Python tracker 

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



[issue25496] Default value for compresslevel is not documented

2015-10-28 Thread Berker Peksag

Changes by Berker Peksag :


--
assignee:  -> docs@python
components: +Documentation
keywords: +easy
nosy: +berker.peksag, docs@python
stage:  -> needs patch
versions: +Python 3.4, Python 3.6

___
Python tracker 

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



[issue25489] sys.exit() caught in exception handler

2015-10-28 Thread Brian Sutherland

Brian Sutherland added the comment:

Calling loop.stop() means that I need other, more complex code, to store and 
return the non-zero exit status.

--

___
Python tracker 

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-10-28 Thread John Mark Vandenberg

John Mark Vandenberg added the comment:

Not surprising also occurs on Python 3.2, 3.3, & 3.6.
I'm not sure whether fixes like this are suitable to be merged into 3.2/3.3.(is 
there a document describing this?)

--
nosy: +John.Mark.Vandenberg
versions: +Python 3.2, Python 3.3, Python 3.6

___
Python tracker 

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



[issue25496] Default value for compresslevel is not documented

2015-10-28 Thread Sworddragon

New submission from Sworddragon:

After ticket #21404 got solved I'm noticing that the default value for the 
compresslevel argument is not mentioned. Maybe this can be documented too.

--
components: Library (Lib)
messages: 253592
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: Default value for compresslevel is not documented
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue19628] maxlevels -1 on compileall for unlimited recursion

2015-10-28 Thread Sworddragon

Sworddragon added the comment:

I'm wondering what the recursion limit is if -l and -r are not given. Does it 
default to 10 too or is there no limit? If the first is the case maybe this 
should also get documented.

--

___
Python tracker 

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



[issue25432] isinstance documentation: explain behavior when type is a tuple

2015-10-28 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue25432] isinstance documentation: explain behavior when type is a tuple

2015-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aaf8a25133ff by Terry Jan Reedy in branch '2.7':
Issue #25432: Explain isinstance behaviour when type is a tuple.
https://hg.python.org/cpython/rev/aaf8a25133ff

New changeset 8b1418e5dcc8 by Terry Jan Reedy in branch '3.4':
Issue #25432: Explain isinstance behaviour when type is a tuple.
https://hg.python.org/cpython/rev/8b1418e5dcc8

--
nosy: +python-dev

___
Python tracker 

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