[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

Donald, !3DES de-selects all 3DES block ciphers suites.

--

___
Python tracker 

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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

GPS, sure it is simple enough under Linux. But what about other operating 
systems? OPENSSL_ia32cap_loc() works under Windows, too.

Antoine, AES-GCM is still faster and performs better than ChaCha20 Poly1305. 
NSS and Mozilla's recommended cipher suite list prefers AES-GCM over ChaCha20, 
too. https://wiki.mozilla.org/Security/Server_Side_TLS

It's reasonable and simple to provide the best cipher suite that matches the 
systems' capabilities. As Alex stated, performance is security.

To provide the CPU capabilities to the ssl module and 3rd party authors (e.g. 
Cory asked on behalf of requests), let's keep ssl._ia32cap() a private function 
and just add two constants: HAVE_AESNI = True/False/None, HAVE_PCLMULQDQ = 
True/False/None (None: ia32cap is not available on the system). Is that ok with 
you?

--

___
Python tracker 

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



[issue27852] itertools -> flatten_all()

2016-08-25 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
components: +Documentation
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue25847] CPython not using Visual Studio code analysis!

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

+1, if somebody is able to find time. Coverity Scan checks only X86_64 Linux 
builds.

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-08-25 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The constants would have to be private, too. We really don't want to encourage 
other users to rely on them.

--

___
Python tracker 

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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

Why? Other libraries like requests like to use the information, too.

--

___
Python tracker 

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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

If we wanted to expose such information, we would need to do it in a dedicated 
module (or in `os`) and provide something that doesn't restrict itself to two 
particular x86 flags.

requests can rely on a private attribute if they really want to.

--

___
Python tracker 

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



[issue27833] Process is locked when try to execute Queue.put() inside

2016-08-25 Thread Guni

Guni added the comment:

Hi Eric,

The reason why I still think is a actually bug is because the behaviour is not 
consistent. When we write code we don't exactly know how much data we will put 
in the queue.

If this ticket is consider as not an actual bug it means that everybody has to 
make a check inside the process in order to predict what behaviour will happen.

Feel free to close the ticket if you think that's a feature not a bug.

Thanks

--
status: closed -> open

___
Python tracker 

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



[issue27833] Process is locked when try to execute Queue.put() inside

2016-08-25 Thread Xiang Zhang

Xiang Zhang added the comment:

Guni, the behaviour is not consistent since your code is not that 'right'. You 
can not expect a not 'right' snippet to behave correctly. You can do what the 
programming guide says:

[1] consuming all items before join
[2] call q.cancel_join_thread
[3] ignore prs1.join since it will be automatically joined

Choose one and then the behaviour would be consistent.

--

___
Python tracker 

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



[issue27838] test_os.test_chown() random failure on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2016-08-25 Thread koobs

koobs added the comment:

This appears to have spontaneously resolved itself after build #957 after many 
failures. For reference, other builders on the same host were failing as well:

