[issue24164] Support pickling objects with __new__ with keyword arguments with protocol 2+

2015-11-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7adc1d24d05b by Victor Stinner in branch 'default':
Closes #25645: Fix a reference leak introduced by change bc5894a3a0e6 of the
https://hg.python.org/cpython/rev/7adc1d24d05b

--

___
Python tracker 

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



[issue24172] Errors in resource.getpagesize module documentation

2015-11-17 Thread John Runyon

John Runyon added the comment:

This is a duplicate of 20468, which has a patch submitted (over a year ago).

--
nosy: +jrunyon

___
Python tracker 

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



[issue20468] resource module documentation is incorrect

2015-11-17 Thread John Runyon

John Runyon added the comment:

*bump*.

This flat-out wrong documentation has already misled several people, and has 
had a proposed patch with no comments for over a year.

--
nosy: +jrunyon

___
Python tracker 

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



[issue25648] asyncio.coroutine fails if asyncio debug mode is enabled and wrapped function don't have "__name__" attribute

2015-11-17 Thread Vladimir Rutsky

New submission from Vladimir Rutsky:

In Python 3.4.3 with enabled asyncio debug a function is
wrapped using the following code in @asyncio.coroutine:

@functools.wraps(func)
def wrapper(*args, **kwds):
w = CoroWrapper(coro(*args, **kwds), func)
if w._source_traceback:
del w._source_traceback[-1]
w.__name__ = func.__name__
if hasattr(func, '__qualname__'):
w.__qualname__ = func.__qualname__
w.__doc__ = func.__doc__
return w

The unconditional access to "__name__" and "__doc__" attributes may fail in 
some circumstances.

As this case looks strange and unrealistic I met it in a real
application that used mocking in tests. The code there was something like the 
following:

def f():
return "f result"

mocked_f = Mock(wraps=f)
coro_func = asyncio.coroutine(mocked_f)
print(loop.run_until_complete(coro_func()))
mocked_f.assert_called_once_with() 

Here is complete example:
https://gist.github.com/rutsky/65cee7728135b05d49c3

This issue is fixed in 95964:957478e95b26 changeset during adding support of 
async/await syntax, so it is not reproduced in Python 3.5 or 3.4 head, but 
still reproducible in latest released version of Python 3.4 branch: 3.4.3.

So until 3.4.4 is released this issue still may be considered as not fixed.

--
components: asyncio
messages: 254800
nosy: gvanrossum, haypo, vrutsky, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.coroutine fails if asyncio debug mode is enabled and wrapped 
function don't have "__name__" attribute
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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-17 Thread STINNER Victor

STINNER Victor added the comment:

I don't know the physical disk type on Windows. Can you read and write from 
such "file" type? If no, I don't think that it makes sense to support it in 
io.FileIO. What do you think?

It looks like the file must be opened with specific options, otherwise it 
doesn't work. See this question on CreateFile():
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/fa2175fe-02f4-4adb-9cb9-5df3d1122cf6/readfile-works-when-handle-opened-with-drive-letterphysical-drive-symlink-but-not-with-device-path


io.FileIO() calls _Py_fstat() for two reasons:

1) raise an error if the path/file descriptor is a directory
2) get the block size

_Py_fstat() is implemented with two Windows calls: GetFileType() & 
GetFileInformationByHandle().

To solve this issue, we need to have a function telling that the path/file 
descriptor is a physical disk. In this case, we can skip both checks.

Documentation on Physical Drivers in CreateFile():
https://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx#physical_disks_and_volumes

--

___
Python tracker 

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



[issue25645] Reference leak in test_capi, on "import _pickle" in a subinterpreter

2015-11-17 Thread STINNER Victor

STINNER Victor added the comment:

> The patch LGTM. Thank you Victor.

Thanks for the review Serhiy.

--

___
Python tracker 

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



[issue25645] Reference leak in test_capi, on "import _pickle" in a subinterpreter

2015-11-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7adc1d24d05b by Victor Stinner in branch 'default':
Closes #25645: Fix a reference leak introduced by change bc5894a3a0e6 of the
https://hg.python.org/cpython/rev/7adc1d24d05b

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



[issue24256] threading.Timer is not a class

2015-11-17 Thread John Runyon

John Runyon added the comment:

New proposed patch.

