[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

Ahh, I see.

> If there are any integer a such as ESTIMATE_SIZE(a) == n and n == 2**m and 
> USABLE_FRACTION(n) == a - 1.

There are, such as 11, 43...

> a items cannot be inserted into dict after dictresize(d, ESTIMATE_SIZE(a))

It can but needs another resize in insertdict which breaks the intention of 
ESTIMATE_SIZE.

Then everything looks fine to me. :)

--

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread Vedran Čačić

Vedran Čačić added the comment:

Yes, I agree these are useless _if you know you're dealing with range_. 
However, if you have a Sequence, it would be very useful not to have range be a 
special case.

Of course, one solution is to have a default .index implementation in the 
Sequence ABC itself, but still I'd argue that range can implement the 3-arg 
.index much better than generic Sequence.

--

___
Python tracker 

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



[issue28202] Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-18 Thread Jack Liu

New submission from Jack Liu:

0
down vote
favorite
I have a app loading python35.dll. Use python API PyImport_AddModule to run a 
py file. And use PyDict_DelItemString to delete the module. There is a global 
vailable in the py file. The global variable is not destroyed when calling 
PyDict_DelItemString to delete the module. That cause the memory leak.

But it is ok with python33.dll, the global variable can be destroyed when 
calling PyDict_DelItemString to delete the module.

How to resolve the problem? Is there a workaround? I need to use python35.dll 
and wish the global variable in a module can be released automatically when 
call PyDict_DelItemString to delete the module.

Here is the python test code:

class Simple:  
 def __init__( self ):  
 print('Simple__init__')
 def __del__( self ):  
 print('Simple__del__') 

simple = Simple()

--
components: Library (Lib)
messages: 276945
nosy: Jack Liu
priority: normal
severity: normal
status: open
title: Python 3.5.1 C API, the global available available is not destroyed when 
delete the module
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> (After OrderedDict implementation is improved, functools.lru_cache can use 
> OrderedDict and remove doubly linked list too.)

functools.lru_cache can use just ordered dict. But simple implementation is 1.5 
times slower. I'm working on this.

I think that changing implementation of lru_cache and OrderedDict is a new 
feature and can came only in 3.7, when new dict implementation will be more 
tested.

--

___
Python tracker 

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



[issue28201] dict: perturb shift should be done when first conflict

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I agree and my opinion counts even more because I long ago made this change for 
setobjects ;-)

--

___
Python tracker 

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



[issue28189] dictitems_contains swallows compare errors

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for the merge Raymond. :)

--
stage: patch review -> resolved

___
Python tracker 

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



[issue28189] dictitems_contains swallows compare errors

2016-09-18 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



[issue28189] dictitems_contains swallows compare errors

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2a9e0e869ca7 by Raymond Hettinger in branch '3.5':
Issue #28189: dictitems_contains no longer swallows compare errors.
https://hg.python.org/cpython/rev/2a9e0e869ca7

--
nosy: +python-dev

___
Python tracker 

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



[issue28200] Windows: path_converter() leaks memory for Unicode filenames

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Deprecated functions and types of the C API
---

The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be
removed in Python 4. All functions using this type are deprecated:

Unicode functions and methods using :c:type:`Py_UNICODE` and
:c:type:`Py_UNICODE*` types:

* :c:macro:`PyUnicode_AS_UNICODE`, :c:func:`PyUnicode_AsUnicode`,
  :c:func:`PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`

(From Doc/whatsnew/3.3.rst)

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread INADA Naoki

INADA Naoki added the comment:

> We can still clean this up for Python 3.6.  We're in feature freeze, not 
> development freeze.

Does it mean there is a chance to improve OrderedDict to use new dict 
implementation, if it seems safe enough?
Is new implementation a feature?

(After OrderedDict implementation is improved, functools.lru_cache can use 
OrderedDict and remove doubly linked list too.)

--

___
Python tracker 

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



[issue28201] dict: perturb shift should be done when first conflict

2016-09-18 Thread Tim Peters

Tim Peters added the comment:

Good catch!  I agree - and I wrote this code to begin with, so my opinion 
should count ;-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue28201] dict: perturb shift should be done when first conflict

2016-09-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue28201] dict: perturb shift should be done when first conflict

2016-09-18 Thread INADA Naoki

New submission from INADA Naoki:

Current perturb shift code is like following:

for (perturb = hash; ; perturb >>= PERTURB_SHIFT) {
i = mask & ((i << 2) + i + perturb + 1);

This loop is start after first conflict. It means perturb == hash for first 
conflict.

The purpose of perturb shift is avoid long conflict chain when keys more
than two have hashes their lower-bit is same. So first perturb should be hash 
>> PERTURB_SHIFT.

example: Consider about ma_keys == 16 and keys are [1, 17, 33, 49, 65].
Current perturb
1. hash(1) & (16-1) == 1; 1 uses ix==1 slot.
2. hash(17) & (16-1) == 1; ix==1 conflicts; Next ix is mask & (3 + 17 + 1) == 
5; use ix==5 slot.
3. hash(33) & (16-1) == 1; ix==1 conflicts; Next ix is mask & (3 + 33 + 1) == 
5; ix==5 conflicts; ...

When first perturb = hash >> PERTURB_SHIFT:
1. hash(1) & (16-1) == 1; 1 uses ix==1 slot.
2. hash(17) & (16-1) == 1; ix==1 conflicts; Next ix is mask & (3 + (17>>5) + 1) 
== 4; use ix==4 slot.
3. hash(33) & (16-1) == 1; ix==1 conflicts; Next ix is mask & (3 + (33>>5) + 1) 
== 5; use ix==5 slot.


While it's difficult to see performance difference from benchmark, this should 
be decrease possibility of 2nd conflict.

--
components: Interpreter Core
messages: 276936
nosy: methane
priority: normal
severity: normal
status: open
title: dict: perturb shift should be done when first conflict
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



[issue28200] Windows: path_converter() leaks memory for Unicode filenames

2016-09-18 Thread Steve Dower

Steve Dower added the comment:

It's not clear to me that Py_UNICODE is guaranteed to be wchar_t for all time, 
that's all. If it is, go ahead. Otherwise the path_t object has the ability to 
clean up after itself, so perhaps it should be used here?

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread INADA Naoki

INADA Naoki added the comment:

Current compact ordered dict implementation is bit different from yours.
When there was removed item, there are NULL entries in ma_entries, instead of 
swapping last item and deleted item.
It's important to keep insertion order.

But it's easy to detect clean dict. Your suggestion can be used when:

* dk_lookup == lookdict_unicode_nodummy: There are no dummies, all keys are 
unicode, and no NULL entries.
* ma_used == dk_nentries: It means there are no NULL entries. (All deletion 
except .popitem() is allowed)

I think dictresize for split table can be split function. But I don't know it 
can improve performance or readability.

--

___
Python tracker 

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



[issue28189] dictitems_contains swallows compare errors

2016-09-18 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> These broke some concrete Sequence implementations.

Poor choice of words.  The concrete implementations didn't change at all. 

Perhaps the concrete implementation need to be brought more in-sync with the 
ABC.  That would be reasonable; afteralll the goal is substitutability  -- that 
is the only reason that the old xrange morphed into something with nearly 
useless count() and index() methods in the first place.

--

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 88110cfbf4dc by Raymond Hettinger in branch '3.6':
Issue #28193: Use lru_cache in the re module.
https://hg.python.org/cpython/rev/88110cfbf4dc

--
nosy: +python-dev

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

Then how about entries(key, value pairs)? The size of entries does not match 
the available hash slots. For example, an empty dict allocates a hash array 
with 5 available slots and 5 entries. Now we resize the hash array to size 16 
and it can afford 10 entries but you only get room for 5 entries. How could we 
insert the 6th entry?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread Vedran Čačić

Vedran Čačić added the comment:

Yes, that's the precise reason I caught this. I was implementing some tools to 
do with Sequences (seqtools, like itertools but having non-ephemeral output 
given non-ephemeral input), and the Sequence that was easiest to test quickly 
was range. In `positions` (like .index but gives all the places a value 
appears), it raised TypeError.

--

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cf6e9968ebb7 by Benjamin Peterson in branch '3.6':
always define HAVE_LONG_LONG (#27961)
https://hg.python.org/cpython/rev/cf6e9968ebb7

--

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think I'll just take the low hanging fruit in _compile_repl and call it a day.

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Just before the re-insertion, we should also do a compaction-in-place for the 
keys/values/hashes array if it has a significant number of holes for previously 
deleted entries.

--

___
Python tracker 

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



[issue28200] Windows: path_converter() leaks memory for Unicode filenames

2016-09-18 Thread STINNER Victor

STINNER Victor added the comment:

I didn't push the fix myself, because Steve Dower maybe made the change for a 
specific reason?

--

___
Python tracker 

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



[issue28195] test_huntrleaks_fd_leak fails on Windows

2016-09-18 Thread STINNER Victor

STINNER Victor added the comment:

Ah, I found a leak: see issue #28200.

--

___
Python tracker 

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



[issue28200] Windows: path_converter() leaks memory for Unicode filenames

2016-09-18 Thread STINNER Victor

New submission from STINNER Victor:

Memory leak spotted by the issue #28195: path_converter() calls 
PyUnicode_AsWideCharString() which allocates a new buffer at each call, but 
this buffer is never released.

On Python 3.5, PyUnicode_AsWideCharString() was used which handles internally 
the memory buffer and so release the memory later.

Attached patch fixes the regression introduced in Python 3.6 beta 1 by the 
change e20c7d8a8187 ("Issue #27781: Change file system encoding on Windows to 
UTF-8 (PEP 529)").

--
files: path_converter.patch
keywords: patch
messages: 276924
nosy: haypo, steve.dower
priority: normal
severity: normal
status: open
title: Windows: path_converter() leaks memory for Unicode filenames
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44744/path_converter.patch

___
Python tracker 

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



[issue28195] test_huntrleaks_fd_leak fails on Windows

2016-09-18 Thread STINNER Victor

STINNER Victor added the comment:

I modified the test_regrtest unit test because the test is too fragile, it 
expects a line on a specific line number.

But there is still a real memory leak detected by this unit test.

--

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Moved dictresize() discussion to http://bugs.python.org/issue28199

--

___
Python tracker 

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



[issue28195] test_huntrleaks_fd_leak fails on Windows

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 91285b24f1c2 by Victor Stinner in branch '3.6':
Fix test_huntrleaks_fd_leak() of test_regrtest
https://hg.python.org/cpython/rev/91285b24f1c2

--
nosy: +python-dev

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread Raymond Hettinger

New submission from Raymond Hettinger:

The dictresize() method unnecessarily copies the keys, values, and hashes as 
well as making insertions in the index table.   Only the latter step is 
necessary or desirable.

Here in the pure Python code for resizing taking from the original 
proof-of-concept code at https://code.activestate.com/recipes/578375

def _resize(self, n):
'''Reindex the existing hash/key/value entries.
   Entries do not get moved, they only get new indices.
   No calls are made to hash() or __eq__().

'''
n = 2 ** n.bit_length() # round-up to power-of-two
self.indices = self._make_index(n)
for index, hashvalue in enumerate(self.hashlist):
for i in Dict._gen_probes(hashvalue, n-1):
if self.indices[i] == FREE:
break
self.indices[i] = index
self.filled = self.used

And here is a rough sketch of what it would look like in the C code (very 
rough, not yet compileable):

static void
insert_indices_clean(PyDictObject *mp, Py_hash_t hash)
{
size_t i, perturb;
PyDictKeysObject *k = mp->ma_keys;
size_t mask = (size_t)DK_SIZE(k)-1;

i = hash & mask;
for (perturb = hash; dk_get_index(k, i) != DKIX_EMPTY;
 perturb >>= PERTURB_SHIFT) {
i = mask & ((i << 2) + i + perturb + 1);
}
dk_set_index(k, i, k->dk_nentries);
}

static int
dictresize(PyDictObject *mp, Py_ssize_t minused)
{
Py_ssize_t i, newsize;
PyDictKeyEntry *ep0;

/* Find the smallest table size > minused. */
for (newsize = PyDict_MINSIZE;
 newsize <= minused && newsize > 0;
 newsize <<= 1)
;
if (newsize <= 0) {
PyErr_NoMemory();
return -1;
}

/* Resize and zero-out the indices array */
realloc(dk->dk_indices, es * newsize);
memset(>dk_indices.as_1[0], 0xff, es * size);
dk->dk_size = size;

/* Loop over hashes, skipping NULLs, inserting new indices */
for (i = 0; i < mp->dk_nentries; i++) {
PyDictKeyEntry *ep = [i];
if (ep->me_value != NULL) {
insert_indices_clean(mp, ep->me_hash);
}
}
return 0;
}

--
components: Interpreter Core
messages: 276921
nosy: methane, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Compact dict resizing is doing too much work
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



[issue28198] heap-buffer-overflow in tok_nextc (Parser/tokenizer.c:954)

2016-09-18 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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Raymond, I think this is different issue.

--

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, raising an exception with a result as a payload is one option. Other 
option is to check a result. Something like:

def _compile_is_valid(value):
p, loc = value
return loc is None or loc == _locale.setlocale(_locale.LC_CTYPE)

def _compile_cache_if(value):
p, loc = value
return loc is not False

@lru_cache(_MAXCACHE, is_valid=_compile_is_valid, cache_if=_compile_cache_if)
def _compile1(pattern, flags):
# internal: compile pattern
if isinstance(pattern, _pattern_type):
if flags:
raise ValueError(
"cannot process flags argument with a compiled pattern")
return pattern, False
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled pattern")
p = sre_compile.compile(pattern, flags)
if flags & DEBUG:
return p, False
if not (p.flags & LOCALE):
return p, None
if not _locale:
return p, False
return p, _locale.setlocale(_locale.LC_CTYPE)

def _compile(pattern, flags):
p, loc = _compile1(pattern, flags)
return p

--

___
Python tracker 

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



[issue28198] heap-buffer-overflow in tok_nextc (Parser/tokenizer.c:954)

2016-09-18 Thread geeknik

New submission from geeknik:

As per the security team, I'm submitting this here as it doesn't appear 
exploitable.

Fuzzing Python 2.7.12 with AFL, ASAN and libdislocator.so on Debian 8.5 x64. 
(This might also affect Python 3.5) The attached 1-byte testcase triggers a 
heap-buffer-overflow: ~/python/Parser/tokenizer.c:954:28 in tok_nextc:

==9855==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625028ff 
at pc 0x0050fd06 bp 0x7ffdbb810a30 sp 0x7ffdbb810a28
READ of size 1 at 0x625028ff thread T0
#0 0x50fd05 in tok_nextc /root/python/Parser/tokenizer.c:954:28
#1 0x505c49 in tok_get /root/python/Parser/tokenizer.c:1232:17
#2 0x505c49 in PyTokenizer_Get /root/python/Parser/tokenizer.c:1681
#3 0x5012b4 in parsetok /root/python/Parser/parsetok.c:159:16
#4 0x502e7f in PyParser_ParseFileFlagsEx 
/root/python/Parser/parsetok.c:106:12
#5 0x7fe4a9 in PyParser_ASTFromFile /root/python/Python/pythonrun.c:1499:15
#6 0x7fe887 in PyRun_FileExFlags /root/python/Python/pythonrun.c:1354:11
#7 0x7fd3fc in PyRun_SimpleFileExFlags 
/root/python/Python/pythonrun.c:948:13
#8 0x7fc36b in PyRun_AnyFileExFlags /root/python/Python/pythonrun.c:752:16
#9 0x4fe9c4 in Py_Main /root/python/Modules/main.c:640:23
#10 0x7fb6e24b282f in __libc_start_main 
/build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
#11 0x42a898 in _start (/root/python/python+0x42a898)

0x625028ff is located 1 bytes to the left of 8192-byte region 
[0x62502900,0x62504900)
allocated by thread T0 here:
#0 0x4ca9c8 in malloc (/root/python/python+0x4ca9c8)
#1 0x504ed5 in PyTokenizer_FromFile /root/python/Parser/tokenizer.c:759:29

SUMMARY: AddressSanitizer: heap-buffer-overflow 
/root/python/Parser/tokenizer.c:954:28 in tok_nextc
Shadow bytes around the buggy address:
  0x0c4a7fff84c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fff84d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fff84e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fff84f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fff8500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4a7fff8510: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
  0x0c4a7fff8520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fff8530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fff8540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fff8550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fff8560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:   00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:   fa
  Heap right redzone:  fb
  Freed heap region:   fd
  Stack left redzone:  f1
  Stack mid redzone:   f2
  Stack right redzone: f3
  Stack partial redzone:   f4
  Stack after return:  f5
  Stack use after scope:   f8
  Global redzone:  f9
  Global init order:   f6
  Poisoned by user:f7
  Container overflow:  fc
  Array cookie:ac
  Intra object redzone:bb
  ASan internal:   fe
  Left alloca redzone: ca
  Right alloca redzone:cb
==9855==ABORTING

--
components: Interpreter Core
files: test00.gz
messages: 276917
nosy: geeknik
priority: normal
severity: normal
status: open
title: heap-buffer-overflow in tok_nextc (Parser/tokenizer.c:954)
type: crash
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file44743/test00.gz

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2016-09-18 Thread Robert Jordens

Robert Jordens added the comment:

It is still in cpython master e6e9ddd.

import asyncio
import socket
sock = socket.socket(family=socket.AF_BLUETOOTH,
 type=socket.SOCK_STREAM,
 proto=socket.BTPROTO_RFCOMM)
sock.setblocking(False)
addr = "00:12:34:56:78:99"
loop = asyncio.get_event_loop()
loop.run_until_complete(loop.sock_connect(sock, (addr, 1)))

Traceback (most recent call last):
  File "/home/rj/work/hxm/t.py", line 9, in 
loop.run_until_complete(loop.sock_connect(sock, (addr, 1)))
  File "/home/rj/src/cpython/Lib/asyncio/base_events.py", line 457, in 
run_until_complete
return future.result()
  File "/home/rj/src/cpython/Lib/asyncio/futures.py", line 292, in result
raise self._exception
  File "/home/rj/src/cpython/Lib/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
  File "/home/rj/src/cpython/Lib/asyncio/selector_events.py", line 416, in 
sock_connect
yield from resolved
  File "/home/rj/src/cpython/Lib/asyncio/futures.py", line 379, in __iter__
yield self  # This tells Task to wait for completion.
  File "/home/rj/src/cpython/Lib/asyncio/tasks.py", line 297, in _wakeup
future.result()
  File "/home/rj/src/cpython/Lib/asyncio/futures.py", line 292, in result
raise self._exception
  File "/home/rj/src/cpython/Lib/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/home/rj/src/cpython/Lib/socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -6] ai_family not supported

--

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Here is a rough (very rough and not compileable) sketch of the direction that 
resizing should take:

static void
insert_indices_clean(PyDictObject *mp, Py_hash_t hash)
{
size_t i, perturb;
PyDictKeysObject *k = mp->ma_keys;
size_t mask = (size_t)DK_SIZE(k)-1;

i = hash & mask;
for (perturb = hash; dk_get_index(k, i) != DKIX_EMPTY;
 perturb >>= PERTURB_SHIFT) {
i = mask & ((i << 2) + i + perturb + 1);
}
dk_set_index(k, i, k->dk_nentries);
}

static int
dictresize(PyDictObject *mp, Py_ssize_t minused)
{
Py_ssize_t i, newsize;
PyDictKeyEntry *ep0;

/* Find the smallest table size > minused. */
for (newsize = PyDict_MINSIZE;
 newsize <= minused && newsize > 0;
 newsize <<= 1)
;
if (newsize <= 0) {
PyErr_NoMemory();
return -1;
}

realloc(dk->dk_indicies, es * newsize);
memset(>dk_indices.as_1[0], 0xff, es * size);
dk->dk_size = size;

for (i = 0; i < mp->dk_nentries; i++) {
PyDictKeyEntry *ep = [i];
if (ep->me_value != NULL) {
insert_indices_clean(mp, ep->me_hash);
}
}
return 0;
}

--

___
Python tracker 

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



[issue28182] Expose OpenSSL verification results in SSLError

2016-09-18 Thread Christian Heimes

Christian Heimes added the comment:

You don't have to be concerned about additional arguments. 
fill_and_set_sslerror() is an internal helper function. In fact it's a helper 
function for two other helper functions. Let's postpone the discussion until 
the argument sizes grows out of proportion.

--

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Yes, I saw that.  If a function could raise a NoCache exception,  re._compile() 
could take advantage of it.  But I don't feel good about going down that path 
(adding coupling between the caching decorator and the cached function).  It 
would be better to keep the lru_cache API simple.  I already made the mistake 
of expanding the API for typed=True just to accommodate a single use case 
(re.compile).

--

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Parameters start and stop were added to the Sequence.index() mixin method in 
issue23086. These broke some concrete Sequence implementations.

--
nosy: +Devin Jeanpierre, rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

lru_cache can be used for re._compile() if add the ability to bypass the cache 
and to validate cached value.

--

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread SilentGhost

Changes by SilentGhost :


--
versions: +Python 3.7

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2016-09-18 Thread STINNER Victor

STINNER Victor added the comment:

It seems fair to keep the define for backwrad compatibility.

--

___
Python tracker 

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



[issue28151] testPythonOrg() of test_robotparser fails on validating python.org HTTPS certificate

2016-09-18 Thread STINNER Victor

STINNER Victor added the comment:

Thank you Berker! I'm quite sure that the issue is very old, like 1 year
old or more. And this fix is welcomed!

--

___
Python tracker 

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



[issue28197] range.index mismatch with documentation

2016-09-18 Thread Vedran Čačić

New submission from Vedran Čačić:

Look at this:

>>> from collections.abc import Sequence

>>> help(Sequence.index)
index(self, value, start=0, stop=None)
S.index(value, [start, [stop]]) -> integer -- return first index of 
value.
Raises ValueError if the value is not present.

>>> issubclass(range, Sequence)
True

>>> help(range.index)
index(...)
rangeobject.index(value, [start, [stop]]) -> integer -- return index of 
value.
Raise ValueError if the value is not present.

So far, so good. But:

>>> range(9).index(2, 1, 5)
TypeError: index() takes exactly one argument (3 given)

Of course it's not essential, but the docs shouldn't lie. And if range _is_ a 
Sequence, then it should have the complete interface of a Sequence. Including 
start and end arguments for .index: they are optional from the point of call, 
not from the point of implementation. :-)

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 276908
nosy: docs@python, veky
priority: normal
severity: normal
status: open
title: range.index mismatch with documentation
type: behavior
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



[issue23591] enum: Add Flags and IntFlags

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b56290a80ff7 by Ethan Furman in branch '3.6':
issue23591: fix flag decomposition and repr
https://hg.python.org/cpython/rev/b56290a80ff7

New changeset 7372c042e9a1 by Ethan Furman in branch 'default':
issue23591: fix flag decomposition and repr
https://hg.python.org/cpython/rev/7372c042e9a1

--

___
Python tracker 

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



[issue28182] Expose OpenSSL verification results in SSLError

2016-09-18 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

That looks much better. I should have create a subclass of SSLError.

Here's a minor concern: fill_and_set_sslerror adds a new argument for 
verification errors. If someone else wants to support more errors, this 
function would have more arguments, which sounds bad for me - or we can 
postpone discussions until there's really such a need?

--

___
Python tracker 

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



[issue27806] 2.7 32-bit builds fail on macOS 10.12 Sierra due to dependency on deleted header file QuickTime/QuickTime.h

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a8771f230c06 by Ned Deily in branch '2.7':
Issue #27806: add Aleks to Misc/ACKS.
https://hg.python.org/cpython/rev/a8771f230c06

--

___
Python tracker 

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



[issue28182] Expose OpenSSL verification results in SSLError

2016-09-18 Thread Christian Heimes

Christian Heimes added the comment:

Good work! I completely forgot that the SSL object holds the last verification 
error in its struct. This allows the ssl module to print some information when 
cert verification fails. It's still not perfect, because it is missing 
information about the the failing certificate. It's much better than no reason 
at all.

I took your patch and simplified it a bit. I removed the sub reason attribute, 
too. We can add it later and use an enum.IntEnum instead of the old hack.

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: unable to get local issuer certificate (_ssl.c:766)

--
Added file: http://bugs.python.org/file44742/ssl_certverifyerror.patch

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually most of optimization is not specific for new dict implementation.

--

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

We can still clean this up for Python 3.6.  We're in feature freeze, not 
development freeze.  The compact dict patch was very rough when it landed and 
is expected to continue to be polished so that the expected benefits are 
realized.

--
versions: +Python 3.6 -Python 3.7

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-18 Thread INADA Naoki

INADA Naoki added the comment:

xiang:
dictresize(d, n) may choose keysize==n (when n == 2**m) with this patch.

If there are any integer a such as ESTIMATE_SIZE(a) == n and n == 2**m and 
USABLE_FRACTION(n) == a - 1,
a items cannot be inserted into dict after dictresize(d, ESTIMATE_SIZE(a))

This is why ESTIMATE_SIZE should round up fraction.

--

___
Python tracker 

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



[issue25400] robotparser doesn't return crawl delay for default entry

2016-09-18 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue25400] robotparser doesn't return crawl delay for default entry

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5d910cfd288 by Berker Peksag in branch '3.6':
Issue #25400: RobotFileParser now correctly returns default values for 
crawl_delay and request_rate
https://hg.python.org/cpython/rev/d5d910cfd288

New changeset 911070065e38 by Berker Peksag in branch 'default':
Issue #25400: Merge from 3.6
https://hg.python.org/cpython/rev/911070065e38

--
nosy: +python-dev

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> Raymond: With such implementation keys, values and hashes are all
> organized together and there seems no _resize operation can only 
> adjust hashes without breaking the entire layout.

None of those needs to change during a resize.  Only indices array needs to be 
rebuilt.

--

___
Python tracker 

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



[issue28182] Expose OpenSSL verification results in SSLError

2016-09-18 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Here's a quick try. I didn't add tests and update docs as it's my first serious 
patch to CPython and I'm not sure whether my approach is OK or not.

--
keywords: +patch
Added file: http://bugs.python.org/file44741/expose-x509-verify-result.patch

___
Python tracker 

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



[issue25400] robotparser doesn't return crawl delay for default entry

2016-09-18 Thread Berker Peksag

Changes by Berker Peksag :


Added file: http://bugs.python.org/file44740/issue25400_v3.diff

___
Python tracker 

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



[issue25400] robotparser doesn't return crawl delay for default entry

2016-09-18 Thread Berker Peksag

Berker Peksag added the comment:

Here's an updated patch.

--
versions: +Python 3.7
Added file: http://bugs.python.org/file44739/issue25400_v2.diff

___
Python tracker 

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



[issue24363] httplib fails to handle semivalid HTTP headers

2016-09-18 Thread R. David Murray

R. David Murray added the comment:

I will try to review this in the not too distant future.  You can ping me if I 
don't get to it by next Saturday.

I think I'll probably prefer to call the flag something like 
_greedy_header_parsing, to reflect a change from assuming we've got body on a 
non-header-like line to assuming we've still got header if we haven't seen a 
blank line yet.  What we call the private version of the flag doesn't matter 
all that much, though.

--

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

LGTM. But why this change?

-#define ESTIMATE_SIZE(n)  (((n)*3) >> 1)
+#define ESTIMATE_SIZE(n)  (((n)*3+1) >> 1)

--

___
Python tracker 

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



[issue28194] Clean up some checks in dict implementation

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

Apply methane's comment, preserving the comment.

--
Added file: http://bugs.python.org/file44738/dict_clean_up_v2.patch

___
Python tracker 

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



[issue28115] Use argparse for the zipfile module

2016-09-18 Thread SilentGhost

SilentGhost added the comment:

Neither of those fit under definition of "permissible" modules. So, I would 
then suggest to close this issue and any further issues against CLI of those 
modules.

--

___
Python tracker 

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



[issue28194] Clean up some checks in dict implementation

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM if address methane's comment.

--

___
Python tracker 

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



[issue28115] Use argparse for the zipfile module

2016-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

They should be added. Otherwise we can't know that the code works as expected. 
You can use test_calendar.py or test_tarfile.py as a guide.

--

___
Python tracker 

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



[issue6087] distutils.sysconfig.get_python_lib gives surprising result when used with a Python build

2016-09-18 Thread Vinay Sajip

Vinay Sajip added the comment:

Updated patch to cover tests, and changed the implementation slightly. Tests 
pass on Linux and Windows (I'm not able to build on OS X). The patch is against 
the default branch but the diff should apply equally well to 3.6.

--
Added file: http://bugs.python.org/file44737/fix-6087.diff

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread INADA Naoki

INADA Naoki added the comment:

LGTM, thanks.

--

___
Python tracker 

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



[issue26661] python fails to locate system libffi

2016-09-18 Thread Christian Heimes

Christian Heimes added the comment:

Thanks Robert, I have been running into the same issue for a while.

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

___
Python tracker 

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



[issue26661] python fails to locate system libffi

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c4cec8f7c727 by Christian Heimes in branch '3.5':
Issue #26661: setup.py now detects system libffi with multiarch wrapper.
https://hg.python.org/cpython/rev/c4cec8f7c727

New changeset 18825546acbc by Christian Heimes in branch '3.6':
Issue #26661: setup.py now detects system libffi with multiarch wrapper.
https://hg.python.org/cpython/rev/18825546acbc

New changeset 35820a4a6967 by Christian Heimes in branch 'default':
Issue #26661: setup.py now detects system libffi with multiarch wrapper.
https://hg.python.org/cpython/rev/35820a4a6967

New changeset 2a3e4fa42464 by Christian Heimes in branch '2.7':
Issue #26661: setup.py now detects system libffi with multiarch wrapper.
https://hg.python.org/cpython/rev/2a3e4fa42464

--
nosy: +python-dev

___
Python tracker 

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



[issue28176] Fix callbacks race in asyncio.SelectorLoop.sock_connect

2016-09-18 Thread Berker Peksag

Berker Peksag added the comment:

For some reason, some tests fail randomly on FreeBSD buildbots. See also 
issue27784. I'm planning to apply the attached patch.

--
keywords: +patch
nosy: +koobs
Added file: http://bugs.python.org/file44736/issue28176_skip_tests.diff

___
Python tracker 

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



[issue26661] python fails to locate system libffi

2016-09-18 Thread Christian Heimes

Christian Heimes added the comment:

This affects Python 3.7 because our own copy of libffi was removed from 
'default'.

--
assignee:  -> christian.heimes
nosy: +christian.heimes
priority: normal -> high
versions: +Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue26610] test_venv.test_with_pip() fails when ctypes is missing

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 82bd70f83796 by Berker Peksag in branch '3.5':
Issue #26610: Skip test_with_pip if _ctypes is not available in OpenIndiana
https://hg.python.org/cpython/rev/82bd70f83796

--

___
Python tracker 

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



[issue28195] test_huntrleaks_fd_leak fails on Windows

2016-09-18 Thread Berker Peksag

Berker Peksag added the comment:

It looks like 
http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/11581 is 
first time that the test was failed.

Revisions (without documentation changes) in that build:

* 378e000a68785fdb3d74b3a930bc4ac5f6a04ce5
* fc8aaa073eb4253b84e8af6de7ea45e4a3724b28
* 48a1f97d03b4851ec6435453d319acdaeaf8becb
* 50cb3c6f5f725f07d7ac7388567f41e5950dd0fc
* d1dace3c9871037b350f88aaa1979b5a481f2a26

--
nosy: +benjamin.peterson, haypo

___
Python tracker 

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



[issue28196] ssl.match_hostname() should check for SRV-ID and URI-ID

2016-09-18 Thread Christian Heimes

Changes by Christian Heimes :


--
dependencies: +Support RFC4985 SRVName in SAN name

___
Python tracker 

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



[issue28196] ssl.match_hostname() should check for SRV-ID and URI-ID

2016-09-18 Thread Christian Heimes

New submission from Christian Heimes:

The ssl.match_hostname() function does not conform to RFC 6125 because it can 
fall back to Subject CN when a cert has no dNSName SAN (subject alternative 
name) but a SRVName otherName SAN or URI SAN.

---
https://tools.ietf.org/search/rfc6125#section-6.4.4

6.4.4.  Checking of Common Names

As noted, a client MUST NOT seek a match for a reference identifier
of CN-ID if the presented identifiers include a DNS-ID, SRV-ID,
URI-ID, or any application-specific identifier types supported by the
client.
---

For now it's not a security problem because no public CA in the CA/Browser 
Forum is allowed to issue certs with SRV-ID or URI-ID. I checked a couple of 
libraries and browers. OpenSSL, NSS/Firefox, GnuTLS, embedtls (Polar) and 
libcurl don't check for the present of SRV-ID or URI-ID either. Only Hynek's 
service_identity package follows the RFC to the letter. #28191 adds the ability 
to fetch SRV-ID entries.

--
assignee: christian.heimes
components: SSL
messages: 276882
nosy: christian.heimes
priority: normal
severity: normal
stage: test needed
status: open
title: ssl.match_hostname() should check for SRV-ID and URI-ID
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2016-09-18 Thread Stefan Behnel

Stefan Behnel added the comment:

Removing HAVE_LONG_LONG entirely causes breakage of third party code that uses 
this macro to enable PY_LONG_LONG support. Could you please always define it 
instead of removing it?

--
nosy: +scoder

___
Python tracker 

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



[issue28151] testPythonOrg() of test_robotparser fails on validating python.org HTTPS certificate

2016-09-18 Thread Berker Peksag

Berker Peksag added the comment:

test_robotparser is now green. I've opened issue 28195 for 
test_huntrleaks_fd_leak.

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



[issue28134] socket.socket(fileno=fd) does not work as documented

2016-09-18 Thread Christian Heimes

Christian Heimes added the comment:

I'm well aware that it does not work in all cases. However it works good enough 
in most cases. Right now the fileno argument must be considered broken because 
it leads to wrong results. It is a problem and possible security issue for a 
couple of use cases, e.g. passing of sockets through AF_UNIX AUX data or 
systemd socket activation.

On Windows it is less problematic because socket(filno) works correctly with 
WSAPROTOCOL_INFO. It's only broken for integer fd.

I have considered to set type, family and proto to 0 (unspec) when the 
getsockopt and getsockname fail.

I have a differnt ticket for the protocol issue, #27816.

--

___
Python tracker 

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



[issue28195] test_huntrleaks_fd_leak fails on Windows

2016-09-18 Thread Berker Peksag

New submission from Berker Peksag:

>From 
>http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/11654/steps/test/logs/stdio

==
FAIL: test_huntrleaks_fd_leak (test.test_regrtest.ArgsTestCase)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_regrtest.py",
 line 782, in test_huntrleaks_fd_leak
self.assertEqual(reflog, line2)
AssertionError: 'test[27 chars] [1, 2, 2] memory blocks, 
sum=5\ntest_regrtest[50 chars]=3\n' != 'test[27 chars] [1, 1, 1] file 
descriptors, sum=3\n'
- test_regrtest_huntrleaks leaked [1, 2, 2] memory blocks, sum=5
  test_regrtest_huntrleaks leaked [1, 1, 1] file descriptors, sum=3

--
components: Tests
messages: 276878
nosy: berker.peksag
priority: normal
severity: normal
stage: needs patch
status: open
title: test_huntrleaks_fd_leak fails on Windows
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28075] os.stat fails when access is denied

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 20c4ad866620 by Berker Peksag in branch '3.5':
Issue #28075: Fix test_access_denied in Python 3.5
https://hg.python.org/cpython/rev/20c4ad866620