AMD64 FreeBSD CURRENT Debug 3.5 (#567, #568)
AMD64 FreeBSD CURRENT Non-Debug 3.5 (#8, #9)

And possibly others (Didn't listed any that hadn't failed in the last 5 builds)

According to my (non-expert) reading of the code, the test skips (or is 
supposed to skip) unless group count of uid is > 1.

The group membership of the buildbot user this worker runs as is only 
'buildbot' and on that basis wouldn't a skip expected?

Open questions are:

1) Why/how did it suddenly *start* failing. (I cant see any relevant commits at 
or around the time)
2) Why/how did it suddenly stop failing (I made no worker/buildbot changes

Nosy vajrasky (original unit test creator) and Claudiu (who reviewed), who 
might be able to shine a light on what might be going on

--
nosy: +Claudiu.Popa, vajrasky

___
Python tracker 

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



[issue27838] test_os.test_chown() random failure on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

Hum, the test has a fail ratio somewhere near 1/5. It fails for 6 months,
maybe longer.

--

___
Python tracker 

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



[issue27846] Base64 expansion factor is 4 to 3, not 6 to 4

2016-08-25 Thread Jens Jørgen Mortensen

Jens Jørgen Mortensen added the comment:

That would also be a solution.  Also, the sentence is not quite grammatically 
correct: "when space [is] expensive".

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



[issue27846] Base64 expansion factor is 4 to 3, not 6 to 4

2016-08-25 Thread Jens Jørgen Mortensen

Changes by Jens Jørgen Mortensen :


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



[issue27858] Add identity function to functools

2016-08-25 Thread Jáchym Barvínek

New submission from Jáchym Barvínek:

An identity function is sometimes useful in functional-style programming as a 
dummy or default value.

For example, we can sometimes see a pattern like this (e.g. in 
itertools.groupby):

def f(params, key=None):
  if key is None:
key = lambda x: x
  ...


However, if we had a canonical itentity function:

def identity(x):
  return x

we could instead write:

def f(params, key=identity):
  ...

and the intended use of the function f and it's functioning would be more 
obvious simply from it's signature, while also saving a little code. 

As zen of Python says: Explicit is better than implicit.

Of course, we can now write:

def f(params, key=lambda x: x):
  ...

but the reason why is not used is probably that it feels a bit awkward to more 
people than just me.

--
components: Library (Lib)
messages: 273643
nosy: Jáchym Barvínek
priority: normal
severity: normal
status: open
title: Add identity function to functools
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-25 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I had a work mate make this exact same point literally yesterday. He asked me 
if Python had an identity function, and when I suggested just using `lambda x: 
x` he grouched that this wasn't sufficiently obvious enough as "identity" is 
self-explanatory.

(Perhaps for English speakers with a background in mathematics or functional 
programming.)

I'm not really convinced. Its easier to just write a lambda than to `from 
functools import identity`, and despite what my workmate thinks, "identity" is 
not self-evident. Consider that identity could also be a function that returns 
a person's identifying information. Think about the English usage of "identity 
theft" and "secret identity", rather than the mathematical meaning.

So I'm at best +0 on this suggestion.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-25 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Just in case anyone else thinks this is a good idea, here's a patch.

--
keywords: +patch
Added file: https://bugs.python.org/file44218/identity.patch

___
Python tracker 

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



[issue27855] 2to3: Wrong code output w/ has_key

2016-08-25 Thread R. David Murray

R. David Murray added the comment:

I don't think it is necessary or reasonable to expect 2to3 to handle this.  It 
is a tool for the developer to use, so just clean up the input.

--
nosy: +r.david.murray
resolution:  -> rejected
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



[issue27855] 2to3: Wrong code output w/ has_key without trailing space

2016-08-25 Thread R. David Murray

Changes by R. David Murray :


--
title: 2to3: Wrong code output w/ has_key -> 2to3: Wrong code output w/ has_key 
without trailing space

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-25 Thread Jáchym Barvínek

Jáchym Barvínek added the comment:

Java offers an identity function:
https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html

2016-08-25 14:10 GMT+02:00 Steven D'Aprano :

>
> Steven D'Aprano added the comment:
>
> Just in case anyone else thinks this is a good idea, here's a patch.
>
> --
> keywords: +patch
> Added file: https://bugs.python.org/file44218/identity.patch
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-25 Thread R. David Murray

R. David Murray added the comment:

I agree with Steven, I don't think this is really worth it, but I wouldn't vote 
-1.  I suspect it won't get added, though, since a function I do want ('first') 
got rejected :)

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



[issue23746] sysconfg.is_python_build() is buggy

2016-08-25 Thread Vinay Sajip

Vinay Sajip added the comment:

It's not *only* used in test - it's also used in third party libraries. For 
example, it's used in distlib (which is vendored by pip) to determine whether 
it's being run from a source build.

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue23105] os.O_SHLOCK and os.O_EXLOCK are not available on Linux

2016-08-25 Thread Vinay Sajip

Vinay Sajip added the comment:

The existing docs have a section "These constants are GNU extensions and not 
present if they are not defined by the C library."

There could be a corresponding section for BSD extensions to which O_EXLOCK and 
O_SHLOCK are moved, or the word "GNU" can removed from the existing section and 
these two flags moved to it. How does that sound? My preference would be for 
the latter.

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue1100942] Add datetime.time.strptime and datetime.date.strptime

2016-08-25 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue23746] sysconfg.is_python_build() is buggy

2016-08-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bf51f1f3569a by Vinay Sajip in branch '3.5':
Issue #23746: Clarified is_python_build() documentation.
https://hg.python.org/cpython/rev/bf51f1f3569a

New changeset a0a7c5b1af97 by Vinay Sajip in branch 'default':
Closes #23746: merged update from 3.5.
https://hg.python.org/cpython/rev/a0a7c5b1af97

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

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: https://bugs.python.org/file44220/fix_newlines_1.patch

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: https://bugs.python.org/file44221/test_random_warning_1.patch

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Emanuel Barry

Emanuel Barry added the comment:

Here are three patches for this:

- add_gitattributes_1.patch adds `.gitattributes`, with all the newline 
preferences in `.hgeol` (with the exception of the "native" rule at the end, 
which in git is the default newline preference).
- fix_newlines_1.patch fixes test_sax to properly handle CRLF (since *.xml 
files may have either LF or CRLF), as well as a single batch file which wasn't 
using CRLF line endings for some reason.
- test_random_warning_1.patch is somewhat unrelated, but it makes sure that 
failures in the `pickle.load` call no longer show ResourceWarnings on stderr.

The two tests which used to fail no longer do so. Maybe 
add_gitattributes_1.patch should be backported to 2.7, but probably not the 
other ones.

--
keywords: +patch
stage:  -> patch review
versions:  -Python 3.5
Added file: https://bugs.python.org/file44219/add_gitattributes_1.patch

___
Python tracker 

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



[issue25847] CPython not using Visual Studio code analysis!

2016-08-25 Thread Steve Dower

Steve Dower added the comment:

Does it only check built code? I thought it would statically analyze 
everything? Is MS_WINDOWS code excluded, because that would explain why it 
"misses" issues.

--

___
Python tracker 

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



[issue27859] argparse - subparsers does not retain namespace

2016-08-25 Thread Nick Papior

New submission from Nick Papior:

Using argparse does not retain the Namespace variable across sub-parsers.

This prohibits customization of Actions due to "upper" level arguments not 
being stored in the namespace passed to the sub-parsers.

Hence, one may not create different sub-parsers which depend on an upper level 
flag.

The reason is the subparser command:
subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)

Which by default passes `None` as the namespace argument.

A simple patch would be to copy the original namespace, which may then be 
altered. And subsequently restored, based on changes to that namespace.

--
components: Library (Lib)
files: argparse_subspacenamespace.py
messages: 273654
nosy: Nick Papior
priority: normal
severity: normal
status: open
title: argparse - subparsers does not retain namespace
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file44222/argparse_subspacenamespace.py

___
Python tracker 

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



[issue27860] Improvements to ipaddress module

2016-08-25 Thread Moritz Sichert

New submission from Moritz Sichert:

This patch fixes the following minor issues with the ipaddress module:

- Removed unused property _BaseV4._valid_mask_octets
- Removed unused methods _BaseV4._is_valid_netmask() and _BaseV4._is_hostmask()
- Replaced several calls to superclass constructors by super()

It also refactors the constructors of IPv4Network, IPv4Interface, IPv6Network, 
and IPv6Interface.
They all now use the new method _get_addr_prefix_tuple() to parse the argument. 
It now matches the following sentence of the documentation of IPv4/6Interface:
"The meaning of address is as in the constructor of IPv4Network".

Additionally they now also accept a bytes or an IPv4/6Address object 
representing a netmask (or a hostmask [only IPv4]) as second element of an 
address/netmask tuple. This makes it easier to work with C-APIs that provide 
netmasks only as bytes object.

This patch does not try to solve issue 27683.

--
components: Library (Lib)
files: ipaddress-improvement.patch
keywords: patch
messages: 273655
nosy: moritzs
priority: normal
severity: normal
status: open
title: Improvements to ipaddress module
type: enhancement
versions: Python 3.6
Added file: https://bugs.python.org/file44223/ipaddress-improvement.patch

___
Python tracker 

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



[issue26638] Avoid warnings about missing CLI options when building documentation

2016-08-25 Thread Zachary Ware

Zachary Ware added the comment:

The syntax is ` install ""`, so in this case 
'pip install "Sphinx==1.3.6"` (or `pip install "Sphinx<1.4"`) should do it for 
you.  That ought to also take care of downgrading any other packages that need 
it (though I don't think there are any), or at least tell you which ones should 
be downgraded and to what.

I'm not sure why there are both `pip list` and `pip freeze`, but `pip freeze` 
is the one that outputs usable syntax for a requirement specifier.

--

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Emanuel Barry

Emanuel Barry added the comment:

Whoops, turns out I was using the wrong approach for binary files. Here come 
add_gitattributes_2.patch and fix_newlines_2.patch (thanks Zachary for pointing 
this out).

--
Added file: https://bugs.python.org/file44224/add_gitattributes_2.patch

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: https://bugs.python.org/file44225/fix_newlines_2.patch

___
Python tracker 

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



[issue25847] CPython not using Visual Studio code analysis!

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

Coverity Scan has two steps. In the first step the code is compiled with the 
coverity tool chain. It's a wrapper around the preprocessor and compiler. Next 
up the result is uploaded and analyzed by a service.

So yes, the project needs to be build before it can be analyzed.

--

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-25 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> crash
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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-25 Thread tehybel

New submission from tehybel:

The first issue is a type confusion which resides in the sqlite3 module, in the
file connection.c. The function pysqlite_connection_cursor takes an optional
argument, a factory callable:

if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist,
 &factory)) {
return NULL;
}