I understand not wanting to document an "internal only name", except that in 
this case it rather needs to be documented. I would strongly prefer Angad's 
patch to mine because you do, at times, need to know the actual name of the 
class being used -- and the documentation should not force people to dig 
through the source code to find that.

--
Added file: http://bugs.python.org/file41062/timer.diff

___
Python tracker 

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



[issue25645] Reference leak in test_capi, on "import _pickle" in a subinterpreter

2015-11-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch LGTM. Thank you Victor.

--

___
Python tracker 

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



[issue25647] Return of asyncio.coroutine from asyncio.coroutine don't work in with enabled debug

2015-11-17 Thread Vladimir Rutsky

New submission from Vladimir Rutsky:

Return of @asyncio.coroutine-wrapped coroutine object from 
@asyncio.coroutine-wrapped coroutine fails if asyncio debug is enabled.

Consider following example:

@asyncio.coroutine
def outer_coro():
@asyncio.coroutine
def inner_coro():
return 1

return g()

result = loop.run_until_complete(outer_coro())

If debug is disabled result will be 1, if debug is enabled, result will be 
CoroWrapper object.

This issue is discussed on asyncio mailing list: 
https://groups.google.com/forum/?fromgroups#!topic/python-tulip/YFfFxftxxDc

Complete example to reproduce this problem is here: 
https://gist.github.com/rutsky/c72be2edeb1c8256d680

Attaching patch for Python 3.4 branch that fixes this issue and add test for 
this bug.

This issue is not reproduced in Python 3.5, because CoroWrapper is awaitable in 
Python 3.5 (and in Python 3.4 CoroWrapper is not future or generator).

--
components: asyncio
files: fix_return_of_coro_from_coro.diff
keywords: patch
messages: 254799
nosy: gvanrossum, haypo, vrutsky, yselivanov
priority: normal
severity: normal
status: open
title: Return of asyncio.coroutine from asyncio.coroutine don't work in with 
enabled debug
versions: Python 3.4
Added file: http://bugs.python.org/file41063/fix_return_of_coro_from_coro.diff

___
Python tracker 

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



[issue25647] Return of asyncio.coroutine from asyncio.coroutine doesn't work in with enabled debug

2015-11-17 Thread Vladimir Rutsky

Changes by Vladimir Rutsky :


--
title: Return of asyncio.coroutine from asyncio.coroutine don't work in with 
enabled debug -> Return of asyncio.coroutine from asyncio.coroutine doesn't 
work in with enabled debug

___
Python tracker 

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



[issue25629] Move set fill/used updates out of set_insert_clean()

2015-11-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue25629] Move set fill/used updates out of set_insert_clean()

2015-11-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 23d0cae3f8a1 by Raymond Hettinger in branch 'default':
Issue #25629: Move set fill/used updates out of inner loop
https://hg.python.org/cpython/rev/23d0cae3f8a1

--
nosy: +python-dev

___
Python tracker 

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



[issue20220] test_datetime, test_tarfile, test_strptime time zone failures

2015-11-17 Thread STINNER Victor

STINNER Victor added the comment:

> I also opened a glibc bug: 
> .

Wow, great! Thank you.

--

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-17 Thread Roman Kozhemiakin

Roman Kozhemiakin added the comment:

>I don't know the physical disk type on Windows. Can you read and write from 
>such "file" type?

Yes this "files" can be readed and writed (with restriction - size of the data 
must be a multiple of the sector size)

in python 3.4.3 open,read,write,seek - works fine (with raw usb disk)
for python 3.5 as workaround I replaced these functions to os.

>2) get the block size
st_blksize is not implemented under windows

--

___
Python tracker 

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



[issue23895] [PATCH] python socket module fails to build on Solaris when -zignore is in LDFLAGS

2015-11-17 Thread Andrew Stormont

Changes by Andrew Stormont :


--
title: python socket module fails to build on Solaris when -zignore is in 
LDFLAGS -> [PATCH] python socket module fails to build on Solaris when -zignore 
is in LDFLAGS

___
Python tracker 

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



[issue25646] Distutils and Windows SDK 7.0 / Windows SDK 7.1 / Visual C++ Build Tools 2015

2015-11-17 Thread Steve Dower

Steve Dower added the comment:

The tools for VS 2015 is a known issue. I let the team know before they 
released it but it was too late. There'll be an update soon that should work.

