[issue27350] Compact and ordered dict

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

When stdint.h is not available you can define PY_INT32_T externally. E.g. 
CFLAGS="-DPY_INT32_T=__int32".

--

___
Python tracker 

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



[issue22115] Add new methods to trace Tkinter variables

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch provides simplified interface. The support of passing callback 
arguments is removed. This complicates an interface and is not needed since 
Python supports closure and the support of callback arguments was more limited 
(supported only limited set of types and arguments are converted to str).

Added an entry in What's News.

--
assignee:  -> serhiy.storchaka
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file43466/tkinter_trace_variable_5.patch

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-06-19 Thread INADA Naoki

INADA Naoki added the comment:

Make sense! I did it.

--
Added file: http://bugs.python.org/file43467/compact-dict.patch

___
Python tracker 

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



[issue22214] Tkinter: Don't stringify callbacks arguments

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch. Added NEWS and What's New entries.

--
assignee:  -> serhiy.storchaka
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file43468/tkinter_obj_cmd_3.patch

___
Python tracker 

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



[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Upload the near-final patch. This one adds large buffer tests on 64bit 
platforms. I have tested them on a server with enough memory. 

I don't add the @support.requires_resource('cpu') since large memory tests are 
born to be slow. And actually when I experiment, they are not that slow, at 
least not obviously slower than other large memory tests in test_zlib. So I 
ignore it.

--
Added file: http://bugs.python.org/file43469/64bit_support_for_zlib_v6.patch

___
Python tracker 

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



[issue27352] Bug in IMPORT_NAME

2016-06-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Seems there is a bug in the implementation of the IMPORT_NAME opcode in ceval.c.

If the level argument is -1, it is not passed to __import__ (should never 
happen, but looks correct). If it is an integer != -1 in C long range, it is 
passed to __import__ (this is correct). But if it is not integer (e.g. None) or 
can't be converted to C long, an exception is set and __import__ is called with 
level and not cleared error (this is wrong).

In correct bytecode the level argument can be either integer or None. Default 
__import__ accepts only integers as the level argument and checks the range. 
Proposed patch makes the code always passing the level argument to __import__ 
unless it is None.

--
components: Interpreter Core
files: import_name_level.patch
keywords: patch
messages: 268849
nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Bug in IMPORT_NAME
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43470/import_name_level.patch

___
Python tracker 

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



[issue22557] Local import is too slow

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed bugs making test_importlib failing.

Microbenchmark results on faster machine:

$ ./python -m timeit 'import locale'
Unpatched:  100 loops, best of 3: 0.839 usec per loop
Patched:1000 loops, best of 3: 0.176 usec per loop

$ ./python -m timeit 'import os.path'
Unpatched:  10 loops, best of 3: 2.02 usec per loop
Patched:100 loops, best of 3: 1.77 usec per loop

$ ./python -m timeit 'from locale import getlocale'
Unpatched:  10 loops, best of 3: 3.69 usec per loop
Patched:10 loops, best of 3: 3.39 usec per loop

And it looks to me that there is a bug in existing code (opened separate 
issue27352).

0.839 usec is not very slow by CPython's standards, but is equal to about 50 
assignments to local variable, 15 attribute revolvings or 5 simple function 
calls. If some module is optionally needed in fast function, the overhead of 
local import can be significant. We can lazily initialize global variable (the 
second example in msg228561), but this code looks more cumbersome.

--
stage:  -> patch review
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file43471/faster_import_4.patch

___
Python tracker 

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



[issue17711] Persistent id in pickle with protocol version 0

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-06-19 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file43472/compact-dict.patch

___
Python tracker 

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



[issue23641] Got rid of bad dunder names

2016-06-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 75cec736f87d by Serhiy Storchaka in branch '3.5':
Issue #23641: Added __getnewargs_ex__ to the list of special mock attributes.
https://hg.python.org/cpython/rev/75cec736f87d

New changeset 4c5f7b61b6c5 by Serhiy Storchaka in branch 'default':
Issue #23641: Added __getnewargs_ex__ to the list of special mock attributes.
https://hg.python.org/cpython/rev/4c5f7b61b6c5

--

___
Python tracker 

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



[issue23641] Got rid of bad dunder names

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm not sure about removing __getslice__ and __setslice__ from 
multiprocessing.sharedctypes and __div__ from unittest.mock, and left them as 
is.

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



[issue23148] Missing the charset parameter in as_encoded_word()

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The only tests that call cte_encode() are test_address_list_with_unicode_names 
and test_address_list_with_unicode_names_in_quotes. The only method that calls 
cte_encode() (besides recursive cte_encode) is TokenList._fold().

Methods UnstructuredTokenList.cte_encode() and Phrase._fold() are not covered 
by tests.

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



[issue20256] Argument Clinic: compare signed and unsigned ints

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Was fixed in duplicate issue22120.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Return converter code generated by Argument Clinic has a 
warning for unsigned types

___
Python tracker 

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



[issue26971] python v3.5.1: sys.paths not respecting DESTDIRS and DESTSHARED

2016-06-19 Thread Johannes S.

Johannes S. added the comment:

Maybe my last comment was not clear enogth. I used the tarballs from 3.5 and 
3.6 which are linked in my last comment. I extracted them and run the the 
following commands on Arch (64 Bit) and Linux SuSE 13.1 (64 Bit):

mkdir build
cd build
../configure --prefix=/some/dir
make
make install

The path `/some/dir` is a placeholder. The path did not exist before running 
this commands. After running them on Linux SuSE, I discovered that 
`libpython3.5m.a`, `pkgconfig/` and `python3.5/lib-dynload` was placed in 
`/some/dir/lib64` instead of `/some/dir/lib`. On Arch, everything is placed in 
`/some/dir/lib` but I have the same behavior if I add 
`--libdir=/some/dir/lib64` to `configure`. With other words: `--libdir` seems 
to have a default value of "EPREFIX/lib64" instead of "EPREFIX/lib" on my 
instance of Linux SuSE. Maybe `configure` uses some global configurations here?

The problem is, that `sys.path` does point to `/some/dir/lib/lib-dynload` in 
all cases described above. Since `python3.5/lib-dynload` may be placed in 
`lib64`, this may cause that python does not run properly after installing it.

(Unfortunately, I cannot say much about the configuration of "my instance of 
Linux SuSE" since I am not the person who set it up. It is a server of my 
university.)

--
status: pending -> open

___
Python tracker 

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



[issue23782] Leak in _PyTraceback_Add

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes a leak.

--
components: +Interpreter Core
keywords: +patch
stage:  -> patch review
versions: +Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43473/_PyTraceback_Add_leak.patch

___
Python tracker 

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



[issue27025] More human readable generated widget names

2016-06-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The change is a super great idea (see below), but I now think (my suggestion 
of) '`' is a bad idea because it conflicts with the use of '`' as markup for 
code and output, as in rst and stackoverflow.

https://stackoverflow.com/questions/37904750/tkinter-tclerror-invalid-command-name-54600176-error-what-is-going-on
 basically asks

What does '''_tkinter.TclError: invalid command name ".54600176"''' mean?

In my comment to the answer, I noted that 3.6.0a2 now says '''invalid command 
name ".`label"'''.  I wanted to write `invalid command name ".`label"` to quote 
it properly, SO style, but this would not work.  So I suggest we invoke your 
last comment and instead try '^' (or even '~' or '-' if you prefer).

--

___
Python tracker 

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



[issue27025] More human readable generated widget names

2016-06-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Worse yet, SO replaces a single ` with a space, so that ".`label" is displayed 
as ". label"

--

___
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-06-19 Thread Demur Rumed

Demur Rumed added the comment:

Attaching first iteration. Very drafty. Still need to fix test_dis; will run 
test suite this evening. Perf on pybench went from 16.5s to 17.5s. It was 18.3s 
prior to reintroducing use of fast_function. Code still needs clean up besides 
investigation into how to optimize

Changes not described in the original patch concept: I made CALL_FUNCTION_EX 
oparg carry 2 flag bits on whether there's a kwdict or a vararg tuple. Code may 
be simpler to only have kwdict be optional. BUILD_MAP_UNPACK_WITH_CALL was 
modified to only use the highest bit of the 2nd byte to track where 
function_pos is. Most uses of BUILD_MAP_UNPACK_WITH_CALL is f(*va,**kw) so I 
chose to only set the highest bit when there isn't a positional unpacking. If 
we pushed an empty tuple then that flag bit could be removed

--
keywords: +patch
Added file: http://bugs.python.org/file43474/callfunc.patch

___
Python tracker 

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



[issue27196] Eliminate 'ThemeChanged' warning when running IDLE tests

2016-06-19 Thread Ned Deily

Ned Deily added the comment:

FWIW, I'm still seeing these errors on OS X (10.11.5 with ActiveTcl 8.5.18) 
using 2.7.12rc1, 3.5.2rc1, and top-of-trunk 3.6.0.  They do not occur on the 
same platform when using 2.7.11 or 3.5.1.

For example:
$ /usr/local/bin/python2.7
Python 2.7.12rc1 (v2.7.12rc1:13912cd1e7e8, Jun 11 2016, 15:32:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin [...]
$ /usr/local/bin/python2.7 -m test.regrtest -ugui -j3 test_idle
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
[1/1] test_idle
1 test OK.

$ /usr/local/bin/python3.5
Python 3.5.2rc1 (v3.5.2rc1:68feec6488b2, Jun 11 2016, 21:59:53)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin [...]
$ /usr/local/bin/python3.5 -m test.regrtest -ugui test_idle
[1/1] test_idle
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
1 test OK.

$ ./bin/python3.6
Python 3.6.0a2+ (default, Jun 19 2016, 13:19:06)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin [...]
$ ./bin/python3.6 -m test -ugui -j3 test_idle
Run tests in parallel using 3 child processes
0:00:02 [1/1] test_idle passed
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
1 test OK.
Total duration: 0:00:03

--
nosy: +ned.deily
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
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



[issue27213] Rework CALL_FUNCTION* opcodes

2016-06-19 Thread Mark Shannon

Mark Shannon added the comment:

I seemed to have been added to the nosy list. I guess that means that my 
opinions are wanted ;)

I have wanted to clean up the code around making calls for quite a while. I 
just haven't had time.

I agree that adding a simpler opcode for making calls with positional only args 
is worthwhile.
However creating the tuple and/or dict at every call site is going to lead to 
slow downs. It gets even worse for bound-methods, as yet another tuple will 
need to be created to accommodate self.

What I would suggest is a new internal calling convention which embodies the 
six-part form of CALL_FUNCTION_VAR_KW, that is (number-of-postionals, 
pointer-to-positionals, number-of-keywords, pointer-to-keywords, 
starargs-tuple, doublestarargs-dict). 
As a first step, each of the four current CALL_FUNCTION variants could then 
call this function, filling in the relevant parameters.

The new function would look something like this:
PyEval_Call_Callable(
PyObject *callable,
int npos,
PyObject **positionals,
int nkws,
PyObject **keywords,
PyObject *starargs,
PyObject *dictargs) {
if (Is_PyFunction(callable))
return PyFunction_Call(callable, npos, ...);

if (Is_CFunction(callable))
return CFunction_Call(callable, npos, ...);

// Otherwise general object...

// We might want PyType_Call as well, since object creation is
// another common form of call.

// Create tuple and dict from args.
return PyObject_Call(callable, tuple, dict);
}

This would mean that the logic for frame creation would be where it belongs (in 
the code for the Function object) and that special casing the various forms of 
CFunctions could be moved to where that belongs.

Given what Serhiy says about calls with just positional parameters being by far 
the most common, it sounds as if it would make sense to add 
PyFunction_CallSimple(PyObject *callable, int npos, PyObject**args)
and 
CFuntion_CallSimple(PyObject *callable, int npos, PyObject**args) 
variants for the new CALL_FUNCTION opcode to use.

With those changes, it would then make sense to replace the four opcodes
CALL_FUNCTION, CALL_FUNCTION_VAR, CALL_FUNCTION_KW, CALL_FUNCTION_VAR_KW

with 
CALL_FUNCTION -- As Serhiy suggests
CALL_FUNCTION_KW -- As Serhiy suggests
CALL_FUNCTION_VAR_KW -- As currently exists

--

___
Python tracker 

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



[issue27297] Add support for /dev/random to "secrets"

2016-06-19 Thread Nick Coghlan

Nick Coghlan added the comment:

Please don't use /dev/random for anything, ever.

It can block applications unpredictably for no good reason.

--
nosy: +ncoghlan
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



[issue27244] print(';;') fails in pdb with SyntaxError

2016-06-19 Thread Ned Deily

Ned Deily added the comment:

As Wim notes, that behavior is documented.  So, until someone wants to provide 
an enhancement patch, we should close this issue.  Sorry!

--
nosy: +ned.deily
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



[issue25602] Add support for EVFILT_USER kqueue filter

2016-06-19 Thread Ned Deily

Ned Deily added the comment:

Thanks for contributing the patch, Jakub.  I'm sorry that there's been no 
action on it; unfortunately, the BSD platforms don't get as much attention here 
as some others.  I took a cursory look at it and the patch looks pretty good to 
me and applies/builds cleanly on OS X (even though support for EVFILT_USER is 
known to not be documented there).  I think it would be good to add a test case 
to Lib/test/test_kqueue.py.  Any other opinions?

--
nosy: +ned.deily, neologix

___
Python tracker 

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



[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor's patch harvested most fruits, but there is a place for further 
optimization.

Benchmark results for new patch:

Py3.2Py3.3Py3.6Py3.6+patch

451 (-47%)   77 (+209%)   140 (+70%)   238decode  unicode-escape  'A'*1
269 (-14%)   161 (+44%)   187 (+24%)   232decode  unicode-escape  
'\x80'*1
453 (-48%)   85 (+178%)   181 (+30%)   236decode  unicode-escape
'\x80'+'A'*
295 (-4%)185 (+54%)   229 (+24%)   284decode  unicode-escape  
'\u0100'*1
452 (-47%)   75 (+221%)   213 (+13%)   241decode  unicode-escape
'\u0100'+'A'*
275 (-11%)   149 (+64%)   187 (+30%)   244decode  unicode-escape
'\u0100'+'\x80'*
297 (-4%)185 (+54%)   230 (+23%)   284decode  unicode-escape  
'\u8000'*1
452 (-47%)   75 (+221%)   213 (+13%)   241decode  unicode-escape
'\u8000'+'A'*
275 (-11%)   149 (+64%)   187 (+30%)   244decode  unicode-escape
'\u8000'+'\x80'*
295 (-3%)185 (+54%)   230 (+24%)   285decode  unicode-escape
'\u8000'+'\u0100'*
318 (-29%)   203 (+11%)   220 (+2%)225decode  unicode-escape  
'\U0001'*1
452 (-51%)   72 (+207%)   163 (+36%)   221decode  unicode-escape
'\U0001'+'A'*
275 (-31%)   128 (+49%)   160 (+19%)   191decode  unicode-escape
'\U0001'+'\x80'*
295 (-36%)   164 (+16%)   201 (-5%)190decode  unicode-escape
'\U0001'+'\u0100'*
297 (-36%)   166 (+14%)   199 (-5%)190decode  unicode-escape
'\U0001'+'\u8000'*

559 (-62%)   88 (+143%)   194 (+10%)   214decode  raw-unicode-escape  
'A'*1
555 (-62%)   88 (+142%)   195 (+9%)213decode  raw-unicode-escape  
'\x80'*1
559 (-62%)   88 (+142%)   195 (+9%)213decode  raw-unicode-escape
'\x80'+'A'*
265 (+29%)   133 (+156%)  212 (+61%)   341decode  raw-unicode-escape  
'\u0100'*1
563 (-54%)   77 (+235%)   195 (+32%)   258decode  raw-unicode-escape
'\u0100'+'A'*
559 (-54%)   77 (+234%)   194 (+32%)   257decode  raw-unicode-escape
'\u0100'+'\x80'*
269 (+27%)   138 (+147%)  208 (+64%)   341decode  raw-unicode-escape  
'\u8000'*1
562 (-54%)   77 (+235%)   193 (+34%)   258decode  raw-unicode-escape
'\u8000'+'A'*
559 (-54%)   77 (+234%)   194 (+32%)   257decode  raw-unicode-escape
'\u8000'+'\x80'*
265 (+29%)   138 (+147%)  208 (+64%)   341decode  raw-unicode-escape
'\u8000'+'\u0100'*
281 (-13%)   152 (+61%)   228 (+7%)244decode  raw-unicode-escape  
'\U0001'*1
562 (-65%)   74 (+164%)   200 (-2%)195decode  raw-unicode-escape
'\U0001'+'A'*
557 (-65%)   74 (+162%)   200 (-3%)194decode  raw-unicode-escape
'\U0001'+'\x80'*
265 (-2%)122 (+114%)  184 (+42%)   261decode  raw-unicode-escape
'\U0001'+'\u0100'*
269 (-3%)122 (+113%)  185 (+41%)   260decode  raw-unicode-escape
'\U0001'+'\u8000'*


195 (+136%)  109 (+323%)  258 (+79%)   461encode  unicode-escape  'A'*1
673 (-23%)   522 (-1%)254 (+103%)  516encode  unicode-escape  
'\x80'*1
197 (+134%)  132 (+248%)  247 (+86%)   460encode  unicode-escape
'\x80'+'A'*
869 (-22%)   627 (+9%)333 (+105%)  682encode  unicode-escape  
'\u0100'*1
197 (-19%)   124 (+28%)   158 (+1%)159encode  unicode-escape
'\u0100'+'A'*
669 (-35%)   493 (-12%)   236 (+83%)   432encode  unicode-escape
'\u0100'+'\x80'*
866 (-20%)   628 (+10%)   333 (+108%)  692encode  unicode-escape  
'\u8000'*1
197 (-19%)   125 (+27%)   158 (+1%)159encode  unicode-escape
'\u8000'+'A'*
669 (-35%)   492 (-12%)   236 (+83%)   433encode  unicode-escape
'\u8000'+'\x80'*
869 (-20%)   627 (+11%)   324 (+114%)  694encode  unicode-escape
'\u8000'+'\u0100'*
870 (-1%)897 (-4%)501 (+72%)   861encode  unicode-escape  
'\U0001'*1
197 (+20%)   139 (+70%)   234 (+1%)236encode  unicode-escape
'\U0001'+'A'*
668 (-27%)   533 (-9%)249 (+96%)   487encode  unicode-escape
'\U0001'+'\x80'*
869 (-12%)   646 (+18%)   344 (+122%)  764encode  unicode-escape
'\U0001'+'\u0100'*
864 (-12%)   643 (+19%)   344 (+122%)  762encode  unicode-escape
'\U0001'+'\u8000'*

391 (+1310%) 333 (+1556%) 575 (+859%)  5514   encode  raw-unicode-escape  
'A'*1
391 (+1229%) 334 (+1456%) 576 (+802%)  5198   encode  raw-unicode-escape  
'\x80'*1
391 (+1402%) 335 (+1653%) 579 (+914%)  5873   encode  raw-unicode-escape
'\x80'+'A'*
869 (-25%)   687 (-5%)356 (+83%)   652encode  raw-unicode-escape  
'\u0100'*1
391 (+46%)   158 (+260%)  214 (+166%)  569encode  raw-unicode-escape
'\u0100'+'A'*
391 (+46%)   158 (+260%)  214 (+166%)  569encode  raw-unicode-escape
'\u0100'+'\x80'*
873 (-25%)   682 (-4%)356 (+83%)   652encode

[issue27287] SIGSEGV when calling os.forkpty()

2016-06-19 Thread Ned Deily

Ned Deily added the comment:

>From a quick search of the issue tracker, I didn't find any previous reports 
>of this.  We do have a couple of gentoo buildbots but probably not 
>gentoo-hardened.  So I don't think this issue is going to go anywhere here and 
>I'm going to close it.  If anyone does find evidence of a problem in Python, 
>please reopen.  Good luck!

--
nosy: +ned.deily
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



[issue22214] Tkinter: Don't stringify callback arguments

2016-06-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There is no review button for the new patch (don't know why), so: in the News 
and What's New entries, change "if call" to "if one calls" and "or set" to "or 
sets".

More importantly, question your use of 'callback' in the entries.  To me, a 
callback is a function that is passed to a recipient to be called *by the 
recipient* at some later time. For tkinter, there are command callbacks, which 
get no arguments, validatecommand callbacks, which get string arguments, event 
callbacks, which get a tkinter event object as argument, and after callbacks, 
which get as arguments the Python objects given to the after call.  In all 
cases, there is no visible issue of passing non-strings as strings to the 
callback.  The following duplicates the testfunc and interp.call in test_tcl.py 
as closely as I know how, but with a different result.

import tkinter as tk
root = tk.Tk()
def test(*args):
for arg in args:
print(type(arg), '', repr(arg))
root.after(1, test, True, 1, '1')
root.mainloop()

To me, the revised test does not involve a callback.  The test registers a name 
for the python function so it can be passes by name to Tk().call, as required 
by the .call signature.  So I would replace 'callback' with 'Python function 
registered with tk'.

Registered functions can, of course, be used as callback if they have the 
proper signature.  ConfigDialog registers an 'is_int' function so it can be 
passed to an Entry as a validatecommand callback.  The patch does not affect 
registered validate commands because they receive string args.

After grepping idlelib for "register(", I believe this is the only function 
IDLE registers with tk (two of its classes have non-tk .register methods).  
Hence, IDLE should not be affected by the patch and seems not as far as I 
tested.

I can't properly review the _tkinter patch as it requires too much knowledge of 
tcl/tk interfaces.

--
title: Tkinter: Don't stringify callbacks arguments -> Tkinter: Don't stringify 
callback arguments

___
Python tracker 

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



[issue27319] Multiple item arguments for selection operations

2016-06-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7b9ad68db14e by Serhiy Storchaka in branch 'default':
Issue #27319: Methods selection_set(), selection_add(), selection_remove()
https://hg.python.org/cpython/rev/7b9ad68db14e

--
nosy: +python-dev

___
Python tracker 

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



[issue27319] Multiple item arguments for selection operations

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Terry.

--
resolution:  -> fixed
stage: commit 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



[issue22214] Tkinter: Don't stringify callback arguments

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Terry for your review. Here is updated patch fith fixed wording as 
you suggested. Hope it will be available to review on Rietveld.

The original purpose of this patch was to help fixing some IDLE "crashes". 
Percolator is registered in text widgets for highlighting pasted text. If you 
paste invalid string containing a lone surrogate on Windows (clipboard uses 
UTF-8), it first converted by Tcl to char*, and then Tkinter should convert it 
to Python string for passing to registered Python function, but fails. Since 
the information is lost during conversion in Tcl, we can't use say 
"surrogatepass" error handler fo representing non-well-formed data. With this 
patch we can decode just from Tcl unicode string.

--
Added file: http://bugs.python.org/file43476/tkinter_obj_cmd_4.patch

___
Python tracker 

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



[issue20350] Replace tkapp.split() to tkapp.splitlist()

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Most methods are tested now.

There is a difference between split() and splitlist() in Variable.trace_vinfo() 
if the tracer was assigned not by Tkinter method Variable.trace_variable(), but 
by direct execution of Tcl command "trace add variable" and additional 
arguments were included in commandPrefix. This is very unusual case, and I 
think that the result would be more expectable if use splitlist() in 
Variable.trace_vinfo().

--

___
Python tracker 

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



[issue24137] Force not using _default_root in IDLE

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What your thoughts about this Terry?

--
stage:  -> needs patch

___
Python tracker 

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



[issue21708] Deprecate nonstandard behavior of a dumbdbm database

2016-06-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patch updated. Added What's New entry.

We already lost 2 years and the 3.5 release. I don't want to lost 3.6 too.

--
assignee:  -> serhiy.storchaka
components: +Library (Lib)
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file43477/dbm_dumb_deprecations2.patch

___
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-06-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2016-06-19 Thread dg1727

Changes by dg1727 :


--
nosy: +dg1727

___
Python tracker 

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



[issue27198] Adding an assertClose() method to unittest.TestCase

2016-06-19 Thread Pam McA'Nulty

Changes by Pam McA'Nulty :


--
nosy: +Pam.McANulty

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-19 Thread Pam McA'Nulty

Changes by Pam McA'Nulty :


--
nosy: +Pam.McANulty

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2016-06-19 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue27353] Add nroot function to math

2016-06-19 Thread Steven D'Aprano

New submission from Steven D'Aprano:

For Issue27181 (add geometric mean to statistics module), I need a function to 
calculate nth roots that is more accurate than pow(x, 1/n). E.g. math.pow(1000, 
1/3) returns 9.998 instead of 10.0.

I have a pure-Python implementation of nroot which I believe is satisfactory, 
and I could use that, but I'm uncomfortable about making it a public function 
in statistics. It's not really a statistics function, its more general, and I 
think it would be generally useful enough that it should go into math.

To recap the options:

- leave nroot in statistics as a private function;
- leave it in statistics, but make it public;
- add it to math

I'm willing to do the first if there is no other alternative, reluctant to do 
the second, and think that the third is the most useful, but I don't have the 
ability to write a pure C version. If the math library was written in Python 
that would be the obvious place for it.

--
components: Library (Lib)
messages: 268875
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: Add nroot function to math
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



[issue27122] Hang with contextlib.ExitStack and subprocess.Popen (regression)

2016-06-19 Thread Nick Coghlan

Nick Coghlan added the comment:

Serhiy's test changes look good to me!

--

___
Python tracker 

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



[issue26859] unittest fails with "Start directory is not importable" when trying to run sourceless tests

2016-06-19 Thread Pam McA'Nulty

Changes by Pam McA'Nulty :


--
nosy: +Pam.McANulty

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Ask five people to spell "assertEndsWith" and see how many of them capitalize 
the "W".

--

___
Python tracker 

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



[issue27198] Adding an assertClose() method to unittest.TestCase

2016-06-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> Embrace the API and add useful asserts like this one.

This kind of philosophy is going to lead to egregious API expansion, making 
Python harder to learn and remember.  You're suggesting that we have a nearly 
zero resistance to adding new assert variants.  

Please keep in mind that once something is added to the standard library, it is 
very painful to remove it later.  As far as I can tell, there has been zero 
usability testing of this method with actual users and there have been no user 
requests for it ever.  I don't see any analog for it in the unittest modules 
for other languages.

I don't like the method name at all and think we will regret this method if 
later an assertIsClosed() method is added for making sure objects have had a 
close() method called.

If recall correctly, Kent Beck himself opposed this kind of expansion of 
unittest modules, "Some of the implementations have gotten a little complicated 
for my taste."  He believed that the tool itself should be minimal so that it 
could be easily learned and mastered while letting "tests be expressed in 
ordinary source code".

> it is clearly DESIGNED to have specialized asserts for 
> many common use cases.

Actually, is wasn't at all.  When unittest was added, there were no specialized 
asserts (see https://docs.python.org/2.1/lib/testcase-objects.html ).  It was a 
translation of the successful and well respected JUnit module.  Its design goal 
was to provide user extendability rather than throwing in everything including 
the kitchen sink.

Python's unittest module was around for a very long time before the zoo of 
specialized asserts was added (courtesy of code donated by Google).

--

___
Python tracker 

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



[issue27122] Hang with contextlib.ExitStack and subprocess.Popen (regression)

2016-06-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a14b93a4eb49 by Serhiy Storchaka in branch '3.5':
Added more tests for issue #27122.
https://hg.python.org/cpython/rev/a14b93a4eb49

New changeset ebc82b840163 by Serhiy Storchaka in branch 'default':
Added more tests for issue #27122.
https://hg.python.org/cpython/rev/ebc82b840163

--

___
Python tracker 

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



[issue27122] Hang with contextlib.ExitStack and subprocess.Popen (regression)

2016-06-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> closed

___
Python tracker 

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



[issue27354] SSLContext.load_verify_locations cannot handle paths on Windows which cannot be encoded using mbcs

2016-06-19 Thread Ilya Kulakov

New submission from Ilya Kulakov:

On Windows 8.1 x64 with Python 3.5.1 I was able to reproduce the issue by 
attempting to load a file at 
"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".

locale.getdefaultlocale()
> ('en_US', 'cp1252')

locale.getpreferredencoding()
> 'cp1252'

sys.getfilesystemencoding()
> 'mbcs'

sys.getdefaultencoding()
> 'utf-8'

c = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)


c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem")
> TypeError: cafile should be a valid filesystem path


c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".encode(sys.getfilesystemencoding()))
> UnicodeEncodeError: 'mbcs' codec can't encode characters in positions 
0--1: invalid character


c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".encode('utf-8'))
> ok

--
components: Extension Modules, Unicode, Windows
messages: 268880
nosy: Ilya.Kulakov, ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: SSLContext.load_verify_locations cannot handle paths on Windows which 
cannot be encoded using mbcs
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



[issue27198] Adding an assertClose() method to unittest.TestCase

2016-06-19 Thread Berker Peksag

Berker Peksag added the comment:

I agree with Raymond. I doubt most of the unittest users would ever need a 
builtin assertClose() method in unittest. I suggest closing this as 'rejected'.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2016-06-19 Thread Martin Panter

Martin Panter added the comment:

Here is a diff that shows my changes better. I temporarily moved some classes 
back to their original positions to reduce the diff size, though it won’t work 
in practice because Python needs the classes defined before using them.

--
Added file: http://bugs.python.org/file43478/original-order.diff

___
Python tracker 

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



[issue22214] Tkinter: Don't stringify callback arguments

2016-06-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Review works.  "to Python function" should be either "to a Python function" or 
"to Python functions".

Preventing crashes is a justifying use case.  Percolator registers its 'insert' 
and 'delete' methods with a WidgetRedirector.  It then patches them into to 
text instance, thereby inducing tk to call its replacements without their being 
registered with tk. Can you add a test case based on this?

I tried the following, based on what Redirector does, without and with the 
patch and got the same result each time.
import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
s = '\ud800'
text.insert('1.0', s)
print(text.get('1.0'))
def insert(index, s):
Text.insert(text, index, s)
text.insert('1.1', s)
print(text.get('1.1'))
root.clipboard_append(s)
text.insert('1.2', text.clipboard_get())
print(text.get('1.2'))
### output
�
�
Traceback (most recent call last):
  File "F:\Python\mypy\tem2.py", line 12, in 
text.insert('1.2', text.clipboard_get())
  File "F:\Python\dev\36\lib\tkinter\__init__.py", line 730, in clipboard_get
return self.tk.call(('clipboard', 'get') + self._options(kw))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid 
continuation byte

Can the above be changed to fail, then succeed?

--

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-06-19 Thread Martin Panter

Martin Panter added the comment:

Uploading a combined patch that should work with Rietveld, and I will leave 
some comments.

I don’t think there is much that I am comfortable changing in Python 2.7. In 
general it is a bad idea to add new features that are only going to be 
available in e.g. 2.7.13+ and won’t work in older versions of 2.7. One rule of 
thumb is if a change would require additional documentation, then it is 
probably a new feature. In this case, find_library() is returning something 
that is not a plain filename or path name, so the documentation also needs 
changing.

If we added a version of find_library() that returned only file or path names 
(and not archive members!), I might consider that acceptable for 2.7, because 
it is filling in missing AIX functionality, and sticks to the current 
documentation. But it sounds like most libraries are archive members, so I can 
understand if that sort of change is not worth the effort.

--
Added file: http://bugs.python.org/file43479/Python2.Lib.ctypes.160611.patch

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-06-19 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file43480/compact-dict.patch

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-06-19 Thread Martin Panter

Martin Panter added the comment:

I left a few more comments, but I see that many of my earlier comments (both in 
Rietveld and main bug thread) still apply.

I’m still struggling to understand all the special cases for the find_library() 
argument. You seem to have added even more recently (although I think you 
removed some as well). Can you point to any documentation, command lines, etc 
demonstrating why Python should support:

find_library("libNAME")
find_library("search:paths/NAME")
find_library("NAME.so*")
find_library("/NAME")  # Not sure if this case is even relevant

Perhaps it would help if you explained what a typical AIX compiler or linker 
command line looks like. Or if you updated the documentation 
 to 
explain the cases for AIX.

--

___
Python tracker 

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