If the factory callable is given, it is called to initialize a cursor:

cursor = PyObject_CallFunction(factory, "O", self);

After this the cursor, which is a PyObject *, is cast directly to a
pysqlite_Cursor without performing any type checking:

if (cursor && self->row_factory != Py_None) {
Py_INCREF(self->row_factory);
Py_XSETREF(((pysqlite_Cursor *)cursor)->row_factory, self->row_factory);
}

Here is a small script which is tested on Python-3.5.2, 64-bit, with
--with-pydebug enabled:

--- begin script ---

import sqlite3

conn = sqlite3.connect('poc2.db')
conn.row_factory = 12
conn.cursor(lambda x: "A"*0x1)

--- end script ---


When run, this produces a segfault:

(gdb) r ./poc2.py

Program received signal SIGSEGV, Segmentation fault.
0x76496ad8 in pysqlite_connection_cursor (self=0x768cc370, 
args=, kwargs=)
at /home/xx/Python-3.5.2/Modules/_sqlite/connection.c:322
warning: Source file is more recent than executable.
322 Py_XSETREF(((pysqlite_Cursor *)cursor)->row_factory, 
self->row_factory);
(gdb) p cursor
$13 = (PyObject *) 0xa46b90
(gdb) p self->row_factory
$14 = (PyObject *) 0x8d05f0 
(gdb) x/3i $pc
=> 0x76496ad8 : movrax,QWORD PTR 
[rdi+0x10]
   0x76496adc : subrax,0x1
   0x76496ae0 : movQWORD PTR 