For Python 3.2 and earlier use http://aka.ms/vcpython27 and setuptools 6 or 
later.

The SDK 7.1 layout doesn't match what distutils expects, so it requires more 
changes than simple detection. The recommendation is to use the SDK command 
prompt and set DISTUTILS_USE_SDK=1 before building wheels. (There may be one 
more env var needed here, I'm on my phone and can't check.)

--

___
Python tracker 

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



[issue23895] python socket module fails to build on Solaris when -zignore is in LDFLAGS

2015-11-17 Thread Andrew Stormont

Andrew Stormont added the comment:

Bump.

--
status: open -> languishing

___
Python tracker 

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



[issue22555] Tracking issue for adjustments to binary/text boundary handling

2015-11-17 Thread Steve Dower

Steve Dower added the comment:

The thing about bogus assumptions is that Python should paper over those 
anyway. I can guarantee there's production code out there with the same 
assumptions.

How do we make this work? No idea in the context of the bytes/str filename 
convention differences.

--

___
Python tracker 

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



[issue25646] Distutils and Windows SDK 7.0 / Windows SDK 7.1 / Visual C++ Build Tools 2015

2015-11-17 Thread R. David Murray

Changes by R. David Murray :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions:  -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue25649] Come up with a good way to handle module aliasing

2015-11-17 Thread Brett Cannon

New submission from Brett Cannon:

If you look at things like https://github.com/kennethreitz/requests/issues/2870 
and https://pythonhosted.org/six/#module-six.moves you start to notice that 
users do on occasion have a need to alias module names. It might be worth 
thinking through what that might entail and provide a solution.

Historically it has been done with a meta path importer which catches the 
import for some old module name, imports the real name, and then sets 
sys.modules under the alternative name before returning that the import was 
successful. It's a little tricky to get right, though, since you essentially 
have to pause an import while another one is going on, make sure you wait to 
the last minute to do the sys.modules aliasing to make sure no object swap 
handled from underneath you. I also have not thought through the best way to do 
this with module specs., but maybe there is a better way. There's also making 
sure locking is handled properly.

The reason this might be useful to have in importlib is it would help 
facilitate module renamings. If you set it up so that it isn't hard to turn on 
with mappings of old name to new along with whether you want to raise an 
ImportWarning about the aliasing then others may find it useful.

--
components: Library (Lib)
messages: 254805
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Come up with a good way to handle module aliasing
type: enhancement
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



[issue25649] Come up with a good way to handle module aliasing

2015-11-17 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Another example is the six.moves module, though I haven't looked at its 
implementation approach.

--

___
Python tracker 

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



[issue25649] Come up with a good way to handle module aliasing

2015-11-17 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue25643] Python tokenizer rewriting

2015-11-17 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy: +yselivanov

___
Python tracker 

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



[issue25648] asyncio.coroutine fails if asyncio debug mode is enabled and wrapped function don't have "__name__" attribute

2015-11-17 Thread Yury Selivanov

Yury Selivanov added the comment:

> So until 3.4.4 is released this issue still may be considered as not fixed.

Since this issue is fixed in the repo, and will be shipped in the upcoming 
3.5.1 and 3.4.4, I'd suggest to close this issue -- there is nothing to be done 
here.

--

___
Python tracker 

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



[issue25647] Return of asyncio.coroutine from asyncio.coroutine doesn't work with enabled asyncio debug

2015-11-17 Thread Vladimir Rutsky

Changes by Vladimir Rutsky :


--
title: Return of asyncio.coroutine from asyncio.coroutine doesn't work in with 
enabled debug -> Return of asyncio.coroutine from asyncio.coroutine doesn't 
work with enabled asyncio debug

___
Python tracker 

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



[issue25646] Distutils and Windows SDK 7.0 / Windows SDK 7.1 / Visual C++ Build Tools 2015

2015-11-17 Thread JGoutin

JGoutin added the comment:

For SDK 7.1, with "DISTUTILS_USE_SDK=1" (And "MSSdk=1"), I still have the 
problem.

The error is on "include", "lib", "libpath", "path" environment variables which 
are not set by "vcvarsall.bat" (And are difficult to set manually). I looked on 
"msvc9compiler.py" file, I see that DISTUTILS_USE_SDK set the names for some 
compiler executables but not these variables.

