[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread INADA Naoki

INADA Naoki added the comment:

I think it's false positive of ASAN.

We have dynamically sized block.
https://github.com/python/cpython/blob/3b0f620c1a2a21272a9e2aeca6ca1d1ac10f8162/Objects/dict-common.h#L49-L69

dictobject.c:547 calls memcpy to fill the block and head pointer
is defined as `int8_t [8]`.
ASAN doesn't know this is overallocated memory block.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2017-08-10 Thread Hongxu Jia

New submission from Hongxu Jia:

To build python for embedded Linux systems,
(http://www.yoctoproject.org/docs/2.3.1/yocto-project-qs/yocto-project-qs.html)
The 32-bit python's multiprocessing.BoundedSemaphore could not work.

1. Prerequisite
- Build 32bit python on 64bit host, add '-m32' to gcc

- Cross compling on linux platform, not have `-pthread'
  In configure.ac, ac_cv_pthread=no while cross compiling
  ...
  2001 AC_MSG_CHECKING(whether $CC accepts -pthread)
  2002 AC_CACHE_VAL(ac_cv_pthread,
  2003 [ac_save_cc="$CC"
  2004 CC="$CC -pthread"
  2005 AC_RUN_IFELSE([AC_LANG_SOURCE([[
  [snip]
  2018 ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
  ...

  — Macro: AC_RUN_IFELSE (input, [action-if-true], [action-if-false], 
[action-if-cross-compiling])

2. Reproduce with simplifying the prerequisite

$ git clone https://github.com/python/cpython.git; cd ./cpython

$ ac_cv_pthread=no CC="gcc -m32" ./configure

$ make -j 10

$ ./python -c "import multiprocessing; pool_sema = 
multiprocessing.BoundedSemaphore(value=1); pool_sema.acquire(); 
pool_sema.release()"
Traceback (most recent call last):
  File "", line 1, in 
ValueError: semaphore or lock released too many times

And the issue also caused invoking put of 'multiprocessing.Queue' hung.
$ ./python -c "import multiprocessing; queue_instance = 
multiprocessing.Queue(); queue_instance.put(('install'))"

--
components: Library (Lib)
messages: 300052
nosy: hongxu
priority: normal
severity: normal
status: open
title: multiprocessing.BoundedSemaphore of 32-bit python could not work while 
cross compiling on linux platform
type: crash
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2017-08-10 Thread Hongxu Jia

Hongxu Jia added the comment:

3. Analysis
1) The multiprocessing invokes named semaphore in C library
   (sem_open/sem_post/sem_getvalue/sem_unlink in
   ./Modules/_multiprocessing/semaphore.c)

2) The glibc defines two different sem_getvalue since the following commit.
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/sem_getvalue.c;h=1432cc795ece84d5bf31c7e5cafe01cc1a09d98d;hb=042e1521c794a945edc43b5bfa7e69ad70420524

The `__new_sem_getvalue' is the sem_getvalue@@GLIBC_2.1
which work with named semaphore `sem_open'

The `__old_sem_getvalue' is the old version sem_getvalue@GLIBC_2.0
which work with unamed semaphore `sem_init'

In 32-bit C library, it provides both of them.
$ nm -g /lib/i386-linux-gnu/libpthread-2.23.so
df30 T sem_getvalue@GLIBC_2.0
df10 T sem_getvalue@@GLIBC_2.1

3) In multiprocessing, it invokes sem_open, so sem_getvalue@@GLIBC_2.1
is supposed.

If `-pthread' or `-lpthread' not passed to gcc, the compiled
_multiprocessing dynamic library could not explicitly linked to
sem_getvalue@@GLIBC_2.1
$ nm -g 
./build/lib.linux-x86_64-3.7/_multiprocessing.cpython-37m-i386-linux-gnu.so
 U sem_getvalue
 U sem_open

If `-pthread' or `-lpthread' passed to gcc:
$ nm -g 
./build/lib.linux-x86_64-3.7/_multiprocessing.cpython-37m-i386-linux-gnu.so
 U sem_getvalue@@GLIBC_2.1
 U sem_open@@GLIBC_2.1.1

4) On 32-bit OS, the multiprocessing was incorrectly linked to
sem_getvalue@GLIBC_2.0 which caused the issue.

--

___
Python tracker 

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



[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2017-08-10 Thread Hongxu Jia

Hongxu Jia added the comment:

4. Solution

For cross compiling, there is no `-pthread', so we should explicitly add
`-lpthread' to build multiprocessing.

Peterson tried to do it in the following commit:
...
commit e711cafab13efc9c1fe6c5cd75826401445eb585
Author: Benjamin Peterson 
Date:   Wed Jun 11 16:44:04 2008 +

Merged revisions 64104,64117 via svnmerge from
svn+ssh://python...@svn.python.org/python/trunk
...
git show e711cafab13efc9c1fe6c5cd75826401445eb585 -- setup.py

--- a/setup.py
+++ b/setup.py
@@ -1110,6 +1110,56 @@ class PyBuildExt(build_ext):
 
 # _fileio -- supposedly cross platform
 exts.append(Extension('_fileio', ['_fileio.c']))
+# Richard Oudkerk's multiprocessing module
+if platform == 'win32': # Windows
+macros = dict()
+libraries = ['ws2_32']
+
+elif platform == 'darwin':  # Mac OSX
+macros = dict(
+HAVE_SEM_OPEN=1,
+HAVE_SEM_TIMEDWAIT=0,
+HAVE_FD_TRANSFER=1,
+HAVE_BROKEN_SEM_GETVALUE=1
+)
+libraries = []
+
+elif platform == 'cygwin':  # Cygwin
+macros = dict(
+HAVE_SEM_OPEN=1,
+HAVE_SEM_TIMEDWAIT=1,
+HAVE_FD_TRANSFER=0,
+HAVE_BROKEN_SEM_UNLINK=1
+)
+libraries = []
+else:   # Linux and other unices
+macros = dict(
+HAVE_SEM_OPEN=1,
+HAVE_SEM_TIMEDWAIT=1,
+HAVE_FD_TRANSFER=1
+)
+libraries = ['rt']
+
+if platform == 'win32':
+multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
+ '_multiprocessing/semaphore.c',
+ '_multiprocessing/pipe_connection.c',
+ '_multiprocessing/socket_connection.c',
+ '_multiprocessing/win32_functions.c'
+   ]
+
+else:
+multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
+ '_multiprocessing/socket_connection.c'
+   ]
+
+if macros.get('HAVE_SEM_OPEN', False):
+multiprocessing_srcs.append('_multiprocessing/semaphore.c')
+
+exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
+ define_macros=list(macros.items()),
+ include_dirs=["Modules/_multiprocessing"]))
+# End multiprocessing

It defined variable `libraries' and assigned it according to
host_platform, but forgot to pass it to Extension.

So we should correct it, and add `-lpthread' for linux.

--

___
Python tracker 

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



[issue31172] Py_Main() is totally broken on Visual Studio 2017

2017-08-10 Thread Patrick Rutkowski

New submission from Patrick Rutkowski:

Install Visual Studio 2017