[rdi+0x10],rax
(gdb) p $rdi
$15 = 0x4141414141414141

An arbitrary word in memory is decremented.


--


The second issue exists in the function pysqlite_connection_set_isolation_level
which resides in /Modules/_sqlite/connection.c. It can result in memory getting
freed multiple times.

The problem is that the variable self->isolation_level is not cleared before
being DECREF'd.

The code looks like this:

static int pysqlite_connection_set_isolation_level(pysqlite_Connection* 
self, PyObject* isolation_level)
{
...
Py_XDECREF(self->isolation_level);
...
}

This call to Py_XDECREF can trigger an arbitrary amount of python code, e.g. via
self->isolation_level's __del__ method. That code could then call 
pysqlite_connection_set_isolation_level again, which would trigger another
Py_XDECREF call on the same self->isolation_level, which can thus be freed an
arbitrary number of times.

One way to fix this is to use Py_CLEAR instead.

Here's a proof-of-concept script which results in a segfault here:

--- begin script ---

import sqlite3

class S(str):
def __del__(self):
conn.isolation_level = S("B")

conn = sqlite3.connect('poc6.db')
conn.isolation_level = S("A")
conn.isolation_level = ""

--- end script ---

When run it segfaults here, with Python-3.5.2 and --with-pydebug enabled:

(gdb) r ./poc6.py
Starting program: /home/xx/Python-3.5.2/python ./poc6.py

Program received signal SIGSEGV, Segmentation fault.
_Py_ForgetReference (op=op@entry=0x76d81b80) at Objects/object.c:1757
1757if (op == &refchain ||
(gdb) bt
#0  _Py_ForgetReference (op=op@entry=0x76d81b80) at Objects/object.c:1757
#1  0x0049f8c0 in _Py_Dealloc (op=0x76d81b80) at 
Objects/object.c:1785
#2  0x0046ced8 in method_dealloc (im=im@entry=0x77f25de8) at 
Objects/classobject.c:198
#3  0x0049f8c5 in _Py_Dealloc (op=op@entry=0x77f25de8) at 
Objects/object.c:1786
...

--
components: Extension Modules
messages: 273659
nosy: ghaering, tehybel
priority: normal
severity: normal
status: open
title: sqlite3 type confusion and multiple frees
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue27862] Make urllib.parse runnable as a script

2016-08-25 Thread EungJun Yi

New submission from EungJun Yi:

It would be nice if urllib.prase runnable as a script so I can easily parse 
urls in command line or shell script.

I have attached a patch.

--
components: Library (Lib)
files: 0001-Make-urllib.parse-runnable-as-a-script.patch
keywords: patch
messages: 273660
nosy: EungJun.Yi
priority: normal
severity: normal
status: open
title: Make urllib.parse runnable as a script
type: enhancement
versions: Python 3.5
Added file: 
https://bugs.python.org/file44226/0001-Make-urllib.parse-runnable-as-a-script.patch

___
Python tracker 

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



[issue27862] Make urllib.parse runnable as a script

2016-08-25 Thread SilentGhost

SilentGhost added the comment:

Guido doesn't like the idea in general[0].

[0] https://bugs.python.org/issue26488#msg273329

--
nosy: +SilentGhost
resolution:  -> rejected
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



[issue27860] Improvements to ipaddress module

2016-08-25 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +pmoody
stage:  -> patch review

___
Python tracker 

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



[issue27859] argparse - subparsers does not retain namespace

2016-08-25 Thread SilentGhost

Changes by SilentGhost :


--
stage:  -> needs patch
versions:  -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-25 Thread tehybel

New submission from tehybel:

I'll describe 7 issues in the /Modules/_elementtree.c module here. They
include multiple use-after-frees, type confusions and instances of
out-of-bounds array indexing.



Issue 1: use-after-free in element_get_text

The problematic code looks like this:

LOCAL(PyObject*)
element_get_text(ElementObject* self)
{ 
/* return borrowed reference to text attribute */

PyObject* res = self->text;

if (JOIN_GET(res)) { 
res = JOIN_OBJ(res);
if (PyList_CheckExact(res)) {
res = list_join(res);
if (!res)
return NULL;
self->text = res;
}
}

return res;
}

As we can see, if res is a list, we call list_join with res, which is
self->text. list_join will decrease self->text's reference count. When that
happens, arbitrary python code can run. If that code uses self->text, a
use-after-free occurs.

PoC (Proof-of-Concept segfaulting script):

---

import _elementtree as et

class X(str):
def __del__(self):
print(elem.text)

b = et.TreeBuilder()
b.start("test")
b.data(["", X("")])
b.start("test2")

elem = b.close()
print(elem.text)

---


Issue 2: use-after-free in element_get_tail

The same type of issue also exists in element_get_tail and should be fixed
there, too.



Issue 3: type confusion in elementiter_next

The function elementiter_next iterates over a tree consisting of elements.
Each element has an array of children. 

Before doing any casts, most of the elementtree code is careful to check that
these children are, indeed, elements; that is, that their type is correct. The
problem is that elementiter_next does not validate these child objects before
performing a cast. Here is the relevant line:

elem = (ElementObject *)cur_parent->extra->children[child_index];