--

___
Python tracker 

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



[issue28115] Use argparse for the zipfile module

2016-09-18 Thread SilentGhost

SilentGhost added the comment:

Given that at present zipfile CLI has no test or docs, and along with Guido's 
aversion for such tools in general, I'm not at all sure they should be added. 
In any case, here is the patch for the main part of conversion.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file44735/28115_2.diff

___
Python tracker 

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2016-09-18 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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2016-09-18 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



[issue28184] Trailing whitespace in C source code

2016-09-18 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



[issue28185] Tabs in C source code

2016-09-18 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



[issue28194] Clean up some checks in dict implementation

2016-09-18 Thread Xiang Zhang

New submission from Xiang Zhang:

The proposed patch cleans up some unnecessary parts in dict implementation 
especially NULL checks in lookup functions. There are four states a 
DictKeyEntry can be. Only in unused(empty) and dummy states me_key can be NULL. 
So NULL checks in used and pending states are not needed.

--
components: Interpreter Core
files: dict_clean_up.patch
keywords: patch
messages: 276875
nosy: haypo, methane, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: Clean up some checks in dict implementation
type: enhancement
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44734/dict_clean_up.patch

___
Python tracker 

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



[issue28151] testPythonOrg() of test_robotparser fails on validating python.org HTTPS certificate