Download and unpack Python-3.6.2.tgz

Open a Visual Studio command prompt
Browse to Python-3.6.2\PCBuild
Run build.bat -p x64 -c Release
Run build.bat -p x64 -c Debug
Add the PCbuild\amd64 directory to your PATH

Create a new Visual Studio Win32 GUI project called mypythonw

Copy-paste the source code of Python-3.6.2\PCBuild\WinMain.c into your mypthonw 
project.

Add Python-3.6.2\Include and Python-3.6.2\PC to mypythonw's include path.

Add Python-3.6.2\PCbuild\amd64 to mypythonw's library search path

Build mypthonw

Run these two commands:

pythonw -c "import ctypes; ctypes.windll.user32.MessageBoxW(0, 'Hello World!', 
'Hello', 0)

mypythonw -c "import ctypes; ctypes.windll.user32.MessageBoxW(0, 'Hello 
World!', 'Hello', 0)

The first will show a message box, while the second will show nothing. You 
won't get an error message or a debugger from mypythonw.exe. It'll just 
silently do nothing.

There must be something in the configuration of pythonw.vcxproj that is 
necessary for Python embedding to work, and which makes it work in pythonw but 
fail in mypythonw. The two projects are executing the exact same C code, but 
one works and the other doesn't. What's going on here?

--
messages: 300055
nosy: rutski
priority: normal
severity: normal
status: open
title: Py_Main() is totally broken on Visual Studio 2017

___
Python tracker 

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



[issue31159] Doc: Language switch can't switch on specific cases

2017-08-10 Thread Julien Palard

Julien Palard added the comment:

Now works in 3.7, needs backports to 3.6 and 2.7.

--

___
Python tracker 

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