If the child is not an element, a type confusion occurs. Here's a PoC:

-

import _elementtree as et

state = {
"tag": "tag",
"_children": [1,2,3],
"attrib": "attr",
"tail": "tail",
"text": "text",
}

e = et.Element("ttt")
e.__setstate__(state)

for x in e.iter():
print(x)

-



Issue 4: array-out-of-bounds indexing in element_subscr

This issue occurs when taking the subscript of an element. This is done using
the element_subscr function. The function calls PySlice_GetIndicesEx:

if (PySlice_GetIndicesEx(item,
self->extra->length,
&start, &stop, &step, &slicelen) < 0) {
return NULL; 
}

The problem is that to evaluate the indices, PySlice_GetIndicesEx might call
back into python code. That code might cause the element's self->extra->length
to change. If this happens, the variables "start", "stop" and "step" might no
longer be appropriate.

The code then uses these variables for array indexing:

for (cur = start, i = 0; i < slicelen;
 cur += step, i++) {
PyObject* item = self->extra->children[cur]; 
...
}

But this could go out of bounds and interpret arbitrary memory as a PyObject.
Here's a PoC that reproduces this:

---

import _elementtree as et

class X:
def __index__(self):
e[:] = []
return 1

e = et.Element("elem")
for _ in range(10):
e.insert(0, et.Element("child"))

print(e[0:10:X()])

---

Running it results in a segfault:

(gdb) r ./poc14.py
Starting program: /home/xx/Python-3.5.2/python ./poc14.py

Program received signal SIGSEGV, Segmentation fault.
0x0049f933 in PyObject_Repr (v=0x768af058) at Objects/object.c:471
471 if (Py_TYPE(v)->tp_repr == NULL)
(gdb) print *v
$37 = {_ob_next = 0xdbdbdbdbdbdbdbdb, _ob_prev = 0xdbdbdbdbdbdbdbdb, ob_refcnt 
= 0xdbdbdbdbdbdbdbdc,
  ob_type = 0xdbdbdbdbdbdbdbdb}

As we can see, "v" is freed memory with arbitrary contents.



Issue 5: array-out-of-bounds indexing in element_ass_subscr

A separate issue of the same type, also due to a call to PySlice_GetIndicesEx,
exists in element_ass_subscr. Here's a proof-of-concept script for that:

---

import _elementtree as et

class X:
def __index__(self):
e[:] = []
return 1

e = et.Element("elem")
for _ in range(10):
e.insert(0, et.Element("child"))

e[0:10:X()] = []

---

To fix these, I believe we could check whether self->extra->length changed
after calling PySlice_GetIndicesEx, and bail out if so. (You can grep the
codebase for "changed size during iteration" for examples of some similarish
cases.)





Issue 6: use-after-free in treebuilder_handle_start

In the function treebuilder_handle_start we see these lines:

if (treebuilder_set_element_text(self->last, self->data))
return NULL;

Here self->last is the most recent element, and we are setting its text to
self->data. This assignment happens via the function
treebuilder_set_element_text which in turn calls
treebuilder_set_element_text_or_tail. There, if the element self->last is not
an exact instance of Element

[issue27858] Add identity function to functools

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I believe this has been previously discussed and declined.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-25 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +eli.bendersky, scoder
type:  -> behavior

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report tehybel.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

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



[issue27860] Improvements to ipaddress module

2016-08-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +ncoghlan, serhiy.storchaka

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-08-25 Thread Jim Jewett

Jim Jewett added the comment:

What does overriding to put it back require?

Does it require a re-compile, or can it be done via a config file?

Taking it out of the default set sounds reasonable, but requiring a recompile 
for people who want to retain backwards compatibility strikes me as too much, 
particularly for a maintenance release.

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-08-25 Thread Donald Stufft

Donald Stufft added the comment:

It's not a recompile but it's not a configuration file either, it's a Python 
level API you can call when you're creating a connection to specify what 
ciphers you want to allow for that connection.

--

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See issue1673203, issue11011.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-25 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-25 Thread Jim Jewett

Jim Jewett added the comment:

I think if the test is ensuring one line-ending type, then there should be 
another test ensuring the other... but I think it would be best if there were a 
single test file that had both types of line-endings, just to ensure that the 
code doesn't cheat by reading only the first line and assuming that the rest of 
the data is consistent.

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue27852] itertools -> flatten_all()

2016-08-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In proposed implementation str and bytes are not flattened. What about 
bytearray? array.array? memoryview? For different tasks they can be considered 
atomic or as collections. There are such much task specific details and the 
implementation is such simple, that I think there is no need add this function 
in itertools. And due to this details it may be not worth to add it as a recipe.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27846] Base64 expansion factor is 4 to 3, not 6 to 4

2016-08-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +pitrou

___
Python tracker 

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



[issue27846] Base64 expansion factor is 4 to 3, not 6 to 4

2016-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Agreed with David.

--

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

Jim, https://docs.python.org/3/library/ssl.html#ssl.SSLContext.set_ciphers

>>> ctx = ssl.create_default_context()
>>> ctx.set_ciphers('HIGH:+3DES:!MD5')

