[issue31440] wrong default module search path in help message

2017-09-13 Thread Xiang Zhang

New submission from Xiang Zhang:

In python --help:

PYTHONHOME   : alternate  directory (or :).
   The default module search path uses /pythonX.X.

I think the default module search path should be /lib/pythonX.X.

--
keywords: easy
messages: 302032
nosy: xiang.zhang
priority: normal
severity: normal
stage: needs patch
status: open
title: wrong default module search path in help message
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



[issue31441] Descriptor example in documentation is confusing, possibly wrong

2017-09-13 Thread Benjamin Wohlwend

New submission from Benjamin Wohlwend:

The first descriptor example in the descriptor docs 
(https://docs.python.org/3/howto/descriptor.html#descriptor-example) stores the 
value on the descriptor instance, which is shared among all MyClass instances. 
This leads to surprising (and arguably buggy from a user perspective) behaviour:

m1, m2 = MyClass(), MyClass()
m1.x = 5
m2.x = 10
print(m1.x, m2.x)
>>> 10 10

I'm not sure how this could be fixed without making the example much more 
complicated (e.g. by introducing a "values" weakref dictionary on the 
descriptor instance). 

Maybe pointing this behaviour out in the docs could be enough, although I don't 
see any useful use case for a class that has this behaviour.

--
assignee: docs@python
components: Documentation
messages: 302033
nosy: Benjamin Wohlwend, docs@python
priority: normal
severity: normal
status: open
title: Descriptor example in documentation is confusing, possibly wrong

___
Python tracker 

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



[issue31233] socketserver.ThreadingMixIn leaks running threads after server_close()

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 97d7e65dfed1d42d40d9bc2f630af56240555f02 by Victor Stinner in 
branch 'master':
bpo-30830: logging.config.listen() calls server_close() (#3524)
https://github.com/python/cpython/commit/97d7e65dfed1d42d40d9bc2f630af56240555f02


--

___
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 dangling threads on FreeBSD

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 97d7e65dfed1d42d40d9bc2f630af56240555f02 by Victor Stinner in 
branch 'master':
bpo-30830: logging.config.listen() calls server_close() (#3524)
https://github.com/python/cpython/commit/97d7e65dfed1d42d40d9bc2f630af56240555f02


--

___
Python tracker 

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



[issue31442] assertion failures on Windows in Python/traceback.c in case of a bad io.open

2017-09-13 Thread Oren Milman

New submission from Oren Milman:

the following code causes an assertion failure on my Windows:
import io
def _bad_open(*args):
return 42

io.open = _bad_open

1/0

this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that
the return value of io.open() is valid.

IIUC, this is actually a debug assertion failure in Windows code, in
_get_osfhandle() (which is called by _Py_dup() (in Python/fileutils.c)).
(also, on my Ubuntu VM, there is no assertion failure.)

the following code causes a similar assertion failure:
import io
def _bad_open1(*args):
io.open = _bad_open2
raise Exception

def _bad_open2(*args):
return 42

io.open = _bad_open1

1/0

this is because _Py_FindSourceFile() assumes that the return value of io.open()
is valid, and returns it to _Py_DisplaySourceLine(), which also assume it is
valid.


I thought about adding a check in _Py_DisplaySourceLine(), before calling
PyObject_AsFileDescriptor(), such as:
PyObject_IsInstance(binary, (PyObject*)&PyIOBase_Type);
but I am not sure whether we should use PyIOBase_Type outside of the io module.

note that even with such a check, one could still write a _bad_open() that
returns a subclass of IOBase, whose fileno() method returns a bad file
descriptor.
#15263 (and specifically https://bugs.python.org/issue15263#msg164731) mentions
this.

--
components: IO
messages: 302036
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failures on Windows in Python/traceback.c in case of a bad 
io.open
type: crash
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



[issue31233] socketserver.ThreadingMixIn leaks running threads after server_close()

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset b8f4163da30e16c7cd58fe04f4b17e38d53cd57e by Victor Stinner in 
branch 'master':
bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523)
https://github.com/python/cpython/commit/b8f4163da30e16c7cd58fe04f4b17e38d53cd57e


--

___
Python tracker 

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



[issue31443] Possibly out of date C extension documentation

2017-09-13 Thread Romuald Brunet

New submission from Romuald Brunet:

In the "Defining New Types documentation" basics about tp_new -> 
PyType_GenericNew, the doc states:

> We’d like to just assign this to the tp_new slot, but we can’t, for
> portability sake, On some platforms or compilers, we can’t statically
> initialize a structure member with a function defined in another C
> module, so, instead, we’ll assign the tp_new slot in the module
> initialization function just before calling PyType_Ready():


But looking a python C code itself [1] does seem to do this. So I'm guessing 
that part of the documentation is now irrelevant and the example could just 
assign PyType_GenericNew to tp_new.

[1] 
https://github.com/python/cpython/blob/2ebc5ce42a8a9e047e790aefbf9a94811569b2b6/Objects/listobject.c#L2733

--
assignee: docs@python
components: Documentation
messages: 302038
nosy: Romuald, docs@python
priority: normal
severity: normal
status: open
title: Possibly out of date C extension documentation
type: enhancement

___
Python tracker 

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



[issue31444] ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper

2017-09-13 Thread Oren Milman

New submission from Oren Milman:

the following code causes a ResourceWarning:

import io
def _bad_TextIOWrapper(*args):
return None
io.TextIOWrapper = _bad_TextIOWrapper
1/0


this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that
io.TextIOWrapper() returned a stream object, and tries to call its close() 
method. in case calling close() fails, _Py_DisplaySourceLine() just calls
PyErr_Clear().


maybe _Py_DisplaySourceLine() should try to call binary.close() in such cases?

I also thought about adding a check such as:
PyObject_IsInstance(fob, (PyObject*)&PyTextIOWrapper_Type);
but I am not sure whether we should use PyTextIOWrapper_Type outside of the io
module.

--
components: IO
messages: 302039
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper
type: resource usage
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



[issue31444] ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

> this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that 
> io.TextIOWrapper() returned a stream object, and tries to call its close()  
> method. in case calling close() fails, _Py_DisplaySourceLine() just calls 
> PyErr_Clear().

I consider that _Py_DisplaySourceLine() is right to expect that 
io.TextIOWrapper() creates a stream object. If the TextIOWrapper creation 
fails, it calls binary.close() to prevent a resource warning. Here your 
function doesn't fail but returns None which is really not expected.


> def _bad_TextIOWrapper(*args): return None
> io.TextIOWrapper = _bad_TextIOWrapper

I don't see why Python should support such strange TextIOWrapper type. I simply 
suggest to close the issue as WONTFIX.

--
nosy: +haypo, pitrou, serhiy.storchaka

___
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 dangling threads on FreeBSD

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

Ok, the main bugs have been fixed by the following socketserver fix.

commit b8f4163da30e16c7cd58fe04f4b17e38d53cd57e
Author: Victor Stinner 
Date:   Wed Sep 13 01:47:22 2017 -0700

bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523)

socketserver.ThreadingMixIn now keeps a list of non-daemonic threads
to wait until all these threads complete in server_close().

Reenable test_logging skipped tests.

Fix SocketHandlerTest.tearDown(): close the socket handler before
stopping the server, so the server can join threads.

I'm not sure that it's possible to fix the bug in Python 3.6 without breaking 
the backward compatibility.

test_logging shouldn't fail with the threading_cleanup() warning anymore.

--
dependencies:  -socketserver.ThreadingMixIn leaks running threads after 
server_close()
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3530

___
Python tracker 

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



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman

Oren Milman added the comment:

what do you mean by 'Implicit converting to str can raise a warning or 
exception if __module__ is a bytes object.'?

should we treat __module__ differently in case it is a bytes object?

--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3531

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3532

___
Python tracker 

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



[issue31445] Index out of range in get of message.EmailMessage.get()

2017-09-13 Thread Michala

New submission from Michala:

This error occured when the email field "From" was demanded:

  File "/home/user/processing/Test/process_email.py", line 84, in __init__
self.field_from_full = msg.get("From")
  File "/usr/local/lib/python3.6/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
  File "/usr/local/lib/python3.6/email/policy.py", line 162, in 
header_fetch_parse
return self.header_factory(name, value)
  File "/usr/local/lib/python3.6/email/headerregistry.py", line 586, in __call__
return self[name](name, value)
  File "/usr/local/lib/python3.6/email/headerregistry.py", line 197, in __new__
cls.parse(value, kwds)
  File "/usr/local/lib/python3.6/email/headerregistry.py", line 337, in parse
kwds['parse_tree'] = address_list = cls.value_parser(value)
  File "/usr/local/lib/python3.6/email/headerregistry.py", line 328, in 
value_parser
address_list, value = parser.get_address_list(value)
  File "/usr/local/lib/python3.6/email/_header_value_parser.py", line 2336, in 
get_address_list
token, value = get_address(value)
  File "/usr/local/lib/python3.6/email/_header_value_parser.py", line 2313, in 
get_address
token, value = get_group(value)
  File "/usr/local/lib/python3.6/email/_header_value_parser.py", line 2284, in 
get_group
if value[0] != ';':
IndexError: string index out of range

I used EmailPolicy, so the message object was instance of EmailMessage.
Header field "From" had following form: 
"From: Bonifac Karaka : boni...@gmail.com"

--
components: email
messages: 302043
nosy: Michala, barry, r.david.murray
priority: normal
severity: normal
status: open
title: Index out of range in get of message.EmailMessage.get()
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



[issue31323] test_ssl: reference cycle between ThreadedEchoServer and its ConnectionHandler

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
keywords: +patch
pull_requests: +3533
stage:  -> patch review

___
Python tracker 

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



[issue31250] test_asyncio leaks dangling threads

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue31323] test_ssl: reference cycle between ThreadedEchoServer and its ConnectionHandler

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