2016-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 83bca958adc9 by Berker Peksag in branch '3.6':
Issue #28151: Use pythontest.net in test_robotparser
https://hg.python.org/cpython/rev/83bca958adc9

New changeset 4bfd91a45c81 by Berker Peksag in branch 'default':
Issue #28151: Merge from 3.6
https://hg.python.org/cpython/rev/4bfd91a45c81

--
nosy: +python-dev

___
Python tracker 

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



[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Xiang Zhang

Xiang Zhang added the comment:

Serhiy: Patch LGTM except two trivial comments on Rietveld.

Raymond: With such implementation keys, values and hashes are all organized 
together and there seems no _resize operation can only adjust hashes without 
breaking the entire layout.

--

___
Python tracker 

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



[issue10109] itertools.product with infinite iterator cause MemoryError.

2016-09-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Recipes for handling an infinite first iterator for product, or an infinite 
iterator for combinations (they could be similar), that use and build on the 
current functions, without the output order constraint, might be candidates for 
the recipe section.  I will probably write at least one of them for my own 
purposes someday.

--

___
Python tracker 

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



[issue28143] ASDL compatibility with Python 3 system interpreter

2016-09-18 Thread Malthe Borch

Malthe Borch added the comment:

I forgot to add "from __future__ import print_function" to the beginning of 
"asdl.py" and "spark.py". It should then work on Python 2.

That is, with the imported print-function, the incompatibilities that Martin 
pointed out are no longer there.

As for Windows, I would think that printing out CRLFs is the correct behavior? 
I don't use Windows personally.

--

___
Python tracker 

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