Please note that OpenSSL 1.1 will remove 3DES from default builds. You will 
have to build your own OpenSSL and re-compile Python in order to use 3DES with 
OpenSSL 1.1.

--

___
Python tracker 

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



[issue25878] CPython on Windows builds with /W3, not /W4

2016-08-25 Thread Jim Jewett

Jim Jewett added the comment:

Is there a way to document why certain warnings are being suppressed, in case 
someone wants to revisit the suppression later?

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-25 Thread Eric N. Vander Weele

Changes by Eric N. Vander Weele :


--
nosy: +ericvw

___
Python tracker 

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



[issue27859] argparse - subparsers does not retain namespace

2016-08-25 Thread Eric N. Vander Weele

Changes by Eric N. Vander Weele :


--
nosy: +ericvw

___
Python tracker 

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



[issue27855] 2to3: Wrong code output w/ has_key without trailing space

2016-08-25 Thread E Rippey

E Rippey added the comment:

I have one line change to "Lib/lib2to3/fixes/fix_has_key.py" that will resolve 
this issue.  Would a patch be accepted?

It doesn't seem like the input is unusually contorted.

--
status: closed -> open

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-25 Thread Chi Hsuan Yen

Changes by Chi Hsuan Yen :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue26638] Avoid warnings about missing CLI options when building documentation

2016-08-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thank you, that worked -- and should have been documented in the help output.  
All the sphinx dependencies were inequalities, and rebuilding worked.

The devguide only says "You are expected to have installed a recent version of 
Sphinx on your system or in a virtualenv,".  Could we add

"We currently recommend 'python -m pip install sphinx==1.3.6' as the easiest 
way to install and the best version for most people to install.  See 
https://bugs.python.org/issue26638 for why."

(I am assuming that pip works on all systems, not just Windows.)  The sentence 
finishes with "so that the Makefile can find the sphinx-build command."  On 
Windows. this is most easily done by installing Sphinx with a Python version 
that was added to PATH when installed.

--

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-25 Thread Christian Heimes

Christian Heimes added the comment:

OpenSSL 1.1.0 final was released a couple of hours ago. One test is failing 
because it uses 3DES. 1.1.0 has 3DES disabled by default.

--

___
Python tracker 

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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-25 Thread Gregory P. Smith

Gregory P. Smith added the comment:

The processor capabilities vector is not the API you want.

What you want is an API to ask the ssl library about characteristics of 
algorithm implementations it will be using.

Those are not the same thing.

If we want to expose processor capabilities as a library function it should not 
be done in the ssl module.  That information belongs in the platform module.  
And doing so should not require a third party library such as OpenSSL.  
Querying capabilities is a very simple instruction and every platform 
architecture specific C macros to do it.

--

___
Python tracker 

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



[issue23702] docs.python.org/3/howto/descriptor.html still refers to "unbound methods"

2016-08-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith
priority: normal -> high

___
Python tracker 

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



[issue27830] Add _PyObject_FastCallKeywords(): pass keyword arguments as (key, value) pairs

2016-08-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffcfa4f005a3 by Victor Stinner in branch 'default':
Issue #27830: Revert, remove _PyFunction_FastCallKeywords()
https://hg.python.org/cpython/rev/ffcfa4f005a3

--

___
Python tracker 

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



[issue27830] Add _PyObject_FastCallKeywords(): pass keyword arguments as (key, value) pairs

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset ffcfa4f005a3 by Victor Stinner in branch 'default':
> Issue #27830: Revert, remove _PyFunction_FastCallKeywords()
> https://hg.python.org/cpython/rev/ffcfa4f005a3

I'm sorry, I misunderstood Serhiy's comment. I understood that Serhiy proposed 
to reuse the current format "PyObject **stack, int nargs, int nkwargs", but in 
fact he proposes something new in the issue #27213.

IMO the issue #27213 can be a major enhancement for Python 3.6. I prefer to 
wait until the issue #27213 is implemented (that we agreed on the new format), 
before working again on _PyObject_FastCallKeywords().

--

___
Python tracker 

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



[issue27830] Add _PyObject_FastCallKeywords(): avoid the creation of a temporary dictionary for keyword arguments

2016-08-25 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Add _PyObject_FastCallKeywords(): pass keyword arguments as (key, value) 
pairs -> Add _PyObject_FastCallKeywords(): avoid the creation of a temporary 
dictionary for keyword arguments

___
Python tracker 

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



[issue27830] Add _PyObject_FastCallKeywords(): avoid the creation of a temporary dictionary for keyword arguments

2016-08-25 Thread STINNER Victor

Changes by STINNER Victor :


--
dependencies: +Rework CALL_FUNCTION* opcodes

___
Python tracker 

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