A solution should be to call "SetEnv.cmd" in place of "vcvarsall.bat" if SDK is 
installed and if environment variables listed above are missing even after the 
call of "vcvarsall.bat" (Or if "vcvarsall.bat" is missing).
"SetEnv.cmd" properly set the environment and I successfully compiled files 
after launched it.

I can do this change and commit it. This will add fully automatic compatibility 
for SDK 6.1/7.0/7.1, so all possibles version for VC++2008 and 2010 (Is it also 
possible to add "vcbuildtools.bat" for VC++ Build Tools 2015, but you say it's 
already fixed for it.)

--

___
Python tracker 

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



[issue25643] Python tokenizer rewriting

2015-11-17 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue25612] nested try..excepts don't work correctly for generators

2015-11-17 Thread Yury Selivanov

Yury Selivanov added the comment:

Can someone work with me on fixing this issue?  I think it's important to ship 
3.5.1 with this resolved (and 3.4.4 FWIW).

--

___
Python tracker 

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



[issue25648] asyncio.coroutine fails if asyncio debug mode is enabled and wrapped function don't have "__name__" attribute

2015-11-17 Thread Guido van Rossum

Guido van Rossum added the comment:

Fixed in repo is good enough to close an issue.

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue25650] Mismatching documentation <=> behaviour for typing.Any

2015-11-17 Thread Emanuel Barry

New submission from Emanuel Barry:

The docstring for typing.Any specifically says "- Any object is an instance of 
Any."; in practice however it's not actually the case, as isinstance(x, Any) 
raises a TypeError.

AnyMeta makes this behaviour seem intentional, however the official 
documentation seems to be a bit vague on that one too -- 
https://docs.python.org/3/library/typing.html#the-any-type makes no mention of 
'isinstance', but just the next paragraph mirrors the docstring, in 'Any object 
is an instance of Any'.

I personally believe this is a behaviour error and the docs are correct, as 
that seems the most logical conclusion. Should this be fixed for 3.5.1?

--
components: Library (Lib)
messages: 254811
nosy: ebarry
priority: normal
severity: normal
status: open
title: Mismatching documentation <=> behaviour for typing.Any
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



[issue25612] nested try..excepts don't work correctly for generators

2015-11-17 Thread Guido van Rossum

Guido van Rossum added the comment:

You might have to ping python-dev. But in terms of priorities I think
it's not a blocker -- it's been broken for quite some time now, and
it's a fairly odd corner of the language.

--

___
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-11-17 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Should I develop a mock telnet server for the unittest ?

--

___
Python tracker 

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



[issue25612] nested try..excepts don't work correctly for generators

2015-11-17 Thread STINNER Victor

STINNER Victor added the comment:

> Can someone work with me on fixing this issue?  I think it's important to 
> ship 3.5.1 with this resolved (and 3.4.4 FWIW).

It don't consider this issue as a blocker for Python 3.5.1. This
release already contains a *lot* of bugfixes! It's important to get it
as soon as possible.

--

___
Python tracker 

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



[issue25612] nested try..excepts don't work correctly for generators

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

Thinking about the __context__ thing some more, I guess it might make sense for 
__context__ to be overwritten by the generator context. The same way it gets 
overwritten when you execute “raise” inside an exception handler.

--

___
Python tracker 

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



[issue14911] generator.throw() documentation inaccurate

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

I can’t really comment on the 2.7 version, because I’m not too familiar with 
Python 2 exceptions.

For Python 3, is there any reason to bless the None, tuple or non-exception 
cases as the exception “value” argument? IMO these just make things too 
complicated without any benefit. Changes I would make to the patch:

* Only mention that “value” can be omitted, or it can be an instance of the 
class specified by “type”. Drop mentioning the None option, and the single or 
tuple constructor argument options. It looks like the tuple option actually 
gets expanded to multiple constructor arguments?!
* Mention that if “value” is passed, its traceback could be lost
* Drop the example, unless someone can come up with a concise and realistic 
example
* Unify with definition for coroutines 

* Change the doc string(s) to match the argument names, but don’t bother 
copying the full definition text

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue20468] resource module documentation is incorrect

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

I committed the text removal for getpagesize().

For the getrusage() table, I wonder if it is good enough as it already is. 
Otherwise, it opens questions about the units for all the other fields, and 
which platforms they are supported on.

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