I don't think that Python 2.7 is affected since Exception has no __traceback__ 
attribute in Python 2.7.

--

___
Python tracker 

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



[issue31446] _winapi.CreateProcess (used by subprocess) is not thread-safe

2017-09-13 Thread Evan Andrews

New submission from Evan Andrews:

The method used for spawning subprocesses on Windows is not thread-safe under 
certain circumstances. The following example demonstrates how this manifests:

>>> import threading
>>> import subprocess
>>> for i in range(100):
... threading.Thread(
... target=subprocess.Popen,
... args=('ping localhost',),
... kwargs={'stdout': subprocess.DEVNULL},
... ).start()
...
Exception in thread Thread-1202:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in 
_bootstrap_inner
self.run()
  File "C:\Program Files\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
  File "C:\Program Files\Python36\lib\subprocess.py", line 990, in 
_execute_child
startupinfo)
ValueError: embedded null character

Exception in thread Thread-1206:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in 
_bootstrap_inner
self.run()
  File "C:\Program Files\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
  File "C:\Program Files\Python36\lib\subprocess.py", line 990, in 
_execute_child
startupinfo)
ValueError: embedded null character

>>>

subprocess.Popen calls down to _winapi.CreateProcess, which calls 
CreateProcessW. When args is passed as a fixed string, the result of the 
argument conversion is attached to the object and shared by future calls into C 
code. However, the documentation for CreateProcess states:

"The Unicode version of this function, CreateProcessW, can modify the contents 
of this string. Therefore, this parameter cannot be a pointer to read-only 
memory (such as a const variable or a literal string). If this parameter is a 
constant string, the function may cause an access violation." (Source: 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx)

It appears CreateProcessW is briefly inserting null characters into the buffer, 
causing errors if that buffer is used elsewhere before it is changed back.

The call to CreateProcessW using the shared buffer can be seen here: 
https://github.com/python/cpython/blob/b8f4163da30e16c7cd58fe04f4b17e38d53cd57e/Modules/_winapi.c#L879