[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

I changed the dependency to the issue #27830 "Add _PyObject_FastCallKeywords(): 
avoid the creation of a temporary dictionary for keyword arguments" which 
itself depends on the issue #27213 "Rework CALL_FUNCTION* opcodes".

--
dependencies: +Add _PyObject_FastCallKeywords(): avoid the creation of a 
temporary dictionary for keyword arguments -_PyObject_FastCall(): add support 
for keyword arguments

___
Python tracker 

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



[issue27358] BUILD_MAP_UNPACK_WITH_CALL is slow

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #27845: "Optimize update_keyword_args() function".

--
nosy: +haypo

___
Python tracker 

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



[issue27845] Optimize update_keyword_args() function

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

See also the issue #27358: "BUILD_MAP_UNPACK_WITH_CALL is slow.

--

___
Python tracker 

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



[issue27864] test_socket: unknown thread blocks forever on "AMD64 FreeBSD 9.x 3.x"

2016-08-25 Thread STINNER Victor

New submission from STINNER Victor:

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

...
running: test_socket (778 sec)
running: test_socket (808 sec)
running: test_socket (838 sec)
running: test_socket (868 sec)
running: test_socket (898 sec)
0:17:29 [402/402/1] test_socket crashed
Timeout (0:15:00)!
Thread 0x000801807400 (most recent call first):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/threading.py", 
line 295 in wait
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/threading.py", 
line 551 in wait
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/test_socket.py", 
line 261 in _tearDown
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/case.py", line 
603 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/case.py", line 
648 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/unittest/runner.py", 
line 176 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/support/__init__.py",
 line 1810 in _run_suite
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/support/__init__.py",
 line 1844 in run_unittest
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/test_socket.py", 
line 5385 in test_main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/runtest.py",
 line 164 in runtest_inner
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/runtest.py",
 line 119 in runtest
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/runtest_mp.py",
 line 71 in run_tests_slave
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 471 in _main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 464 in main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 526 in main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/regrtest.py", line 
46 in _main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/regrtest.py", line 
50 in 
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/runpy.py", line 
85 in _run_code
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/runpy.py", line 
193 in _run_module_as_main


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/runpy.py", line 
193, in _run_module_as_main
"__main__", mod_spec)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/runpy.py", line 
85, in _run_code
exec(code, run_globals)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/__main__.py", line 
2, in 
main()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 526, in main
Regrtest().main(tests=tests, **kwargs)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 464, in main
self._main(tests, kwargs)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 484, in _main
self.run_tests()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/main.py",
 line 412, in run_tests
run_tests_multiprocess(self)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/libregrtest/runtest_mp.py",
 line 221, in run_tests_multiprocess
raise Exception(msg)
Exception: Child error on test_socket: Exit code 1

--
components: Tests
keywords: buildbot
messages: 273682
nosy: haypo, koobs
priority: normal
severity: normal
status: open
title: test_socket: unknown thread blocks forever on "AMD64 FreeBSD 9.x 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



[issue27852] itertools -> flatten_all()

2016-08-25 Thread YoSTEALTH

YoSTEALTH added the comment:

Currently there is flatten() function in itertools Recipes section. This is 
what it does:
-> a = ['one', 'plus', [b'two', b'three'], ['four', ('five', (1, {'e', 'ee'}, 
(2, (3, ))), ['six'])], generator()]
<- ['o', 'n', 'e', 'p', 'l', 'u', 's', b'two', b'three', 'four', ('five', (1, 
{'ee', 'e'}, (2, (3,))), ['six']), 0, 1, 2]

As you can see it only flattens 1 nested level and for some reason it explodes 
the 'one' and 'plus' str items (maybe intentionally designed or lazily ignored, 
i don't know).

This is useful maybe in special circumstances where you have:
-> a = [[1, 2, 3], ['one', 'two', 'three']]
<- [1, 2, 3, 'one', 'two', 'three']

Also it doesn't work with bytearray, memoryview ...


In real worldly use something like flatten_all() is more useful!

--

___
Python tracker 

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



[issue27213] Rework CALL_FUNCTION* opcodes

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

> Pybench is now only ~200ms slower instead of 1200ms slower. But the whole 
> point of this patch is that CALL_FUNCTION_EX shouldn't be optimized for, so 
> I'd much prefer real benchmarking results

FYI I released a first version of the "new" Python benchmark suite: performance 
0.1 (quickly fixed with performance 0.1.1):

* https://pypi.python.org/pypi/performance
* https://github.com/python/benchmarks

The README file contains a few information how to run a stable benchmark. 
Please help me to complete this documentation :-)

I may help you to run these benchmarks.

--

___
Python tracker 

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



[issue27213] Rework CALL_FUNCTION* opcodes

2016-08-25 Thread STINNER Victor

STINNER Victor added the comment:

I'm working on a new calling convention: "fast call".

I already pushed changes implementing first functions:

_PyObject_FastCallDict(PyObject *func, PyObject **stack, Py_ssize_t nargs, 
PyObject *kwargs)

kwargs is a Python dict, but it can be NULL.

_PyObject_FastCallDict() avoids the creation a temporary tuple when you don't 
have to pass keyword arguments.

But I'm interested by an evolution to avoid also the creation of a temporary 
dictionary: issue #27830, "Add _PyObject_FastCallKeywords(): avoid the creation 
of a temporary dictionary for keyword arguments". This function would be the 
fundation for a new calling convention for C functions: #27810, "Add 
METH_FASTCALL: new calling convention for C functions".

I didn't read your patch carefully, but I would like to make sure that your 
patch would benefit of these APIs to avoid the creation of temporary tuple 
and/or dict.