[issue20468] resource module documentation is incorrect

2015-11-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e8b06ac7c97 by Martin Panter in branch '3.4':
Issue #20468: Remove incorrect information about maxrss and page size
https://hg.python.org/cpython/rev/5e8b06ac7c97

New changeset 1579de0b72f6 by Martin Panter in branch '3.5':
Issue #20468: Merge getpagesize doc from 3.4 into 3.5
https://hg.python.org/cpython/rev/1579de0b72f6

New changeset 007dfc0ef1be by Martin Panter in branch 'default':
Issue #20468: Merge getpagesize doc from 3.5
https://hg.python.org/cpython/rev/007dfc0ef1be

New changeset 58d017d70563 by Martin Panter in branch '2.7':
Issue #20468: Remove incorrect information about maxrss and page size
https://hg.python.org/cpython/rev/58d017d70563

--
nosy: +python-dev

___
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-11-17 Thread Mouse

Mouse added the comment:

Status...?

--

___
Python tracker 

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



[issue25589] test_ascii_formatd fails on Mac when built with Intel compiler

2015-11-17 Thread R. David Murray

R. David Murray added the comment:

We've figured out that the difference is the optimization level.  Without 
--with-pydebug, I can reproduce the failure.

--

___
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-11-17 Thread R. David Murray

R. David Murray added the comment:

The existing tests seem to have at least some infrastructure that would apply 
here, so figuring out how to use/extend that is better than writing new code, 
I'd say.

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



[issue5784] raw deflate format and zlib module

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

Looking at the current zlib module source code, I confirmed that wbits is 
passed directly to the deflateInit2(windowBits) and inflateInit2(windowBits) 
parameters. So the following modes could also be added to the documentation for 
decompression:

* Zero: automatically determine size from zlib header
* 32 + logarithm: automatically accept either a zlib or gzip header

Also, the compressobj() doc string is out of date. It mentions 8–15 but none of 
the other options.

Paul: Perhaps it would be better to say “wbits” corresponds to the format of 
the stream, rather than mentioning just the window size as currently proposed. 
Then hopefully the reader would look to see what value is needed for the raw 
Deflate format.

--

___
Python tracker 

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



[issue25651] Confusing output for TestCase.subTest(0)

2015-11-17 Thread Ezio Melotti

New submission from Ezio Melotti:

When a single positional argument is passed to subTest(), if the argument is 
false, its value won't be displayed in the output -- () will appear 
instead:

>>> import unittest
>>> class NumbersTest(unittest.TestCase):
...   def test_odd(self):
... for i in range(4):
...   with self.subTest(i):  # single positional arg
... self.assertNotEqual(i%2, 0)
... 
>>> unittest.main(exit=False)
==
FAIL: test_odd (__main__.NumbersTest) ()
--
Traceback (most recent call last):
  File "", line 5, in test_odd
AssertionError: 0 == 0
==
FAIL: test_odd (__main__.NumbersTest) [2]
--
Traceback (most recent call last):
  File "", line 5, in test_odd
AssertionError: 0 == 0
--
Ran 1 test in 0.001s
FAILED (failures=2)

This is because subTest() accepts a positional "msg" arg, passes it to _SubTest 
(Lib/unittest/case.py:515), and then _SubTest checks using "if self._message:" 
(Lib/unittest/case.py:1400).

I think it would be better to check the message against a sentinel value 
instead.

--
components: Library (Lib)
keywords: easy
messages: 254827
nosy: ezio.melotti, michael.foord, pitrou, rbcollins
priority: normal
severity: normal
stage: test needed
status: open
title: Confusing output for TestCase.subTest(0)
type: behavior
versions: Python 3.4, 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



[issue18848] In unittest.TestResult .startTestRun() and .stopTestRun() methods don't work

2015-11-17 Thread Omar Diab

Omar Diab added the comment:

I found out about this while writing my own test runner, and investigated it in 
an answer to a StackOverflow question here: 
https://stackoverflow.com/questions/32920025/how-do-i-use-unittest-testresult/33770125#33770125

The startTestRun() method is supposed to be called at the beginning of a test 
run. That mostly works, but if you run a TestCase.run() method—or 
TestSuite.run(), because it just calls TestCase.run()—it will only call that 
method if you don't provide a TestResult instance. That means the lifecycle 
method is useless in those cases, because the default TestResult.startTestRun() 
method is a no-op.