[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2017-08-10 Thread Hongxu Jia

Changes by Hongxu Jia :


--
pull_requests: +3087

___
Python tracker 

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



[issue31172] Py_Main() is totally broken on Visual Studio 2017

2017-08-10 Thread Patrick Rutkowski

Patrick Rutkowski added the comment:

Just for kicks I tried the same Py_Main() code from a Win32 console application 
(instead of from a GUI application). The C code this time was

#include 

int wmain(int argc, wchar_t** argv) {
return Py_Main(argc, argv);
}

The resulting error message when trying to run the program is now

===
> mypythoncmd.exe -c "import ctypes; ctypes.windll.user32.MessageBoxW(0, 'Hello 
> World!', 'Hello', 0)"

Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x09f0 (most recent call first):
OUTPUT ENDS HERE
===

--
assignee:  -> christian.heimes
components: +SSL
nosy: +christian.heimes

___
Python tracker 

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



[issue31172] Py_Main() is totally broken on Visual Studio 2017

2017-08-10 Thread Christian Heimes

Changes by Christian Heimes :


--
assignee: christian.heimes -> 
components: +Windows -SSL
nosy: +paul.moore, steve.dower, tim.golden, zach.ware -christian.heimes

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread geeknik

geeknik added the comment:

So if I leave UBSan and ASan out of the equation and compile with gcc and run 
this script:

Program received signal SIGSEGV, Segmentation fault.
update_refs (containers=) at Modules/gcmodule.c:353
353 _PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
(gdb) bt
#0  update_refs (containers=) at Modules/gcmodule.c:353
#1  collect (generation=generation@entry=2,
n_collected=n_collected@entry=0x7fffe2f8,
n_uncollectable=n_uncollectable@entry=0x7fffe300,
nofail=nofail@entry=0) at Modules/gcmodule.c:962
#2  0x555d5365 in collect_with_callback (generation=2)
at Modules/gcmodule.c:1135
#3  PyGC_Collect () at Modules/gcmodule.c:1622
#4  _PyGC_CollectIfEnabled () at Modules/gcmodule.c:1635
#5  0x555b8e28 in Py_FinalizeEx () at Python/pylifecycle.c:978
#6  0x555b9225 in Py_FinalizeEx () at Python/pylifecycle.c:1119
#7  0x555d2ed2 in Py_Main (argc=, argv=)
at Modules/main.c:921
#8  0x555aa1cb in main (argc=2, argv=)
at ./Programs/python.c:102
(gdb) list
348 update_refs(PyGC_Head *containers)
349 {
350 PyGC_Head *gc = containers->gc.gc_next;
351 for (; gc != containers; gc = gc->gc.gc_next) {
352 assert(_PyGCHead_REFS(gc) == GC_REACHABLE);
353 _PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc)));
354 /* Python's cyclic gc should never see an incoming refcount
355  * of 0:  if something decref'ed to 0, it should have been
356  * deallocated immediately at that time.
357  * Possible cause (if the assert triggers):  a tp_dealloc

Valgrind shows a null deref as well after some invalid reads and conditional 
jumps. I've attached the log, it's a bit verbose.

--
Added file: http://bugs.python.org/file47071/31166.txt

___
Python tracker 

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



[issue31148] Can we get an MSI installer for something past 3.4.4?

2017-08-10 Thread D Gentry

D Gentry added the comment:

Ok, it sounds like as good a solution as I can expect.

No, I don't have a corporate build but I think my registry developed issues
some time in the past and windows locked it down to prevent exe from
installing.

It's been a while but that is the only thing I can come up with that would
be why it won't work.

Your exe isn't the only one that gives me issues but its usually a false
positive error with other installs and everything works as expected.

I have tried every suggestion I have found online and nothing seems to
improve the issue.

If the problem is the registry issue that I suspect, then nothing short of
rebuilding the entire system from initial install would solve the problem.

I have communicated with Microsoft, who's answer was to upgrade to Windows
10.

I have two systems with python installed, both with windows 7 x64, the
older system won't install without an MSI where as the new one would.

The closest thing I can figure is there is some permission handling that is
done differently via MSI vs executable installs and this is causing the
issue, as all the documentation online seems to agree that it is a
permissions related error.

I can't fix my system if the problem that I suspect is the culprit so my
only option is to build the MSI of your installer.

It definitely seems like that will be more successful than continuing to be
directed and redirected to perform the same tasks that have already been
completed to no avail.

>From what I have been reading online, its simple enough with Visual Studio
as long as you have access to the source code.

Thanks for enlightening me to the most of your abilities.

It seems pretty clear that I on my own on this one.

On Wed, Aug 9, 2017 at 6:10 AM, Paul Moore  wrote:

>
> Paul Moore added the comment:
>
> To be clear, Steve *is* our main Windows developer, and specifically the
> person who developed the Windows installers we now use. They work perfectly
> for many people, including myself, so there certainly isn't a general issue
> with them. I myself routinely install Python with the new installers on
> Windows 7 x64 systems, so it's definitely something specific to your system.
>
> Is your PC running a "corporate" build that might include security
> restrictions or other permission limitations that might be affecting the
> behaviour of the installer?
>
> As a workaround, Python is installable using nuget, from
> https://www.nuget.org/packages/python. I don't know much myself about
> nuget, but basically "nuget install python" will create a local copy of
> Python in the current directory that you can use without needing to be
> installed.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue31172] Py_Main() is totally broken on Visual Studio 2017

2017-08-10 Thread Patrick Rutkowski

Patrick Rutkowski added the comment:

I removed my custom built Python and installed the one provided by the 
python-3.6.2-amd64.exe installer instead.

The Win32 Command Line application now works, and shows the message box. The 
Win32 GUI Application still fails to work, the output is just nothing. As 
expected, pythonw works as always, it shows the popup.

--

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread INADA Naoki

INADA Naoki added the comment:

As Benjamin commented, this is caused by mutating internal dict.

PyType_Lookup() use "method cache", based on "tp_version_tag" in the type 
object.
When you modify internal dict directly, namespace is changed without
invalidating tp_version_tag.
So cached pointer is used, and it's already deallocated.

I don't know we should fix it or not.
I don't have any idea fix this without any performance penalty.

--

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

> I don't know we should fix it or not. I don't have any idea fix this without 
> any performance penalty.

The PEP 509 (dict version) might help if we want to fix this bug.

--
nosy: +haypo

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread INADA Naoki

INADA Naoki added the comment:

But we should check dicts of all parents.
It will has significant penalty, especially for classes having long mro 
(inheriting metaclass from typing module cause long mro).

--

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

Another solution is to replace class dict with a special type which invalidates 
the type cache on dict[key]=value.

--

___
Python tracker 

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



[issue31166] null pointer deref and segfault in _PyObject_Alloc (obmalloc.c:1258)

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

"But we should check dicts of all parents. It will has significant penalty, 
especially for classes having long mro (inheriting metaclass from typing module 
cause long mro)."

Oh right. That would defeat the whole purpose of the cache.

Maybe we should not fix the bug. You are not supposed to access the hidden 
dictionary :-)

--

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

New submission from STINNER Victor:

The test_child_terminated_in_stopped_state() test creates a child process which 
calls ptrace(PTRACE_ME, 0, 0) and then crashs using SIGSEGV. The problem is 
that even if we read the exit status using os.waitpid() through subprocess, the 
process remains alive in the "t (tracing stop)" state.

I would prefer to not use ptrace() is an unit test since this API is very 
low-level and it's hard to use it correctly.

I suggest to either remove the functional test, or to rewrite it as an unit 
test using mocks to test bpo-29335 without ptrace().

haypo@selma$ ./python -m test -m test_child_terminated_in_stopped_state -F 
test_subprocess
Run tests sequentially
0:00:00 load avg: 0.95 [  1] test_subprocess
0:00:00 load avg: 0.95 [  2] test_subprocess
0:00:01 load avg: 0.96 [  3] test_subprocess
0:00:01 load avg: 0.96 [  4] test_subprocess
0:00:02 load avg: 0.96 [  5] test_subprocess
0:00:03 load avg: 0.96 [  6] test_subprocess
0:00:03 load avg: 0.96 [  7] test_subprocess
0:00:04 load avg: 0.96 [  8] test_subprocess
0:00:05 load avg: 0.96 [  9] test_subprocess
0:00:05 load avg: 0.96 [ 10] test_subprocess
^Z
[1]+  Stoppé ./python -m test -m 
test_child_terminated_in_stopped_state -F test_subprocess

haypo@selma$ ps
  PID TTY  TIME CMD
30359 pts/000:00:00 bash
31882 pts/000:00:00 python
31885 pts/000:00:00 python
31888 pts/000:00:00 python
31892 pts/000:00:00 python
31895 pts/000:00:00 python
31898 pts/000:00:00 python
31901 pts/000:00:00 python
31904 pts/000:00:00 python
31907 pts/000:00:00 python
31910 pts/000:00:00 python
31912 pts/000:00:00 python
31920 pts/000:00:00 ps

haypo@selma$ grep Stat /proc/31885/status
State:  t (tracing stop)

--
messages: 300066
nosy: haypo
priority: normal
severity: normal
status: open
title: test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie 
process

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
components: +Tests
versions: +Python 3.7

___
Python tracker 

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



[issue31158] test_pty: test_basic() fails randomly on Travis CI

2017-08-10 Thread Cornelius Diekmann

Cornelius Diekmann added the comment:

I observed the same issue, but the problem occurs mainly when reading data. In 
my proposed patch in issue29070, I use the existing pty._writen() to make sure 
all data is written. As Martin mentioned, reading is a problem. My patch 
proposes _os_timeout_read(), _os_readline(), _os_read_exactly(), 
_os_read_exhaust_exactly() to give fine-grained, deterministic control. Cheeky 
advertisement: Anybody cares to review issue29070 or cherry pick the 
pty._writen() and _os_read* parts? :)

--

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3090

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

https://github.com/python/cpython/pull/3055 removes the functional test and 
replaces it with an unit test which mocks os.waitpid() using a new 
_testcapi.W_STOPCODE() function to test the WIFSTOPPED() path.

The functional test created a core dump, but it's now fixed using 
SuppressCrashReport. It leaks a zombie process in a special state, the process 
is traced and cannot be killed. I tried to wait for the process a second time, 
but it's not enough to "close" it. I guess that we would have to write a little 
debugger to attach the process in the parent process. IMHO it's overcomplicated 
just to check that subprocess calls WIFSTOPPED().

--

___
Python tracker 

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



[issue31142] python shell crashed while input quotes in print()

2017-08-10 Thread py78py90py

py78py90py added the comment:

I downloaded python from www.python.org. And I think I have tcl/tk installed.

Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http://www.python.org/download/mac/tcltk/ for current information.

I am trying to use the recommended tcltk version.

--

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

I chose to only add W_STOPCODE() to _testcapi rather than the os module, 
because I don't want to have to document this function. I don't think that 
anyone needs such function, usually we only need to consume process statuses, 
not to produce them. The only use case is to write an unit test.

This issue is part of bpo-31160 which ensures that unit tests don't leak child 
processes. This issue is part of my large project of reducing the fail rate on 
CIs (Travis CI, AppVeyor, buildbots):
https://haypo.github.io/python-buildbots-2017q2.html

I will now merge my PR 3055 to be able to unblock my work on CIs. But I will 
wait for feedback from Gregory before backporting this fix to 2.7 and 3.6.

--
nosy: +gregory.p.smith
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 7b7c6dcfff6a35333988a3c74c895ed19dff2e09 by Victor Stinner in 
branch 'master':
bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055)
https://github.com/python/cpython/commit/7b7c6dcfff6a35333988a3c74c895ed19dff2e09


--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

bpo-31173 fixed a leaked child process in test_subprocess.

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3091

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 6c8c2943d996b59a48d331f61f22cbe72933910e by Victor Stinner in 
branch 'master':
bpo-31160: test_tempfile: Fix reap_children() warning (#3056)
https://github.com/python/cpython/commit/6c8c2943d996b59a48d331f61f22cbe72933910e


--

___
Python tracker 

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



[issue31151] test_socketserver: Warning -- reap_children() reaped child process

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3092

___
Python tracker 

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



[issue31151] test_socketserver: Warning -- reap_children() reaped child process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

The problem is that socketserver.ForkinMixin doesn't wait until all children 
completes. It's only calls os.waitpid() in non-blocking module (using 
os.WNOHANG) after each loop iteration. If a child process completes after the 
last call to ForkingMixIn.collect_children(), the server leaks zombie processes.

The server must wait until all children completes. Attached PR implements that.

The bug was be reproduced with the attached forkingmixin_sleep.patch.

haypo@selma$ ./python -m test -v -u all test_socketserver --fail-env-changed -m 
'*Fork*'
(...)
Warning -- reap_children() reaped child process 17093
Warning -- reap_children() reaped child process 17094
(...)

--
keywords: +patch
Added file: http://bugs.python.org/file47072/forkingmixin_sleep.patch

___
Python tracker 

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



[issue31174] test_tools leaks randomly references on x86 Gentoo Refleaks 3.x

2017-08-10 Thread STINNER Victor

New submission from STINNER Victor:

The "x86 Gentoo Refleaks 3.x" buildbot runs tests using -u-cpu to disable the 
cpu resource. The problem is that DirectoryTestCase.test_files() of 
Lib/test/test_tools/test_unparse.py uses random:

# Test limited subset of files unless the 'cpu' resource is specified.
if not test.support.is_resource_enabled("cpu"):
names = random.sample(names, 10)

So when we run the same test 7 times, each run uses different data.

I see different options:

* Reseed random using the same seed in dash_R() of regrtest
* Always test all data in test_unparse.py: all files, or select a specific set 
of interesting files

The random issue is more generic than just test_unparse.py, and so it would be 
interesting to explore this path. Maybe the random issue explains why some 
other tests fail randomly.

libregrtest always seeds the random RNG using a seed displayed on the standard 
output. We should either reuse this seed, or create a new unique seed for each 
test file, and display it (to be able to reproduce tests).

Reseed random before running each test file can also helps to make tests more 
reproductible

--

http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.x/builds/52/steps/test/logs/stdio

test_tools leaked [1, 4, 2] memory blocks, sum=7
(...)
Re-running test 'test_tools' in verbose mode
(...)
test_tools leaked [1, 2, 2] memory blocks, sum=5
(...)
1 test failed again:
test_tools

--
components: Tests
messages: 300075
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_tools leaks randomly references on x86 Gentoo Refleaks 3.x
versions: Python 3.7

___
Python tracker 

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



[issue31174] test_tools leaks randomly references on x86 Gentoo Refleaks 3.x

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3093

___
Python tracker 

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



[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-10 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I'm not sure whether this is a bug or a feature.

In the examples you show, we have *both* an IndentationError/TabError and 
missing parentheses around print. So I'm almost inclined to say that this is 
right:

- you get an IndentationError (or TabError);

- and the error message *also* tells you that print is missing parens.

Two errors for the price of one!

I'm not sure that I would have designed it this way from scratch, but given 
that it already exists I'm not sure that it should be "fixed".

In any case, since the error message itself is not part of the public API, I 
don't think there's any problem in changing it in a bug-fix release. So *if* we 
change this, we can change it in 3.6.

--
components: +Interpreter Core
nosy: +steven.daprano
type:  -> behavior
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

An example on 2.7.13:

Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/process.py", line 258, 
in _bootstrap
self.run()
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/process.py", line 114, 
in run
self._target(*self._args, **self._kwargs)
  File "/home/travis/build/drallensmith/neat-python/tests/test_distributed.py", 
line 412, in run_secondary
de.start(secondary_wait=3, exit_on_stop=True)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
414, in start
self._secondary_loop(reconnect_max_time=reconnect_max_time)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
616, in _secondary_loop
self.outqueue.put(res)
  File "", line 2, in put
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/managers.py", line 774, 
in _callmethod
raise convert_to_error(kind, result)
AssertionError
Process Child evaluation process (multiple workers):
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/process.py", line 258, 
in _bootstrap
self.run()
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/process.py", line 114, 
in run
self._target(*self._args, **self._kwargs)
  File "/home/travis/build/drallensmith/neat-python/tests/test_distributed.py", 
line 412, in run_secondary
de.start(secondary_wait=3, exit_on_stop=True)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
414, in start
self._secondary_loop(reconnect_max_time=reconnect_max_time)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
616, in _secondary_loop
self.outqueue.put(res)
  File "", line 2, in put
  File "/opt/python/2.7.9/lib/python2.7/multiprocessing/managers.py", line 774, 
in _callmethod
raise convert_to_error(kind, result)
AssertionError

--

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

Correction - 2.7.9 - Travis seems to be a bit behind. Here's one from 3.6.2:

Traceback (most recent call last):
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/process.py", line 249, 
in _bootstrap
self.run()
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/process.py", line 93, 
in run
self._target(*self._args, **self._kwargs)
  File "/home/travis/build/drallensmith/neat-python/tests/test_distributed.py", 
line 412, in run_secondary
de.start(secondary_wait=3, exit_on_stop=True)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
414, in start
self._secondary_loop(reconnect_max_time=reconnect_max_time)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
616, in _secondary_loop
self.outqueue.put(res)
  File "", line 2, in put
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/managers.py", line 772, 
in _callmethod
raise convert_to_error(kind, result)
AssertionError
Process Child evaluation process (multiple workers):
Traceback (most recent call last):
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/process.py", line 249, 
in _bootstrap
self.run()
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/process.py", line 93, 
in run
self._target(*self._args, **self._kwargs)
  File "/home/travis/build/drallensmith/neat-python/tests/test_distributed.py", 
line 412, in run_secondary
de.start(secondary_wait=3, exit_on_stop=True)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
414, in start
self._secondary_loop(reconnect_max_time=reconnect_max_time)
  File "/home/travis/build/drallensmith/neat-python/neat/distributed.py", line 
616, in _secondary_loop
self.outqueue.put(res)
  File "", line 2, in put
  File "/opt/python/3.6.2/lib/python3.6/multiprocessing/managers.py", line 772, 
in _callmethod
raise convert_to_error(kind, result)
AssertionError

--

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

The section in question is:

def convert_to_error(kind, result):
if kind == '#ERROR':
return result
elif kind == '#TRACEBACK':
assert type(result) is str
return  RemoteError(result)
elif kind == '#UNSERIALIZABLE':
assert type(result) is str
return RemoteError('Unserializable message: %s\n' % result)
else:
return ValueError('Unrecognized message type')

--

___
Python tracker 

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



[issue31175] Exception while extracting file from ZIP with non-matching file name in central directory

2017-08-10 Thread Tarmo Randel

New submission from Tarmo Randel:

The problem: miscreants are modifying ZIP file header parts so, that Python 
based automated analysis tools are unable to process the contents of the ZIP 
file but intended clients are able to open the file and extract the possibly 
malicious contents.

Github pull request contains patch addressing the issue so that developer can 
make conscious decision to allow extraction process to complete. Quite 
important feature for security researchers.

--
components: Library (Lib)
files: ZIP_filename_confusion.pdf
messages: 300080
nosy: zyxtarmo
priority: normal
pull_requests: 3094
severity: normal
status: open
title: Exception while extracting file from ZIP with non-matching file name in 
central directory
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file47073/ZIP_filename_confusion.pdf

___
Python tracker 

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



[issue31175] Exception while extracting file from ZIP with non-matching file name in central directory

2017-08-10 Thread Tarmo Randel

Tarmo Randel added the comment:

Proposed patch

--
keywords: +patch
Added file: http://bugs.python.org/file47074/zipfile.patch

___
Python tracker 

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



[issue31148] Can we get an MSI installer for something past 3.4.4?

2017-08-10 Thread Steve Dower

Steve Dower added the comment:

Okay, if that's the way you want to go. Be aware that the old MSI code is gone 
though, so rebuilding it will not be trivial. Though if you do, there are a few 
people who would find it more convenient, so you may be able to enlist help 
maintaining it (we didn't get any offers of help, just requests for free work, 
so you may not get it either...)

If you're having trouble with a range of installers, there's a process you can 
run to reset your security policy, which is what I'd suggest doing. I'd have to 
find the details for you, but it basically resets permissions on everything. 
Doesn't delete any files, but may help with this problem. Let me know if you'd 
like me to find the details (requires Windows Pro IIRC, at least pre-Win 10).

--
resolution:  -> works for me
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



[issue31151] test_socketserver: Warning -- reap_children() reaped child process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset aa8ec34ad52bb3b274ce91169e1bc4a598655049 by Victor Stinner in 
branch 'master':
bpo-31151: Add socketserver.ForkingMixIn.server_close() (#3057)
https://github.com/python/cpython/commit/aa8ec34ad52bb3b274ce91169e1bc4a598655049


--

___
Python tracker 

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



[issue31176] Is a UDP transport also a ReadTransport/WriteTransport?

2017-08-10 Thread twisteroid ambassador

New submission from twisteroid ambassador:

In docs / Library Reference / asyncio / Transports and Protocols, it is 
mentioned that "asyncio currently implements transports for TCP, UDP, SSL, and 
subprocess pipes. The methods available on a transport depend on the 
transport’s kind." It also lists methods available on a BaseTransport, 
ReadTransport, WriteTransport, DatagramTransport and BaseSubprocessTransport.

However, the docs does not explain which transports have methods from which 
base classes, or in other words which base classes each concrete transport 
class inherits from. And this may not be obvious: for example, a UDP transport 
certainly is a DatagramTransport, but is it also a ReadTransport, or a 
WriteTransport?

(I feel like the answer is "no it isn't", but there are plenty of conflicting 
evidence. The docs show that WriteTransport has write_eof() and can_write_eof() 
-- methods clearly geared towards stream-like transports, and it duplicates 
abort() from DatagramTransport, so it would seem like WriteTransport and 
DatagramTransport are mutually exclusive. On the other hand, the default 
concrete implementation of _SelectorDatagramTransport actually inherits from 
Transport which inherits from both ReadTransport and WriteTransport, yet it 
does not inherit from DatagramTransport; As a result _SelectorDatagramTransport 
has all the methods from ReadTransport and WriteTransport, but many of them 
raise NotImplemented. This is why I'm asking this question in the first place: 
I found that the transport object I got from create_datagram_endpoint() has 
both pause_reading() and resume_reading() methods that raise NotImplemented, 
and thought that perhaps some event loop implementations would have these 
methods working, and I should try to use them. And before you say "UDP doesn't 
do flow control", asyncio actually does provide flow control for UDP on the 
writing end: see 
https://www.mail-archive.com/python-tulip@googlegroups.com/msg00532.html So 
it's not preposterous that there might be flow control on the reading end as 
well.)

I think it would be nice if the documentation can state the methods implemented 
for each type of transport, as the designers of Python intended, so there's a 
clear expectation of what methods will / should be available across different 
implementations of event loops and transports. Something along the lines of 
"The methods available on a transport depend on the transport’s kind: TCP 
transports support methods declared in BaseTransport, ReadTransport and 
WriteTransport below, etc."

--
assignee: docs@python
components: Documentation, asyncio
messages: 300083
nosy: docs@python, twisteroid ambassador, yselivanov
priority: normal
severity: normal
status: open
title: Is a UDP transport also a ReadTransport/WriteTransport?
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31172] Py_Main() is totally broken on Visual Studio 2017

2017-08-10 Thread Steve Dower

Steve Dower added the comment:

Your final file layout needs to match any of our standard ones. On my phone now 
so I'm not going to write them all out (will do it later if you need), but you 
need to put your .exe in the same location as the python.exe for the runtime 
you're using (or move the runtime around your exe).

Also look at the embeddable zip package. It's meant for this (though you still 
need a full install to build). I do this all the time.

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

bpo-31151 fixed test_socketserver.

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3095

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread Berker Peksag

Berker Peksag added the comment:

For those who want to triage this issue, the test case can be found at 
https://github.com/drallensmith/neat-python/blob/e4aeb39eccefbd73babfb61bb13fd23feef2a102/tests/test_distributed.py#L234

--
nosy: +berker.peksag, davin, pitrou

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 719a15b32587de6c4add4385ee3f84a20711340f by Victor Stinner in 
branch '3.6':
[3.6] bpo-31160: Backport reap_children() fixes from master to 3.6 (#3060)
https://github.com/python/cpython/commit/719a15b32587de6c4add4385ee3f84a20711340f


--

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2017-08-10 Thread David K. Hess

Changes by David K. Hess :


--
pull_requests: +3096

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3097

___
Python tracker 

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



[issue31133] [2.7] PCbuild/pcbuild.sln of Python 2.7 cannot be open by Visual Studio 2010

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 693790817a93701093ef9be7abbb0d6d4309 by Victor Stinner in 
branch '2.7':
PCbuild: downgrade pcbuild.sln to support VS 2010 (#3031)
https://github.com/python/cpython/commit/693790817a93701093ef9be7abbb0d6d4309


--

___
Python tracker 

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



[issue31133] [2.7] PCbuild/pcbuild.sln of Python 2.7 cannot be open by Visual Studio 2010

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue31159] Doc: Language switch can't switch on specific cases

2017-08-10 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3098

___
Python tracker 

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



[issue31149] Add Japanese to the language switcher

2017-08-10 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3099

___
Python tracker 

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



[issue31177] unittest mock's reset_mock throws an error when an attribute has been deleted

2017-08-10 Thread Hmvp

New submission from Hmvp:

When using a mock and deleting a attribute reset_mock cannot be used anymore 
since it tries to call reset_mock on the _deleted sentinel value.

Reproduction path:
```
from unittest.mock import MagicMock
mock = MagicMock()
mock.a = 'test'
del mock.a
mock.reset_mock()
```

Gives:
```
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/unittest/mock.py", line 544, in reset_mock
child.reset_mock(visited)
AttributeError: '_SentinelObject' object has no attribute 'reset_mock'
```

Expected result:
mock is reset without throwing an exception and the 'a' attribute is no longer 
in a deleted state

Only checked 3.5 and current master if bug is present

--
components: Library (Lib)
messages: 300090
nosy: hmvp
priority: normal
severity: normal
status: open
title: unittest mock's reset_mock throws an error when an attribute has been 
deleted
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2017-08-10 Thread David K. Hess

David K. Hess added the comment:

FYI, PR opened: https://github.com/python/cpython/pull/3062

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 1247e2cda514d7a73187e0b53ec8c35d87a34a84 by Victor Stinner in 
branch '2.7':
[2.7] bpo-31160: Backport reap_children fixes from master to 2.7 (#3063)
https://github.com/python/cpython/commit/1247e2cda514d7a73187e0b53ec8c35d87a34a84


--

___
Python tracker 

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



[issue31149] Add Japanese to the language switcher

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset e8e7fba0b24582959feca9c31f2a72fc0251f83d by Victor Stinner 
(Julien Palard) in branch '3.6':
bpo-31159: fix language switch regex on unknown yet built languages. … (#3051)
https://github.com/python/cpython/commit/e8e7fba0b24582959feca9c31f2a72fc0251f83d


--

___
Python tracker 

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



[issue31159] Doc: Language switch can't switch on specific cases

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset e8e7fba0b24582959feca9c31f2a72fc0251f83d by Victor Stinner 
(Julien Palard) in branch '3.6':
bpo-31159: fix language switch regex on unknown yet built languages. … (#3051)
https://github.com/python/cpython/commit/e8e7fba0b24582959feca9c31f2a72fc0251f83d


--

___
Python tracker 

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



[issue31135] [2.7] test_ttk_guionly doesn't destroy all widgets on Python 2.7

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

Copy of interesting comments: https://github.com/python/cpython/pull/3025

serhiy-storchaka: "Parent's destroy() now is called even if this destroy() 
already was called. I.e. it can be called twice."

haypo: "Yes, it's a deliberate choice. All other ttk widgets now have the same 
behaviour."

--

Ok, the bug is now fixed in 2.7, 3.6 and 3.7 (master) branches. I close the 
issue.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue31164] test_functools: test_recursive_pickle() stack overflow on x86 Gentoo Refleaks 3.x

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31149] Add Japanese to the language switcher

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

I reopen the issue: backport to 2.7 is still needed.

--
status: closed -> open
versions: +Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

Well, it looks like I was incorrect in where the AssertionError is coming from 
- the attached patches, while an improvement IMO on the current code, did not 
result in a change in behavior. Unfortunately, the combination of bare asserts 
(with no messages) with remote raising of errors makes it rather hard to debug 
- I will see if pdb will do it, but given that it's involving a subprocess I 
will be very impressed if it does. (Coverage.py frequently misses lines that 
are only executed in subprocesses, for instance.)

--
keywords: +patch
Added file: http://bugs.python.org/file47075/managers-3.5.patch

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

Here is the patch for 2.7.

--
Added file: http://bugs.python.org/file47076/managers-2.7.patch

___
Python tracker 

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



[issue31143] lib2to3 requires source files for fixes

2017-08-10 Thread Steve Dower

Steve Dower added the comment:

It also breaks .zip file distribution, which I'm fairly sure we do explicitly 
support by virtue of having "python36.zip" in sys.path by default. And the 
".pyc-only in a zip file" distribution is *totally* busted :) (and also 
officially released for Windows...)

I'm dragging in an importlib expert to the discussion, probably against his 
will, since this is really a problem of "how do I programmatically discover 
what I can import without using os.listdir()". Hopefully Brett can answer that 
question and we can come up with a patch.

--
nosy: +brett.cannon, steve.dower

___
Python tracker 

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



[issue26762] test_multiprocessing_spawn leaves processes running in background

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3101

___
Python tracker 

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



[issue31169] convert_to_error assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

pdb is not currently working for debugging a subprocess. I suspect I will need 
to put "import pdb" and "pdb.set_trace()" into managers.py.

BTW, a thank-you to berker.peksag; while the link is present in Travis, I 
should still have put it in.

--

___
Python tracker 

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



[issue31178] [EASY] subprocess: TypeError: can't concat str to bytes, in _execute_child()

2017-08-10 Thread STINNER Victor

New submission from STINNER Victor:

Lib/subprocess.py contains the following code:

try:
exception_name, hex_errno, err_msg = (
errpipe_data.split(b':', 2))
except ValueError:
exception_name = b'SubprocessError'
hex_errno = b'0'
err_msg = (b'Bad exception data from child: ' +
   repr(errpipe_data))

b'...' + repr() is wrong: it raises a "TypeError: can't concat str to bytes" 
when python3 is run with -bb.


Example with attached subprocess_bug.patch:

haypo@selma$ ./python -bb -m test -v test_subprocess -m test_invalid_args
(...)
==
ERROR: test_invalid_args (test.test_subprocess.ContextManagerTests)
--
Traceback (most recent call last):
  File "/home/haypo/prog/python/master/Lib/subprocess.py", line 1309, in 
_execute_child
errpipe_data.split(b':', 1))
ValueError: not enough values to unpack (expected 3, got 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/haypo/prog/python/master/Lib/test/test_subprocess.py", line 2880, 
in test_invalid_args
stderr=subprocess.PIPE) as proc:
  File "/home/haypo/prog/python/master/Lib/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
  File "/home/haypo/prog/python/master/Lib/subprocess.py", line 1314, in 
_execute_child
repr(errpipe_data))
TypeError: can't concat str to bytes


IMHO err_msg should be decoded using err_msg.decode(errors="surrogatepass") and 
then use 'Bad ...: %s' % err_msg. It would need to add an "else:" block to the 
try/except to do the err_msg.decode(errors="surrogatepass") when no error is 
raised. Well, something like that :-)

--
components: Library (Lib)
files: subprocess_bug.patch
keywords: easy, patch
messages: 300102
nosy: haypo
priority: normal
severity: normal
status: open
title: [EASY] subprocess: TypeError: can't concat str to bytes, in 
_execute_child()
versions: Python 3.7
Added file: http://bugs.python.org/file47077/subprocess_bug.patch

___
Python tracker 

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



[issue31169] Unknown-source assertion failure in multiprocessing/managers.py

2017-08-10 Thread drallensmith

drallensmith added the comment:

I've updated the title to be more accurate.

On second thought, putting in a pdb.set_trace() would require that I know where 
the assertion failure is taking place... sigh. BTW, is there some way to edit 
earlier messages? I am used to github in that regard...

--
title: convert_to_error assertion failure in multiprocessing/managers.py -> 
Unknown-source assertion failure in multiprocessing/managers.py

___
Python tracker 

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



[issue26762] test_multiprocessing_spawn leaves processes running in background

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 957d0e9b59bd27ca7c473560634d8b5dbe66338c by Victor Stinner in 
branch 'master':
bpo-26762: _test_multiprocessing reports dangling (#3064)
https://github.com/python/cpython/commit/957d0e9b59bd27ca7c473560634d8b5dbe66338c


--

___
Python tracker 

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



[issue31010] test_socketserver.test_ForkingTCPServer(): threading_cleanup() and reap_children() warnings on AMD64 FreeBSD 10.x Shared 3.x

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue31010] test_socketserver.test_ForkingTCPServer(): threading_cleanup() and reap_children() warnings on AMD64 FreeBSD 10.x Shared 3.x

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

I'm not 100% sure, but it looks like a duplicate of bpo-31151.

--
resolution:  -> duplicate
superseder:  -> test_socketserver: Warning -- reap_children() reaped child 
process

___
Python tracker 

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



[issue31151] test_socketserver: Warning -- reap_children() reaped child process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

bpo-31010 has been marked as a duplicate of this issue.

--

___
Python tracker 

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



[issue31041] test_handle_called_with_mp_queue() of test_logging: threading_cleanup() failed to cleanup, on AMD64 FreeBSD 10.x Shared 3.x

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

Let's mark this issue as a duplicate of bpo-30830.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> test_logging leaks a "dangling" threads on FreeBSD

___
Python tracker 

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



[issue31008] FAIL: test_wait_for_handle (test.test_asyncio.test_windows_events.ProactorTests) on x86 Windows7 3.x

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3102

___
Python tracker 

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



[issue30830] test_logging leaks a "dangling" threads on FreeBSD

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

bpo-31041 has been marked as a duplicate of this issue. Extracts:

test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest) ...
Warning -- threading_cleanup() failed to cleanup -1 threads after 4 sec (count: 
0, dangling: 1)

and

test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest) ...
Warning -- threading_cleanup() failed to cleanup -1 threads after 3 sec (count: 
0, dangling: 1)

--

"Maybe threading_cleanup() should call support.gc_collect()."

--

___
Python tracker 

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



[issue30830] test_logging leaks a "dangling" threads on FreeBSD

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
title: HTTPHandlerTest of test_logging leaks a "dangling" thread on AMD64 
FreeBSD CURRENT Non-Debug 3.x -> test_logging leaks a "dangling" threads on 
FreeBSD

___
Python tracker 

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



[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-10 Thread Martijn Pieters

Martijn Pieters added the comment:

It's confusing; a syntax error reports on the first error found, not two errors 
at once. The TabError or IndentationError exception detail message itself is 
lost (it should be "IndentationError: Improper mixture of spaces and tabs." or 
"TabError: Improper indentation.", respectively). So you end up with an 
end-user scratching their head, the two parts of the message make no sense 
together.

--

___
Python tracker 

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



[issue31168] IDLE hangs with absurdly long __repr__s

2017-08-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am quite aware that tk text widgets (and probably other widgets) have 
line-length limitations.  Which issue this duplicates depends on what action 
you propose.  #28840 proposes addressing limits in the docs. #1442493 is about 
code changes.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue31148] Can we get an MSI installer for something past 3.4.4?

2017-08-10 Thread R. David Murray

R. David Murray added the comment:

Steve, when we changed installers was that when we also fixed the 
security/permissions problems with the install dir?  If permissions are the 
issue the OP's problem may have nothing to do with it not being msi.

--

___
Python tracker 

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



[issue31143] lib2to3 requires source files for fixes

2017-08-10 Thread Brett Cannon

Brett Cannon added the comment:

Simplest way is to do 
https://docs.python.org/3/library/importlib.html#importlib.util.find_spec and 
see if a spec can be found for the module in question. That will do the search 
for the module but it won't load it. This does dictate that you know the name 
of the module upfront, though. If you want more of a "list all modules since I 
don't know what I want" then you're out of luck until I develop the API (maybe 
3.7?).

--

___
Python tracker 

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



[issue31178] [EASY] subprocess: TypeError: can't concat str to bytes, in _execute_child()

2017-08-10 Thread Ammar Askar

Changes by Ammar Askar :


--
pull_requests: +3103

___
Python tracker 

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



[issue31148] Can we get an MSI installer for something past 3.4.4?

2017-08-10 Thread Steve Dower

Steve Dower added the comment:

> when we changed installers was that when we also fixed the 
> security/permissions problems with the install dir

Yes, but the permissions issue here isn't the install directory - it is 
probably the TEMP directory or some other system restriction. It's basically 
impossible to tell from the logs, and I don't even know where to start asking 
for configuration settings to see what may be wrong.

--

___
Python tracker 

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



[issue31002] IDLE: Add tests for configdialog keys tab

2017-08-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am not sure I agree with all your suggested name changes.  But I am looking 
as more substantive issues first.

--

___
Python tracker 

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



[issue31130] test_idle: idlelib.configdialog leaks references

2017-08-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Victor: Something seems to have changed in the last few days.  When I merged, 
both specific classes
python -m test -R 3:3 -u gui -v test_idle -m 
idlelib.idle_test.test_configdialog.FontPageTest.*
and the module as a whole passed.
python -m test -R 3:3 -u gui -v test_idle -m 
idlelib.idle_test.test_configdialog.*.*

Today, not having touched configdialog or test_configdialog, test_configdialog 
as a whole passes but FontPageTest, IndentTest, and GenPageTest fail with 
test_idle leaked [1, 1, 1, 1] memory blocks, sum=4
(Tested individually, VarTraceTest and the empty HighlightTest pass.)
I presume that cleanUpModule still runs with the restriction.

Could any of your other recent changes to regrtest have introduced a spurious 1 
block error when tests are filtered?

--

___
Python tracker 

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



[issue31130] test_idle: idlelib.configdialog leaks references

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

> test_idle leaked [1, 1, 1, 1] memory blocks, sum=4

While reference leaks are more or less stable, the check on memory blocks is 
fragile.

I'm unable to reproduce your issue on Linux. I tested "./python -m test -R 3:3 
-u gui -v test_idle". If you have a reproductible failure, please open a new 
issue since this one is closed.

If you consider that it's a recent regression, you can go back in history using 
git checkout , or even git bisect.

If you open a new issue, you may want to use "python -m test.bisect ..." to 
identify which test leaks memory blocks.

--

___
Python tracker 

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



[issue31069] test_multiprocessing_spawn leaked a dangling process

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
title: test_multiprocessing_spawn leaked a process on AMD64 Windows8.1 Refleaks 
3.x -> test_multiprocessing_spawn leaked a dangling process

___
Python tracker 

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



[issue31069] test_multiprocessing_spawn leaked a process on AMD64 Windows8.1 Refleaks 3.x

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

With the commit 957d0e9b59bd27ca7c473560634d8b5dbe66338c (bpo-26762), 
_test_multiprocessing now fails with ENV_CHANGED if a warning is emitted. It 
allowed to catch a warning on x86-64 El Capitan 3.x:

http://buildbot.python.org/all/builders/x86-64%20El%20Capitan%203.x/builds/581/steps/test/logs/stdio

test_enable_logging (test.test_multiprocessing_spawn.WithProcessesTestLogging) 
... ok
test_level (test.test_multiprocessing_spawn.WithProcessesTestLogging) ... ok
test_rapid_restart 
(test.test_multiprocessing_spawn.WithProcessesTestManagerRestart) ... ok
Warning -- Dangling processes: {}
test_access 
(test.test_multiprocessing_spawn.WithProcessesTestPicklingConnections) ... ok
test_pickling 
(test.test_multiprocessing_spawn.WithProcessesTestPicklingConnections) ... ok
test_boundaries (test.test_multiprocessing_spawn.WithProcessesTestPoll) ... ok

--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-10 Thread Yury Selivanov

Changes by Yury Selivanov :


--
pull_requests: +3104

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-10 Thread Yury Selivanov

New submission from Yury Selivanov:

It's possible to significantly improve performance of shallow dict copy.  
Currently, PyDict_Copy creates a new empty dict object and then inserts 
key/values into it one by one.

My idea is to simply memcpy the whole keys/items region and do the necessary 
increfs after it.  This works just fine for non-key-sharing dicts.

With the following simple microbenchmark:

import time

N = 100

for size in [0, 1, 10, 20, 50, 100, 500, 1000]:
d = dict([(str(i), i) for i in range(size)])

t = time.monotonic()
for i in range(N):
d.copy()
e = time.monotonic() - t

print(f'dict(size={size}).copy() x {N} times:\t {e:.4f}')


Output for 3.7 master:

dict(size=0).copy() x 100 times: 0.1299
dict(size=1).copy() x 100 times: 0.1499
dict(size=10).copy() x 100 times:0.3758
dict(size=20).copy() x 100 times:0.7722
dict(size=50).copy() x 100 times:1.2784
dict(size=100).copy() x 100 times:   2.5128
dict(size=500).copy() x 100 times:   12.8968
dict(size=1000).copy() x 100 times:  25.4276


Output for patched 3.7:

dict(size=0).copy() x 100 times: 0.1352
dict(size=1).copy() x 100 times: 0.1285
dict(size=10).copy() x 100 times:0.1632
dict(size=20).copy() x 100 times:0.3076
dict(size=50).copy() x 100 times:0.3663
dict(size=100).copy() x 100 times:   0.5140
dict(size=500).copy() x 100 times:   2.3419
dict(size=1000).copy() x 100 times:  4.6176

--
components: Interpreter Core
messages: 300117
nosy: haypo, inada.naoki, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Speed-up dict.copy() up to 5.5 times.
type: performance
versions: Python 3.7

___
Python tracker 

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



[issue31180] test_multiprocessing_spawn hangs randomly on x86 Windows7 3.6

2017-08-10 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/x86%20Windows7%203.6/builds/570/steps/test/logs/stdio

1:21:25 [402/405] test_frame passed -- running: test_multiprocessing_spawn 
(2805 sec)
1:21:32 [403/405] test_hash passed -- running: test_multiprocessing_spawn (2811 
sec)
1:21:33 [404/405] test_raise passed -- running: test_multiprocessing_spawn 
(2812 sec)

command timed out: 1200 seconds without output running 
['Tools\\buildbot\\test.bat', '-j2', '--timeout', '900'], attempting to kill
program finished with exit code 1
elapsedTime=6104.779000

--
components: Tests
messages: 300119
nosy: haypo
priority: normal
severity: normal
status: open
title: test_multiprocessing_spawn hangs randomly on x86 Windows7 3.6
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



[issue31181] Segfault in gcmodule.c:360 visit_decref (PyObject_IS_GC(op))

2017-08-10 Thread lchin

New submission from lchin:

When running a python script with YML data as input, it stopped with 
segmentation fault 

/home/appuser/pyETL/tableTrimmer.py 
 /home/appuser/pyETL/csidPyLib/etlConfig/ip4AuditSync.yml

(gdb) bt

Core was generated by `python2.7 tableTrimmer.py 
csidPyLib/etlConfig/ip4AuditSync.yml'.
Program terminated with signal 11, Segmentation fault.
#0  visit_decref (op=0x7f08c1afb320, data=0x0) at Modules/gcmodule.c:360
360 if (PyObject_IS_GC(op)) {

--
components: Interpreter Core
messages: 300121
nosy: lchin
priority: normal
severity: normal
status: open
title: Segfault in gcmodule.c:360 visit_decref (PyObject_IS_GC(op))
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

> PyDict_Copy creates a new empty dict object and then inserts key/values into 
> it one by one.

Why not creating a "preallocated" dict in that case? _PyDict_NewPresized()

--

___
Python tracker 

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



[issue31069] test_multiprocessing_spawn leaked a dangling process

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

Another warning on x86 Tiger 3.x:

http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/1043/steps/test/logs/stdio

test_rapid_restart 
(test.test_multiprocessing_forkserver.WithProcessesTestManagerRestart) ... ok
Warning -- Dangling processes: {}
test_access 
(test.test_multiprocessing_forkserver.WithProcessesTestPicklingConnections) ... 
ok

--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-10 Thread Yury Selivanov

Yury Selivanov added the comment:

>> PyDict_Copy creates a new empty dict object and then inserts key/values into 
>> it one by one.

> Why not creating a "preallocated" dict in that case? _PyDict_NewPresized()

I don't think it's related to the proposed patch.  Please take a look at the 
PR.  `_PyDict_NewPresized` and inserting entries one by one will not be faster 
than a `memcpy`.

--

___
Python tracker 

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



[issue31002] IDLE: Add tests for configdialog keys tab

2017-08-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I have thought about factoring out common test code into helper functions 
either within test_configdialog or in a new module.  One example: simulate a 
click on a listbox, with common before and after code.  Another: Testing the 
group of selection widgets on both theme and keys pages. (If I were not 
planning to replace this group, we could factor out a SelectionFrame and put an 
instance on each page.)

We might do some such refactoring after this, before HighPageTest.  Keep notes 
on redundancies you notice that might be candidates.

--

___
Python tracker 

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



[issue31130] test_idle: idlelib.configdialog leaks references

2017-08-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My message was most a heads-up.  As I said, I only get the 1 block leak with a 
micro test of a class or method.  It is possible that even that is 
Windows-specific.  As long as you only care that test_idle not leak, I don't 
care about this either.

--

___
Python tracker 

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



[issue31130] test_idle: idlelib.configdialog leaks references

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

> As I said, I only get the 1 block leak with a micro test of a class or method.

Yeah, again, the memory block check is fragile. It might be an legit internal 
cache filled for good reasons. It can be a free list. It can be a lot of 
things. It's really hard to track such very tiny memory allocation. "leaked [1, 
1, 1, 1] memory blocks" can be a false alarm, it's not big.

--

___
Python tracker 

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



[issue31008] FAIL: test_wait_for_handle (test.test_asyncio.test_windows_events.ProactorTests) on x86 Windows7 3.x

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 5659a72f487579be76335c09c8ba8b2f1800adde by Victor Stinner in 
branch 'master':
bpo-31008: Fix asyncio test_wait_for_handle on Windows (#3065)
https://github.com/python/cpython/commit/5659a72f487579be76335c09c8ba8b2f1800adde


--

___
Python tracker 

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



[issue31008] FAIL: test_wait_for_handle (test.test_asyncio.test_windows_events.ProactorTests) on x86 Windows7 3.x

2017-08-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3105

___
Python tracker 

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



[issue28087] macOS 12 poll syscall returns prematurely

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

What is the status of this issue? Is there still something to do?

If you ask me my opinion, I would just suggest to remove select.poll() on macOS 
to stop to have to bother with poll() bugs which only trigger at runtime :-/

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



[issue30030] Simplify _RandomNameSequence

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

No consensus was found on this issue how to "simplify" _RandomNameSequence, so 
I close the issue.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



  1   2   >