"func(*args, key=value)" uses CALL_FUNCTION_EX and so requires to create a 
temporary dictionary. Maybe it's ok, I don't think that this syntax is commonly 
used.

"func(*args)" uses CALL_FUNCTION_EX: if args is a tuple, can you confirm that 
it would be possible to use _PyObject_FastCallDict() and/or 
_PyObject_FastCallKeywords() to avoid the creation a new temporary tuple?

Hum, I don't think that "func(*args)" can be optimized if args is a list 
because a list is mutable, we cannot use a direct access to the internal C 
array of a list.

--

___
Python tracker 

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



[issue19884] Importing readline produces erroneous output

2016-08-25 Thread Martin Panter

Martin Panter added the comment:

Thanks, I can try to commit the version fix part of the patch when I get a 
chance. What is EL6.8, is that a Red Hat (Enterprise Linux) thing?

--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue17642] IDLE add font resizing hot keys and wheel

2016-08-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

https://stackoverflow.com/questions/39155656/i-need-bigger-font-in-python-idle/39156068#39156068
 is about getting a larger font size than 22 for classroom projection.  I think 
configdialog.py should be extended something as follows (about line 1000).

self.optMenuFontSize.SetMenu(('7', '8', '9', '10', '11', '12', '13',
  '14', '16', '18', '20', '22',
  '25', '30', '35', '40'), fontSize )
 
I think any new key or wheel should change by 1 over a large range rather than 
being constrained to the values on the list.  I will try to look at the patches 
before 3.6.  Tests should also be added.

--
assignee: roger.serwy -> terry.reedy
stage: needs patch -> patch review
title: IDLE add font resizing hot keys -> IDLE add font resizing hot keys and 
wheel
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue27865] WeakMethod does not support builtin methods

2016-08-25 Thread Antony Lee

New submission from Antony Lee:

List subclasses can be weakref'd (as mentioned by the docs), but their methods 
cannot be wrapped by WeakMethod, even though this makes sense semantically:
```
In [25]: class L(list): pass

In [26]: weakref.WeakMethod(L().append)
---
TypeError Traceback (most recent call last)
 in ()
> 1 weakref.WeakMethod(L().append)

/usr/lib/python3.5/weakref.py in __new__(cls, meth, callback)
 47 except AttributeError:
 48 raise TypeError("argument should be a bound method, not {}"
---> 49 .format(type(meth))) from None
 50 def _cb(arg):
 51 # The self-weakref trick is needed to avoid creating a 
reference

TypeError: argument should be a bound method, not 
```

--
components: Library (Lib)
messages: 273688
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: WeakMethod does not support builtin methods
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27860] Improvements to ipaddress module

2016-08-25 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27852] itertools -> flatten_all()

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I think there is no need add this function in itertools. 
> And due to this details it may be not worth to add it as a recipe.

Sorry YoSTEALTH, I concur with Serhiy on both points and am going to pass on 
this proposal. 

That said, I encourage you to post elsewhere.  When my own ideas don't make it 
to the docs or standard library, I usually post a recipe in the ASPN Python 
Cookbook (for example, see https://code.activestate.com/recipes/users/178123/ ).

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



[issue27858] Add identity function to functools

2016-08-25 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue27833] Process is locked when try to execute Queue.put() inside

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Davin, what are your thoughts?

--
assignee:  -> davin
nosy: +rhettinger

___
Python tracker 

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



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I concur with Antoine.

--

___
Python tracker 

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



[issue19504] Change "customise" to "customize".

2016-08-25 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue19504] Change "customise" to "customize".

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks for the patch.

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

___
Python tracker 

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



[issue19504] Change "customise" to "customize".

2016-08-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 579360b1c8fe by Raymond Hettinger in branch '3.5':
Issue 19504:  Change "customise" to "customize" American spelling.
https://hg.python.org/cpython/rev/579360b1c8fe

--

___
Python tracker 

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



[issue27842] Order CSV header fields

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Consider using itertools.permutations() to generate the 120 cases cases.

The news entry goes into Misc/NEWS (there is not .txt extension).

--

___
Python tracker 

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



[issue27842] Order CSV header fields

2016-08-25 Thread Steve Holden

Steve Holden added the comment:

Is there another way? :)

Sent from my iPhone

> On 26 Aug 2016, at 12:16, Raymond Hettinger  wrote:
> 
> 
> Raymond Hettinger added the comment:
> 
> Consider using itertools.permutations() to generate the 120 cases cases.
> 
> The news entry goes into Misc/NEWS (there is not .txt extension).
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-25 Thread Xiang Zhang

Xiang Zhang added the comment:

For the first issue, the doc says:

The cursor method accepts a single optional parameter cursorClass. If supplied, 
this must be a custom cursor class that extends sqlite3.Cursor.

So I think we should check the type and then raise TypeError.

For the second issue, it seems it just hits the Py_CLEAR comments.

issue27861 tries to fix this. Besides, it also alters Connection.cursor's doc 
since it now does not reflects the implementation.

--
keywords: +patch
nosy: +xiang.zhang
Added file: https://bugs.python.org/file44227/issue27861.patch

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-25 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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