This is how unittest.TestCase.run() starts:

def run(self, result=None):
orig_result = result
if result is None:
result = self.defaultTestResult()
startTestRun = getattr(result, 'startTestRun', None)
if startTestRun is not None:
startTestRun()
# ...

The branch for calling startTestRun() is inside the `if result is None` check, 
making it never get called with an implementation of startTestRun().

This is currently mitigatable by just calling startTestRun() manually. But the 
documentation makes it seem like this lifecycle method should be called 
automatically, when it is not.

--
nosy: +Omar Diab

___
Python tracker 

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



[issue25652] collections.UserString.__rmod__() raises NameError

2015-11-17 Thread Jonathan Goble

New submission from Jonathan Goble:

In an instance of collections.UserString, any call to the __rmod__() method 
will raise NameError, due to the undefined "args" name in the method.

--
components: Library (Lib)
messages: 254830
nosy: Jonathan Goble, rhettinger
priority: normal
severity: normal
status: open
title: collections.UserString.__rmod__() raises NameError
type: behavior
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



[issue25653] ctypes+callbacks+fork+selinux = crash

2015-11-17 Thread Armin Rigo

New submission from Armin Rigo:

Ctypes uses libffi's `ffi_closure_alloc()`, which has a bug that make existing 
applications obscurely crash in one situation: if we are running on SELinux, 
making use of callbacks, and forking.  This is because `ffi_closure_alloc()` 
will detect that it is running on SELinux and use an alternative way to 
allocate memory for the callbacks.

It does that because selinux won't let a process mmap() any anonymous 
read-write-execute memory (at least in some settings; but libffi always uses 
the workaround if selinux is detected).  The workaround is to create a 
temporary file and mmap() it twice (at randomly different addresses), once as a 
read-write mapping and once as a read-execute mapping.  However, the internal 
structure of libffi requires that this mapping be MAP_SHARED (we can't easily 
first build the memory content, then write it to the temporary file and mmap() 
that fixed content in executable memory).

The problem with this is that if the process forks, this memory is shared.  If 
one of the two processes then frees the callback, the memory becomes garbage in 
the other process.

The problem was reported a few times at various places already, but not in this 
bug tracker.  See:

https://sourceware.org/ml/libffi-discuss/2009/msg00320.html

https://bugzilla.redhat.com/show_bug.cgi?id=531233

https://bugzilla.redhat.com/show_bug.cgi?id=707944

I am adding this issue to Python's bug tracker because, while in theory a 
libffi issue, it seems that Python is one of the very few libffi users that 
actually frees callbacks in this way.  I don't have a solution for either 
libffi or ctypes, though.  My own recommendation would be to stop using 
``ffi_closure_alloc()`` and let the application either work (on selinux without 
deny_execmem) or cleanly trigger an error (on selinux with deny_execmem).

For reference, the issue was reported to CFFI's bug tracker about 
python-cryptography 1.0: it uses cffi's version of callbacks, whose 
implementation is close to ctypes', except not using ``ffi_closure_alloc()`` 
and so hitting the original selinux error instead of a crash.  The file 
https://bitbucket.org/cffi/cffi/raw/default/c/malloc_closure.h inside CFFI 
comes from an older version of ctypes which (by chance in this case) does not 
call ``ffi_closure_alloc()``.

--
components: ctypes
messages: 254831
nosy: arigo
priority: normal
severity: normal
status: open
title: ctypes+callbacks+fork+selinux = crash
type: crash

___
Python tracker 

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



[issue23200] Clarify max_length and flush() for zlib decompression

2015-11-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 106c49edbb12 by Martin Panter in branch '2.7':
Issue #23200: Document that max_length=0 is not supported
https://hg.python.org/cpython/rev/106c49edbb12

New changeset 660bdfaada64 by Martin Panter in branch '3.4':
Issue #23200: Document that max_length=0 is not supported
https://hg.python.org/cpython/rev/660bdfaada64

New changeset d64bb25cf797 by Martin Panter in branch '3.5':
Issue #23200: Merge zlib doc from 3.4 into 3.5
https://hg.python.org/cpython/rev/d64bb25cf797