Note that this error does not occur when passing args as a list, as 
subprocess.list2cmdline creates a new (though identical) string for each 
invocation.

One potential solution is to allocate a copy of command_line (the shared 
buffer) instead of using the original.

--
components: Library (Lib)
messages: 302045
nosy: evan_
priority: normal
severity: normal
status: open
title: _winapi.CreateProcess (used by subprocess) is not thread-safe
versions: Python 3.3, Python 3.4, 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



[issue31446] _winapi.CreateProcess (used by subprocess) is not thread-safe

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) implicitly converts its 
argument to string. I mean that treating non-string moduleName the same way as 
string moduleName not equal to string "builtins" and calling 
PyFile_WriteObject() would cause other problem. Treating non-string moduleName 
the same way as moduleName==NULL LGTM.

--

___
Python tracker 

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



[issue31446] _winapi.CreateProcess (used by subprocess) is not thread-safe

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

I remove Python 3.3-3.5 from Python versions since these versions don't accept 
bugfixes anymore, only security fixes:
https://devguide.python.org/#status-of-python-branches

--
nosy: +haypo
versions:  -Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

I rebased PR 3138: 3 tests failed on Travis CI.

test_ssl:

Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
3)
Dangling thread: 
Dangling thread: 
Dangling thread: <_MainThread(MainThread, started 47903383548928)>

test_poplib:

Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
3)
Dangling thread: 
Dangling thread: <_MainThread(MainThread, started 47566631539712)>
Dangling thread: 
/home/travis/build/python/cpython/Lib/test/support/__init__.py:1511: 
ResourceWarning: unclosed 
  gc.collect()
/home/travis/build/python/cpython/Lib/test/support/__init__.py:1511: 
ResourceWarning: unclosed 
  gc.collect()
/home/travis/build/python/cpython/Lib/test/support/__init__.py:1511: 
ResourceWarning: unclosed 
  gc.collect()

test_ftplib:

Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
4)
Dangling thread: 
Dangling thread: 
Dangling thread: 
Dangling thread: <_MainThread(MainThread, started 47769182004224)>

--

___
Python tracker 

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



[issue31444] ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it should be closed as "not a bug".

If io.TextIOWrapper() is successful, it is responsible for property closing a 
binary file. The bug is in user code, not in the interpreter code.

_Py_DisplaySourceLine() correctly calls binary.close() if io.TextIOWrapper() 
failed.

--

___
Python tracker 

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



[issue31444] ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

Ok, thanks for the confirmation Serhiy. I close the bug.

--
resolution:  -> not a bug
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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Leonardo Francalanci

New submission from Leonardo Francalanci:

the script below (a python process is called, which calls a waitfor cmd with a 
timeout of 4 seconds) is supposed to end after 4 seconds. But instead 
proc.communicate stops after the 20 seconds timeout.

Everything works 100% ok if I remove the stdin/stderr/stdout parameters...


if __name__ == "__main__":
  #start a python process which will wait for 4 seconds and then exit (waitfor 