New changeset cdd403dd82cb by Martin Panter in branch 'default':
Issue #23200: Merge zlib doc from 3.5
https://hg.python.org/cpython/rev/cdd403dd82cb

--
nosy: +python-dev

___
Python tracker 

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



[issue25594] enum instance attribute access possible

2015-11-17 Thread Ethan Furman

Ethan Furman added the comment:

Changed the wording slightly to indicate that looking up members on other 
members is a bad idea.

--
Added file: http://bugs.python.org/file41064/issue25594.stoneleaf.04.patch

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-17 Thread Justin Mayfield

Justin Mayfield added the comment:

Attached patch submission for stop flag proposal.  I assume you didn't mean a 
github PR since the dev docs seem to indicate that is for readonly usage.

This passes all the tests on my osx box but it should obviously be run by a lot 
more folks.

--
Added file: http://bugs.python.org/file41059/Issue25593_fix.patch

___
Python tracker 

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



[issue25645] Reference leak in test_capi, on "import _pickle" in a subinterpreter

2015-11-17 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file41061/test_leak.py

___
Python tracker 

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



[issue25646] Distutils and Windows SDK 7.0 / Windows SDK 7.1 / Visual C++ Build Tools 2015

2015-11-17 Thread JGoutin

New submission from JGoutin:

Hello,

This issue is related to Visual C++ standalone distributions (Without any 
Visual Studio version installed).

Distutils don't properly detect theses compilers. It try to work with 
"vcvarsall.bat" but this file : 
- is missing with Visual C++ Build Tools 2015.
- don't set correctly the environment with Windows SDK 7.0/7.1

I fixed this issue by modifying "vcvarsall.bat" for redirect to the goods files 
and set properly the environment. The procedure is detailed here : 
https://wiki.python.org/moin/WindowsCompilers

I have tested this issue with :
- Python 3.5 + Visual C++ Tools 2015
- Python 3.4 + Windows SDK 7.1
I have not tested yet (But it work exactly as SDK 7.1): 
- Python 2.7 + Windows SDK 7.0


I can eventually work to fix this directly on distutils (Or help to fix it).

--
components: Distutils
messages: 254788
nosy: JGoutin, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Distutils and Windows SDK 7.0 / Windows SDK 7.1 / Visual C++ Build Tools 
2015
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, 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



[issue25645] Reference leak in test_capi, on "import _pickle" in a subinterpreter

2015-11-17 Thread STINNER Victor

New submission from STINNER Victor:

"""
[Python-checkins] Daily reference leaks (97e2a6810f7f): sum=10

results for 97e2a6810f7f on branch "default"


test_asyncio leaked [0, 0, 3] memory blocks, sum=3
test_capi leaked [1, 1, 1] references, sum=3
test_functools leaked [0, 2, 2] memory blocks, sum=4


Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', 
'3:3:/home/psf-users/antoine/refleaks/reflogBLsY2a', '--timeout', '7200']
"""

It looks the leak comes from "import _pickle". The reference leak was 
introduced by the issue #24164 with the change bc5894a3a0e6. Attached patch 
should fix it.

To validate the patch, run: "./python -m test -R 3:3 test_capi", or "./python 
-m test -R 3:3 test_leak" with attached "test_leak.py".

@Serhiy: Since you wrote the change introduding the leak, could you please 
review my fix? Thanks.

--
files: _pickle_partial.patch
keywords: patch
messages: 254787
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Reference leak in test_capi, on "import _pickle" in a subinterpreter
type: resource usage
versions: Python 3.6
Added file: http://bugs.python.org/file41060/_pickle_partial.patch

___
Python tracker 

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



[issue25652] collections.UserString.__rmod__() raises NameError

2015-11-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Quite sorry for making some mistakes. unicodeobject does get a __radd__ method. 
It is added by addoperators though I cannot see it in PyNumberMethods. Now I 
think just fixing the typo is enough.

--
Added file: http://bugs.python.org/file41066/collections.UserString1

___
Python tracker 

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



[issue23200] Deprecate the zlib decompressor’s flush() method

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

See Issue 224981 (bug) and Issue 403373 (patch) about the Z_SYNC_FLUSH change 
(the numbers in the commit message are different and do not work).

I committed my doc change to 2.7 and 3.4+, which leaves the main problem of 
what to do about flush(). I propose deprecate-flush.patch for 3.6, which 
deprecates this method.

I ran the test suite with -Werror, so I hopefully got all the instances of 
flush() in the library.

--
components: +Library (Lib) -Documentation
title: Clarify max_length and flush() for zlib decompression -> Deprecate the 
zlib decompressor’s flush() method
versions: +Python 3.6 -Python 3.4
Added file: http://bugs.python.org/file41067/deprecate-flush.patch

___
Python tracker 

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



[issue24172] Errors in resource.getpagesize module documentation

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

The documentation already says to consult the getrusage(2) man page.

Regarding the getpagesize() API, Python’s implementation actually falls back to 
Posix’s sysconf(). Perhaps it should prefer sysconf() over getpagesize(), but 
that would be a separate issue.

Anyway I will commit the important half of the Issue 20468’s patch, so I think 
we can close this.

--
nosy: +martin.panter
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> resource module documentation is incorrect
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



[issue25612] nested try..excepts don't work correctly for generators

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

Regarding the second bug, did you consider that the exception thrown to the 
generator can already have __context__ set?

try:
try: raise ValueError("Context outside of generator")
except ValueError as ex: raise SubError() from ex
except SubError as ex:
coro.throw(ex)  # ex.__context__ is a ValueError

I guess either one context could trump the other, or we could to follow the 
chain of contexts and append the other chain at the end. Both these ideas seem 
a bit ugly 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



[issue20468] resource module documentation is incorrect

2015-11-17 Thread Martin Panter

Martin Panter added the comment:

Python’s getrusage() calls the C-level getrusage() function. Man pages for 
reference:

http://man7.org/linux/man-pages/man2/getrusage.2.html
https://www.freebsd.org/cgi/man.cgi?query=getrusage=2
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/getrusage.2.html

I find “kilobytes” ambiguous, since it probably means “kibibytes”, multiples of 
1024 bytes, rather than 1000 bytes. Maybe it would be best to just say the unit 
varies by platform, and let the user check the manuals themself.

I agree about dropping the text from getpagesize() 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



[issue25652] collections.UserString.__rmod__() raises NameError

2015-11-17 Thread Jonathan Goble

Jonathan Goble added the comment:

c06b2480766d appears to be the offending changeset.

--

___
Python tracker 

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



[issue25652] collections.UserString.__rmod__() raises NameError

2015-11-17 Thread Xiang Zhang

Xiang Zhang added the comment:

It seems this is a typo. The args should be self.data. And since unicodeobject 
doesn't support __rmod__, at least I think we should str(format) or remove 
__rmod__ totally. I attach a patch.

--
nosy: +xiang.zhang
Added file: http://bugs.python.org/file41065/collections.UserString

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2015-11-17 Thread Martin Panter

New submission from Martin Panter:

Running the test suite with -Werror enabled causes test_multiprocessing_spawn 
to print out lots of unhandled errors from the garbage collector, and one of 
these causes a test failure. It looks like there are lots of files that should 
be explicitly closed rather than leaving them for the garbage collector.

Also, one error occurred _after_ the test command had exiting. That can’t be a 
good thing, though I have never used the multiprocessing module so maybe this 
is unavoidable.

$ ./python -Werror -m unittest -v test.test_multiprocessing_spawn
. . .
==
FAIL: test_sys_exit 
(test.test_multiprocessing_spawn.WithProcessesTestSubclassingProcess)
--
Traceback (most recent call last):
  File 
"/media/disk/home/proj/python/cpython/Lib/test/_test_multiprocessing.py", line 
483, in test_sys_exit
self.assertEqual(f.read().rstrip(), str(reason))
AssertionError: "[1, 2, 3]\nException ignored in: <_io.Fi[136 chars]-8'>" != 
'[1, 2, 3]'
- [1, 2, 3]
?  -
+ [1, 2, 3]- Exception ignored in: <_io.FileIO name='/dev/null' mode='rb' 
closefd=True>
- ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='r' 
encoding='UTF-8'>

--
Ran 265 tests in 151.904s

FAILED (failures=1, skipped=15)
[Exit 1]
$ Exception ignored in: <_io.FileIO name='/dev/null' mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='r' 
encoding='UTF-8'>

--
components: Tests
messages: 254834
nosy: martin.panter
priority: normal
severity: normal
status: open
title: test_multiprocessing_spawn ResourceWarning with -Werror
type: behavior
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