is set to 200):
  proc_str = ["C:\\Program Files (x86)\\Anaconda3\\Python.exe",
"-c", "import 
  subprocess;subprocess.run('cmd /S /C waitfor g /t 200', shell=False, 
timeout=4)"]
  proc = subprocess.Popen(proc_str,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
shell=False,
universal_newlines=True)
  #this should exit in 4 seconds (when the called process exits), but instead 
exits after 20 seconds:
  (proc_out, proc_err) = proc.communicate(timeout=20)

--
messages: 302051
nosy: Leonardo Francalanci
priority: normal
severity: normal
status: open
title: proc communicate not exiting on python subprocess timeout using PIPES
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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Leonardo Francalanci

Changes by Leonardo Francalanci :


--
components: +Interpreter Core
type:  -> behavior

___
Python tracker 

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



[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On my computer the speed up is 13% without LTO and PGO and around 20% with LTO 
and PGO. Building with LTO and PGO adds other 20%.

--

___
Python tracker 

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



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman

Changes by Oren Milman :


--
keywords: +patch
pull_requests: +3534
stage:  -> patch review

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 42f7e0d8b0ca940a809a786f25d967dcce4d71b6 by Victor Stinner in 
branch '2.7':
bpo-31234: fork_wait tests now join threads (#3139) (#3535)
https://github.com/python/cpython/commit/42f7e0d8b0ca940a809a786f25d967dcce4d71b6


--

___
Python tracker 

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



[issue31323] test_ssl: reference cycle between ThreadedEchoServer and its ConnectionHandler

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 1b00bddd5c4a5728b15eee5a27ed3f78a173ef64 by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
[3.6] bpo-31323: Fix reference leak in test_ssl (GH-3263) (#3538)
https://github.com/python/cpython/commit/1b00bddd5c4a5728b15eee5a27ed3f78a173ef64


--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 6c25b73194714e78975eddea3799f06f3de74647 by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
[3.6] bpo-31234: test_httpservers joins the server thread (GH-3188) (#3536)
https://github.com/python/cpython/commit/6c25b73194714e78975eddea3799f06f3de74647


--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 89bfc9b0d9033f7c9f086c7281a31a489fe1136f by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
[3.6] bpo-31234: test_threaded_import: fix test_side_effect_import() (GH-3189) 
(#3537)
https://github.com/python/cpython/commit/89bfc9b0d9033f7c9f086c7281a31a489fe1136f


--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3535

___
Python tracker 

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



[issue31448] test_pop started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

New submission from STINNER Victor:

On AMD64 Windows8.1 Refleaks 3.x buildbot, test_poplib started to log a lot of 
ResourceWarning warnings since the build 101:

http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.x/builds/101/

2:30:30 [388/405/3] test_poplib passed (64 sec) -- running: test_pickletools 
(117 sec), test_multiprocessing_main_handling (145 sec)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\ssl.py:391: 
ResourceWarning: unclosed 
  self = _SSLContext.__new__(cls, protocol)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\ssl.py:391: 
ResourceWarning: unclosed 
  self = _SSLContext.__new__(cls, protocol)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\ssl.py:391: 
ResourceWarning: unclosed 
  self = _SSLContext.__new__(cls, protocol)
beginning 6 repetitions
123456
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:433: 
ResourceWarning: unclosed 
  return _intenum_converter(super().family, AddressFamily)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:433: 
ResourceWarning: unclosed 
  return _intenum_converter(super().family, AddressFamily)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:433: 
ResourceWarning: unclosed 
  return _intenum_converter(super().family, AddressFamily)
.D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)
.D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
.D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
.D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:439: 
ResourceWarning: unclosed 
  return _intenum_converter(super().type, SocketKind)
.D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)
D:\buildarea\3.x.ware-win81-release.refleak\build\lib\socket.py:144: 
ResourceWarning: unclosed 
  _socket.socket.__init__(self, family, type, proto, fileno)

Git log build 100..build 101:

haypo@selma$ git log 
829dacce4fca60fc3c3367980e75e21dfcdbe6be..c0c29dff7940b7e7ecc1dd051080c5d5f9e42ba8
commit c0c29dff7940b7e7ecc1dd051080c5d5f9e42ba8
Author: Stefan Krah 
Date:   Sat Sep 9 19:26:22 2017 +0200

bpo-31403: Remove WITHOUT_THREADS from _decimal. (#3474)

commit a7fbad96c8631070c1db137635d5bdd5e2aaac50
Author: Sergey Fedoseev 
Date:   Sat Sep 9 21:39:36 2017 +0500

Make `json.dumps()` example to be PEP-8 compliant. (GH-3472)

commit b84bcc48ae31c385fe480c08c05d95212ef7fcdc
Author: Steve Dower 
Date:   Sat Sep 9 06:13:06 2017 -0700

bpo-31392: Update SSL build for 1.1.0 (#3448)

commit efb1d0a3c001a6153211063ba439b9847aa03509
Author: Gregory P. Smith 
Date:   Sat Sep 9 00:30:15 2017 -0700

bpo-29639: change test.support.HOST to "localhost"

test.support.HOST should be "localhost" as it was in the past. See the 
bpo-29639.

Tests that need the IP address should use HOSTv4 (added) or the existing 
HOSTv6 constant.

This changes the definition and fixes tests that needed updating to deal 
with HOST being
the hostname rather than the hardcoded IP address.

This is only the first step in addressing 
https://bugs.python.org/issue29639.

--
messages: 302057
nosy: haypo
priority: normal
severity: normal
status: open
title: test_pop started to log a lot of ResourceWarn

[issue31448] test_pop started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
components: +Tests

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d403a29c0055de6b03ed5ae7a5c564e1c95a5950 by Victor Stinner in 
branch 'master':
bpo-31234: Fix dangling thread in test_ftp/poplib (#3540)
https://github.com/python/cpython/commit/d403a29c0055de6b03ed5ae7a5c564e1c95a5950


--

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Eryk Sun

Eryk Sun added the comment:

I don't see a bug here. The inner run() kills cmd.exe after 4 seconds. But the 
waitfor.exe process waits for 200 seconds and has handles for the pipes. The OS 
won't close out the pipes as long as there are potential writers, so the outer 
communicate() waits the full 20 seconds.

--
nosy: +eryksun

___
Python tracker 

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



[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
title: test_pop started to log a lot of ResourceWarning warnings on AMD64 
Windows8.1 Refleaks 3.x -> test_poplib started to log a lot of ResourceWarning 
warnings on AMD64 Windows8.1 Refleaks 3.x

___
Python tracker 

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



[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
pull_requests: +3536
stage:  -> patch review

___
Python tracker 

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



[issue31449] Potential DoS Attack when Parsing Email with Huge Number of MIME Parts

2017-09-13 Thread Christian Koßmann

New submission from Christian Koßmann:

Python's email parser consumes a lot of resources (CPU and memory) when parsing 
emails with a large amount of MIME parts. Attackers can probably exploit this 
behavior to perform denial-of-service (DoS) attacks.

A potentially malicious email has the following structure:

=
From: sen...@example.com
To: recipi...@example.com
Subject: Mutlipart DoS Attack
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="n"

This is a multi-part message in MIME format.
--n

b

--n

... a lot of parts here...

--n

b

--n--
=

On my machine parsing an email with 1 million MIME parts takes around 20 
seconds and with 10 million MIME parts over 3 minutes.

In my opinion, the number of MIME parts should be limited to some reasonable 
value to mitigate this kind of attack. The bug report contains a Python script 
with a proof-of-concept.

--
components: email
files: multipart-dos-attack.py
messages: 302060
nosy: barry, ckossmann, r.david.murray
priority: normal
severity: normal
status: open
title: Potential DoS Attack when Parsing Email with Huge Number of MIME Parts
type: security
versions: Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47138/multipart-dos-attack.py

___
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 and test_multiprocessing_forkserver leak dangling processes

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

New test_multiprocessing_fork failure on AMD64 FreeBSD CURRENT Debug 3.x:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/869/steps/test/logs/stdio

(...)
test_traceback (test.test_multiprocessing_fork.WithThreadsTestPool) ... ok
test_wrapped_exception (test.test_multiprocessing_fork.WithThreadsTestPool) ... 
ok
Warning -- Dangling threads: {}
test_active_children (test.test_multiprocessing_fork.WithThreadsTestProcess) 
... ok
(...)

--

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Leonardo Francalanci

Leonardo Francalanci added the comment:

The called "C:\\Program Files (x86)\\Anaconda3\\Python.exe" process exits after 
4 seconds. The reason why it ends shouldn't matter, right? I expect that a call 
to communicate should exit as soon as the called process is not running 
anymore. I don't hold a pipe with "waitfor", I hold it with python.exe.

--

___
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-09-13 Thread STINNER Victor

STINNER Victor added the comment:

test_tools also fails on x86 Gentoo Refleaks 3.6:

http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.6/builds/90

test_tools leaked [1, 1, 118] memory blocks, sum=120
(...)
test_tools leaked [7, 1, 6] memory blocks, sum=14

--

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2017-09-13 Thread Michal Sekletar

New submission from Michal Sekletar:

Issue
-
Documentation of subprocess module claims that exceptions raised in child 
process will be re-raised in the parent process and will have child_traceback 
attribute set [1]. At least on Fedora Rawhide with python-3.6.2 this is not the 
case.


Reproducer
--
$ cat preexec-exception.py
#!/usr/bin/env python3

import subprocess

class PreExecCallback:
def __call__(self):
raise Exception()

if __name__ == "__main__":
p = PreExecCallback()

try:
subprocess.Popen(['/bin/echo', 'foobar'], preexec_fn=p)
except subprocess.SubprocessError as e:
if not hasattr(e, 'child_traceback'):
print('BUG: Exception happened in child, but exception object does 
not have child_traceback attribute')

Actual result
-
$ ./preexec-exception.py 
BUG: Exception happened in child, but exception object does not have 
child_traceback attribute

Expected result
---
No output, because child_traceback attribute is present

Additional info
---
I happened to notice this while working with pre-exec callbacks. However, 
according to 
https://stackoverflow.com/questions/38433837/subprocess-child-traceback this 
seems to be the generic problem.

[1] https://docs.python.org/3/library/subprocess.html#exceptions

--
components: Library (Lib)
messages: 302064
nosy: msekletar
priority: normal
severity: normal
status: open
title: Subprocess exceptions re-raised in parent process do not have 
child_traceback attribute
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



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

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
title: test_tools leaks randomly references on x86 Gentoo Refleaks 3.x -> 
test_tools leaks randomly references on x86 Gentoo Refleaks 3.6 and 3.x
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



[issue31429] TLS cipher suite compile time option for downstream

2017-09-13 Thread Charalampos Stratakis

Changes by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2017-09-13 Thread Charalampos Stratakis

Changes by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue30188] test_nntplib: random EOFError in setUpClass()

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

The SSL EOF error is still common, but in the test, not in setUpClass(). 
Example:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/874/steps/test/logs/stdio

==
ERROR: test_with_statement (test.test_nntplib.NetworkedNNTP_SSLTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", 
line 241, in wrapped
meth(self)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", 
line 263, in test_with_statement
with self.NNTP_CLASS(self.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) as 
server:
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/nntplib.py", 
line 1077, in __init__
self.sock = _encrypt_on(self.sock, ssl_context, host)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/nntplib.py", 
line 292, in _encrypt_on
return context.wrap_socket(sock, server_hostname=hostname)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 
407, in wrap_socket
_context=self, _session=session)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 
814, in __init__
self.do_handshake()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 
1068, in do_handshake
self._sslobj.do_handshake()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 
689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:864)

pythininfo:

ssl.HAS_SNI: True
ssl.OPENSSL_VERSION: OpenSSL 1.0.1u-freebsd  22 Sep 2016
ssl.OPENSSL_VERSION_INFO: (1, 0, 1, 21, 15)
ssl.OP_ALL: 0x83ff
ssl.OP_NO_TLSv1_1: 0x1000

--

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

Documentation and implementation are out of sync. Python 3's subprocess module 
no longer sets child_traceback. I checked 3.3 to master. The assignment has 
been removed.

--
nosy: +christian.heimes, gregory.p.smith
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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Martin Panter

Martin Panter added the comment:

I’m not familiar with Windows commands or processes enough, but going by Erik’s 
comment, this sounds similar to Issue 26534 and Issue 30154. Doesn’t your 
“waitfor” command inherit the same parent process’s stdout etc pipes?

--
nosy: +martin.panter

___
Python tracker 

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



[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d165e14e29b45a22450263722f5c2c386c3a748a by Victor Stinner in 
branch 'master':
bpo-31448, test_poplib: Fix ResourceWarning (#3542)
https://github.com/python/cpython/commit/d165e14e29b45a22450263722f5c2c386c3a748a


--

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Leonardo Francalanci

Leonardo Francalanci added the comment:

thank you for your replies!

I used waitfor because it's the simplest and shortest way to have reproducible 
code. The issue I'm having is obviously not with waitfor, but with another exe, 
but this doesn't change the fact that I need a way to exit as soon as the 
called process exits or the timeout ends. I don't care what the called process 
does. I know that the process exited, and the docs for proc.communicate say 
"Wait for process to terminate". Well, the process terminates, but 
"communicate" doesn't exit. It doesn't say "communicate will hang as long as 
the pipes are open".
Plus: the "python.exe" process doesn't actually timeout!!! It just exits (with 
exception, but that's not important), and I would like to get the error from 
stderr! While I can't get it because "communicate" raises an exception...

--

___
Python tracker 

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



[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3537

___
Python tracker 

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



[issue30566] punycode codec raises IndexError in decode_generalized_number()

2017-09-13 Thread Vikram Hegde

Vikram Hegde added the comment:

Could someone please review my PR. It has been in the pending state for over 
three months.

--
nosy: +vikhegde

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Leonardo Francalanci

Leonardo Francalanci added the comment:

(forgot: Issue 26534 is about shell=True, I use shell=False, right?)

--

___
Python tracker 

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



[issue31441] Descriptor example in documentation is confusing, possibly wrong

2017-09-13 Thread R. David Murray

R. David Murray added the comment:

Here is a not-much-more-complicated version that solves the problem.  It is 
probably worth changing as the revised example makes clear the difference 
between self and obj, which is an important distinction.

class RevealAccess(object): 


   
"""A data descriptor that sets and returns values   


   
   normally and prints a message logging their access.  


   
""" 


   



   
def __init__(self, initval=None, name='var'):   


   
self.attrname = '_' + str(random.random())[2:]  



   
self.name = name


   
self.initval = initval  


   



   
def __get__(self, obj, objtype):


   
print('Retrieving', self.name)  


   
return getattr(obj, self.attrname, self.initval)


   



   
def __set__(self, obj, val):

   

[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 769ddb075ac3a840d473930a12a5b72bfbab366f by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
[3.6] bpo-31448, test_poplib: Fix ResourceWarning (GH-3542) (#3543)
https://github.com/python/cpython/commit/769ddb075ac3a840d473930a12a5b72bfbab366f


--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3538

___
Python tracker 

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



[issue31443] Possibly out of date C extension documentation

2017-09-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

On Windows at least: I think "another C module" should be understood as 
"another DLL or executable".

A user extension module is a different DLL from the core Python, so the advice 
is still valid.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread R. David Murray

Changes by R. David Murray :


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



[issue31449] Potential DoS Attack when Parsing Email with Huge Number of MIME Parts

2017-09-13 Thread R. David Murray

R. David Murray added the comment:

10 million mime parts?  That sounds like the kind of thing rfc 1870 was 
designed to address in a more general fashion (ie: the SMTP server should be 
enforcing maximum message size if you are worried about DOS attacks).

1 million = 3 seconds, 10 million = "over three minutes" sounds like a linear 
increase, so I don't see that there is anything special about "mime parts" in 
this scenario.

I have no objection to PRs making the parsing more efficient, though :)

--
nosy: +christian.heimes

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset b157ce1e58b03988ce4340a55d0b856125833cc5 by Victor Stinner in 
branch 'master':
bpo-31234: Fix dangling thread in test_ftplib (#3544)
https://github.com/python/cpython/commit/b157ce1e58b03988ce4340a55d0b856125833cc5


--

___
Python tracker 

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



[issue31451] PYTHONHOME is not absolutized

2017-09-13 Thread Xiang Zhang

New submission from Xiang Zhang:

I find that PYTHONHOME is not absolutized even after VM initialization. So 
sys.prefix will be "usr" if I execute `PYTHONHOME=usr python`.  This could lead 
to libraries like pip to fail if the current directory is changed, such as by 
`os.chdir`.

I am not sure this is a bug.  But I see PYTHONPATH is absolutized in site.py.  
Maybe PYTHONHOME should be too? Or it's by design.

--
messages: 302077
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: PYTHONHOME is not absolutized
type: behavior
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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

test_ssl:

test_recv_zero (test.test_ssl.ThreadedTests) ...  server:  new connection from 
('127.0.0.1', 54502)
 server: connection cipher is now ('ECDHE-RSA-AES256-SHA', 'TLSv1/SSLv3', 256)
 server: selected protocol is now None
Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
2)
Dangling thread: <_MainThread(MainThread, started 4757722688)>
Dangling thread: 
ok

test_socketserver (test.test_ssl.ThreadedTests)
(...)
stopping HTTPS server
joining HTTPS thread
Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
2)
Dangling thread: 
Dangling thread: <_MainThread(MainThread, started 4757722688)>
ok

--

___
Python tracker 

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



[issue31452] asyncio.gather does not cancel tasks if one fails

2017-09-13 Thread Andrew Lytvyn

New submission from Andrew Lytvyn:

If you do not await gather, then if one of gather inner coroutines fails, 
others keep working, but they should not.


```python
import asyncio
import logging

logging.basicConfig(level=logging.DEBUG)

loop = asyncio.get_event_loop()

async def success_coro(seconds):
await asyncio.sleep(seconds)
print(seconds)


async def failed_coro(seconds):
await asyncio.sleep(seconds)
print(seconds)
raise ZeroDivisionError

coros = [
success_coro(2),
failed_coro(3),
success_coro(5),
]

async def waiter():
await asyncio.gather(*coros)

asyncio.ensure_future(waiter())

loop.run_forever()
```
-
Console:
2
3
ERROR:asyncio:Task exception was never retrieved
future:  
exception=ZeroDivisionError()>
Traceback (most recent call last):
  File "tst.py", line 73, in waiter
await asyncio.gather(*coros)
  File "tst.py", line 64, in failed_coro
raise ZeroDivisionError
ZeroDivisionError
5
-

Expected behavior that 5 should not be printed.

--
components: asyncio
messages: 302079
nosy: Andrew Lytvyn, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.gather does not cancel tasks if one fails
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



[issue31438] IDLE 3 crashes and quits when caret character typed

2017-09-13 Thread ALPER PAKSOY

ALPER PAKSOY added the comment:

I downloaded and installed TCL 8.6.6.8606 and restarted my computer. I verified 
that the new version was installed. Unfortunately the problem has not been 
solved. Thank you.

Alper

--

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Alex Gaynor

Alex Gaynor added the comment:

What operating system are you on?

--
nosy: +Alex Gaynor

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Adrian Vollmer

New submission from Adrian Vollmer:

According to the documentation 
(https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLS), using 
ssl_version = ssl.PROTOCOL_TLS in a server socket should offer all TLS/SSL 
versions. However, it only offers TLSv1_2.

I attached a proof of concept.


$ python3 poc.py
3.5.4 (default, Aug 12 2017, 14:08:14)
[GCC 7.1.0]
OpenSSL 1.1.0f  25 May 2017
[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:719)
[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:719)
b'test\n'

$ python2 poc.py
2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118]
OpenSSL 1.1.0f  25 May 2017
[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:661)
[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:661)
test


To connect with s_client:

 $ for i in {tls1,tls1_1,tls1_2} ; do echo test | openssl s_client -connect 
localhost: -CAfile server.pem -quiet -$i ; done
140164347663616:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert 
protocol version:../ssl/record/rec_layer_s3.c:1399:SSL alert number 70
139926441944320:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert 
protocol version:../ssl/record/rec_layer_s3.c:1399:SSL alert number 70
depth=0 C = AU, ST = Some-State, O = Internet Widgits Pty Ltd
verify return:1
read:errno=0

--
assignee: christian.heimes
components: SSL
files: poc.py
messages: 302081
nosy: adrianv, christian.heimes
priority: normal
severity: normal
status: open
title: ssl.PROTOCOL_TLS only select TLSv1.2
type: behavior
versions: Python 2.7, Python 3.5
Added file: https://bugs.python.org/file47139/poc.py

___
Python tracker 

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



[issue31454] Include "import as" in documentation

2017-09-13 Thread Steve Johnson

New submission from Steve Johnson:

I was wondering if you could do something like fiblib = import fibo or import 
fibo as fiblib, and low and behold, the "as" variant worked. I find this very 
useful, and thought it should be part of your documentation on "import"

--
assignee: docs@python
components: Documentation
messages: 302083
nosy: docs@python, svenyonson
priority: normal
severity: normal
status: open
title: Include "import as" in documentation
type: enhancement
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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Adrian Vollmer

Adrian Vollmer added the comment:

Debian buster/sid

--

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

Debian Buster has patched OpenSSL to disable TLS 1.0 and 1.1 by default, 
https://lists.debian.org/debian-devel-announce/2017/08/msg4.html

--

___
Python tracker 

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3539

___
Python tracker 

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



[issue31448] test_poplib started to log a lot of ResourceWarning warnings on AMD64 Windows8.1 Refleaks 3.x

2017-09-13 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Adrian Vollmer

Adrian Vollmer added the comment:

I read about that, but I don't understand. If I use openssl s_server -port  
 , I can connect using either one of the three protocols.

Even if that's the new default, is there no way now to get python on Buster/Sid 
to use OpenSSL in a non-default mode and have it offer all three versions?

--

___
Python tracker 

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

I would like to share a short story with you.

I'm working on fixing *all* bugs on our 3 CI (buildbots, Travis CI, AppVeyor). 
I fixed almost all random test failures.

Right now, I'm trying to fix all "dangling thread" warnings: bpo-31234.

I was sure that I was done, but no, test_ssl failed on Travis CI and AppVeyor. 
Hum. The failure doesn't make sense. The code is perfectly fine. The thread is 
supposed to be gone for a long time, but not, it's still here for some reason.

After one day of debugging, I found that the thread is kept alive by a variable 
of a frame. The frame is kept alive from an traceback object of an Exception. 
The exception is ConnectionRefusedError. I continue to follow links, I see that 
the exception comes from socket.create_connection()... Interesting.

socket.create_connection() tries to be nice and keeps the last exception to 
re-raise it if no connection succeed.

The code seems correct: it stores the exception in the variable "err", and 
"return sock" is used to exit on succeed.

*But*.

It seems like the exception stored in "err" is part of a reference cycle, so 
indirectly, a lot of frames are kept alive because of this cycle.

So, I wanted to share this story with you because test_ssl only started to fail 
recently. The reason is that support.HOST was modified from "127.0.0.1" to 
"localhost". So if the name resolution first returns an IPv6 address, we may 
get the ConnectionRefusedError error, stored in "err", and then the connection 
succeed with IPv4... but you get the reference cycle mess.

Modifying support.HOST to "localhost" triggered a reference cycle!? Strange 
story.

I'm working on a quick fix: https://github.com/python/cpython/pull/3546

--
nosy: +haypo

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

You have to enable the protocols by applying a reverse bitmask to 
SSLContext.options:

ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
ctx.load_cert_chain('server.pem')
ctx.options &= ~(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)

sslsock = ctx.wrap_socket(s, server_side=True)

--

___
Python tracker 

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



[issue29757] The loop in utility `socket.create_connection()` swallows previous errors

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:

I'm not excited to keep multiple exception objects alive because the 
Exception.__traceback__ causes many hairy reference cycle issues.

I just found an old bug in socket.create_connection():
https://github.com/python/cpython/pull/3546

See https://bugs.python.org/issue29639#msg302087 for my story of the bug.

--

___
Python tracker 

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-09-13 Thread Gregory P. Smith

Gregory P. Smith added the comment:

LOL. That is a very strange story and the last thing i'd have expected to fall 
out from changing one string to another. :)

--

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Adrian Vollmer

Adrian Vollmer added the comment:

Doesn't seem to do anything:

>>> ctx.options
2181170175L
>>> ctx.options & ~(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)
2181170175L

--

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

Please report this issue to the Debian maintainers. I don't know how Debian has 
disabled TLS 1.0 and TLS 1.1 for the SSL_METHOD *TLS_method(void). It might not 
be possible to enable auto-negotiation for old protocols at all.

--

___
Python tracker 

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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Adrian Vollmer

Adrian Vollmer added the comment:

Okay, thanks for your time!

--

___
Python tracker 

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



[issue31454] Include "import as" in documentation

2017-09-13 Thread R. David Murray

R. David Murray added the comment:

Where do you find that it is not documented that you would expect it to be?  
Because 'import' 'as' is certainly documented.

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



[issue31439] WindowsError: [Error 2] The system cannot find the file specified

2017-09-13 Thread Zachary Ware

New submission from Zachary Ware:

In the absence of a description of your issue, there's nothing we can do with 
just the generic exception in the title so I'm closing the issue.  If you can 
provide a real description of what went wrong for you, you may reopen the issue.

--
resolution:  -> not a bug
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



[issue31453] ssl.PROTOCOL_TLS only select TLSv1.2

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

Ah, here we go: 
https://anonscm.debian.org/viewvc/pkg-openssl/openssl/branches/1.1.0/debian/patches/tls1_2_default.patch

Debian patched the default for SSL_CTX_set_min_proto_version(). The 
SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version() API calls 
are OpenSSL 1.1.0-only and not available from Python. It is not possible to 
override the minimum version from Python.

--

___
Python tracker 

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



[issue31453] Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS

2017-09-13 Thread Christian Heimes

Changes by Christian Heimes :


--
title: ssl.PROTOCOL_TLS only select TLSv1.2 -> Debian Sid/Buster: Cannot enable 
TLS 1.0/1.1 with PROTOCOL_TLS

___
Python tracker 

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



[issue31453] Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS

2017-09-13 Thread Christian Heimes

Changes by Christian Heimes :


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



[issue31453] Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS

2017-09-13 Thread Adrian Vollmer

Adrian Vollmer added the comment:

I have a workaround for now:

versions = [ssl.PROTOCOL_TLSv1,
ssl.PROTOCOL_TLSv1_1,
ssl.PROTOCOL_TLSv1_2,
   ]
firstbytes = s.recv(16, socket.MSG_PEEK)
ss = ssl.wrap_socket(
s,
server_side=True,
certfile="server.pem",
keyfile="server.pem",
#  ssl_version=versions[ord(firstbytes[10])-1] # python2
ssl_version=versions[firstbytes[10]-1]
)

How much of an ugly hack is this? :)

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



[issue31234] Make support.threading_cleanup() stricter

2017-09-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset acb9fa79fa6453c2bbe3ccfc9cad2837feb90093 by Victor Stinner in 
branch 'master':
bpo-31234, socket.create_connection(): Fix ref cycle (#3546)
https://github.com/python/cpython/commit/acb9fa79fa6453c2bbe3ccfc9cad2837feb90093


--

___
Python tracker 

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



[issue31453] Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

Matthias, this issue affects Debian and probably Ubuntu, too. Could you please 
discuss it with Debian maintainers and propose a workaround? Python does not 
expose the new OpenSSL 1.1.0 SSL_CTX_set_min_proto_version() and 
SSL_CTX_set_max_proto_version() calls. We only support SSL_CTX_set_options() 
with SSL_OP_NO_TLSv1 and SSL_OP_NO_TLSv1_1.

--
assignee: christian.heimes -> 
nosy: +doko
versions: +Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



[issue31453] Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS

2017-09-13 Thread Christian Heimes

Christian Heimes added the comment:

It's an ugly hack and not a long term solution. The PROTOCOL_TLSv* constants 
and ssl.wrap_socket() are discouraged and will be removed soon.

--

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
keywords: +patch
pull_requests: +3540
stage: backport needed -> patch review

___
Python tracker 

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



[issue30442] Skip test_xml_etree under coverage

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
keywords: +patch
pull_requests: +3541
stage: backport needed -> patch review

___
Python tracker 

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



[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Stefan Behnel

New submission from Stefan Behnel:

The "XMLParser.__init__()" method in "_elementtree.c" contains this code:

self->handle_start = PyObject_GetAttrString(target, "start");
self->handle_data = PyObject_GetAttrString(target, "data");
self->handle_end = PyObject_GetAttrString(target, "end");
self->handle_comment = PyObject_GetAttrString(target, "comment");
self->handle_pi = PyObject_GetAttrString(target, "pi");
self->handle_close = PyObject_GetAttrString(target, "close");
self->handle_doctype = PyObject_GetAttrString(target, "doctype");
PyErr_Clear();

This ignores all exceptions, not only AttributeError.
It also passes live exceptions into the later lookup calls, which may execute 
arbitrary user code.

--
components: Extension Modules
messages: 302101
nosy: scoder
priority: normal
severity: normal
status: open
title: ElementTree.XMLParser() mishandles exceptions
type: behavior
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



[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Stefan Behnel

Changes by Stefan Behnel :


--
keywords: +patch
pull_requests: +3542
stage:  -> patch review

___
Python tracker 

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



[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +eli.bendersky, haypo, serhiy.storchaka
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



[issue31454] Include "import as" in documentation

2017-09-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

import as is documented, so I'm closing this unless you have other concerns.

Python 3 docs: https://docs.python.org/3/reference/simple_stmts.html#import
```
If the module name is followed by as, then the name following as is bound 
directly to the imported module
```

Wording is somewhat different in Python 2.7 docs, but it's there: 
https://docs.python.org/2.7/reference/simple_stmts.html#the-import-statement

Thanks.

--
nosy: +Mariatta
resolution:  -> not a bug
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



[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I see many other issues with C implementation of ElementTree.

1. If XMLParser.__init__ is called twice, it leaks references and the Expat 
parser.

Possible solution: use the Py_XSETREF() macro instead of simple assignment. The 
Expat parser needs special handling.

Other possible solution: drop __init__() and make all initialization in 
__new__(). But this is a solution only for 3.7 because can break compatibility.

2. If XMLParser.__init__ is not called or if it fails to initialize the Expat 
parser, self->entity and self->target are NULL. Later in xmlparser_getattro() 
they are increfed unconditionally.

--

___
Python tracker 

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



[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Since _PyDict_GetItem_KnownHash() may or may not set an exception, we have to 
> check for a live exception after calling it, and that finds the old exception 
> of the last attribute lookup and decides that its own lookup failed.

Hmm, with PyDict_GetItem() we don't falsely detect a lookup failing with a live 
exception set. Is it correct to call _PyType_Lookup() with an exception set? 
Perhaps we should save a current exception before calling find_name_in_mro() 
and restore it after. Or raise SystemError if an exception set. Or just add 
assert(!PyErr_Occurred()) at the begin of find_name_in_mro(). I don't know what 
is more correct.

--

___
Python tracker 

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



[issue31456] SimpleCookie fails to parse any cookie if an entry has whitespace in the name

2017-09-13 Thread Adam Davis

New submission from Adam Davis:

```>>> from http.cookies import SimpleCookie
>>> cookie_string = "ASDF=stuff; ASDF space=more stuff"
>>> cookie = SimpleCookie()
>>> cookie.load(cookie_string)
>>> cookie.items()
dict_items([])
>>> cookie_string = "ASDF=stuff"
>>> cookie.load(cookie_string)
>>> cookie.items()
dict_items([('ASDF', )])```

cookie.load should throw an error, or at least parse the cookies it can parse.

--
components: Library (Lib)
messages: 302105
nosy: Adam Davis
priority: normal
severity: normal
status: open
title: SimpleCookie fails to parse any cookie if an entry has whitespace in the 
name
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



  1   2   >