[issue32360] Save OrderedDict imports in various stdlibs.

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


--
resolution:  -> fixed

___
Python tracker 

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-02 Thread Gil Forcada

New submission from Gil Forcada :

Given the following code:

class MyClass(object):

@property
def my_function(self): pass

Parsing it with ast module, the lineno and col_offset of the ast.FunctionDef is 
reported to be where the decorator starts (i.e. line 3 column 4) rather than 
where the actual def statement is (i.e. line 4 column 4).

This is due to the decorator that is part of the ast.FunctionDef, but as  there 
can be multiple decorators (which they don't provide their own lineno and 
col_offset arguments) and they can span across multiple lines, there is no 
reliable way to actually know where the actual def statement starts physically.

See this bug report on flake8-builtins plugin (I'm the author) reported by 
@dhood user on github:

https://github.com/gforcada/flake8-builtins/issues/22#issuecomment-377961642

--
components: Library (Lib)
messages: 314861
nosy: gforcada
priority: normal
severity: normal
status: open
title: lineno and col_offset are wrong on function definitions with decorators
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset 0c533573c527c63dacab5921becb66dc3eb274c1 by Miss Islington (bot) 
in branch '3.7':
bpo-32360: Remove object_pairs_hook=OrderedDict examples (GH-5001)
https://github.com/python/cpython/commit/0c533573c527c63dacab5921becb66dc3eb274c1


--
nosy: +miss-islington

___
Python tracker 

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



[issue1222585] C++ compilation support for distutils

2018-04-02 Thread Ben Elliston

Ben Elliston  added the comment:

Is there a simple workaround that one can put into setup.py in the meantime?  I 
tried using compiler.compiler.remove('-Wstrict-prototypes') to no avail.

--
nosy: +bje

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6072

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2018-04-02 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 629338f1404ea9cd75e4fb0389a2fbe1b589de43 by INADA Naoki in branch 
'master':
bpo-32360: Remove object_pairs_hook=OrderedDict examples (GH-5001)
https://github.com/python/cpython/commit/629338f1404ea9cd75e4fb0389a2fbe1b589de43


--

___
Python tracker 

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



[issue33202] os.walk mentions os.listdir instead of os.scandir

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset fa5157e0499f7afdb59e220e3f4fdbf44adb5ac8 by Miss Islington (bot) 
in branch '3.6':
closes bpo-33202: fix os.walk mentioning os.listdir instead of os.scandir 
(GH-6335)
https://github.com/python/cpython/commit/fa5157e0499f7afdb59e220e3f4fdbf44adb5ac8


--

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


--
resolution:  -> fixed

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


--
status: open -> closed

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


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



[issue33202] os.walk mentions os.listdir instead of os.scandir

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset f6d1d65803f290dfe14048f17d8125f8093a61ec by Miss Islington (bot) 
in branch '3.7':
closes bpo-33202: fix os.walk mentioning os.listdir instead of os.scandir 
(GH-6335)
https://github.com/python/cpython/commit/f6d1d65803f290dfe14048f17d8125f8093a61ec


--
nosy: +miss-islington

___
Python tracker 

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



[issue33162] TimedRotatingFileHandler in logging module

2018-04-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

You can already roll your own, see

https://docs.python.org/3/library/logging.handlers.html#baserotatinghandler

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset 9a90826c9b64183713ebe5a98ec82423d9cae3ee by Miss Islington (bot) 
in branch '3.6':
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
https://github.com/python/cpython/commit/9a90826c9b64183713ebe5a98ec82423d9cae3ee


--

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset de755129a7a14cb3bee89aa256ca2e4a9a6605ce by Miss Islington (bot) 
in branch '3.7':
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
https://github.com/python/cpython/commit/de755129a7a14cb3bee89aa256ca2e4a9a6605ce


--
nosy: +miss-islington

___
Python tracker 

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



[issue33202] os.walk mentions os.listdir instead of os.scandir

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6071

___
Python tracker 

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



[issue33202] os.walk mentions os.listdir instead of os.scandir

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6070

___
Python tracker 

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



[issue33202] os.walk mentions os.listdir instead of os.scandir

2018-04-02 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset badb8948aaa8b669c4a6f675a0bc7d98e188 by Benjamin Peterson 
(Andrés Delfino) in branch 'master':
closes bpo-33202: fix os.walk mentioning os.listdir instead of os.scandir 
(GH-6335)
https://github.com/python/cpython/commit/badb8948aaa8b669c4a6f675a0bc7d98e188


--
nosy: +benjamin.peterson
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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6069

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6068

___
Python tracker 

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



[issue33199] PyDict_Copy() can leave 'ma_version_tag' uninitialized

2018-04-02 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset d1c82c5cc7be0c21dddf86fd19c1702f6218459b by INADA Naoki in branch 
'master':
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
https://github.com/python/cpython/commit/d1c82c5cc7be0c21dddf86fd19c1702f6218459b


--

___
Python tracker 

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



[issue33210] pkgutil.walk_packages gives incomplete results

2018-04-02 Thread Cyker Way

New submission from Cyker Way :

The current implementation of `pkgutil.walk_packages()` is confusing. Users may 
be given incomplete results while no exception is raised if they don't 
explicitly provide the `prefix` parameter. The doc says:

>   prefix is a string to output on the front of every module name on output.

But the fact is, `prefix` is not merely an output formatter at all. This 
function cannot handle an empty prefix (which is the default) and will often 
encounter import errors which are then simply ignored without an `onerror` 
function (which is default again).

See test program for details.

Doc:

https://docs.python.org/3.6/library/pkgutil.html#pkgutil.walk_packages

Source:

https://github.com/python/cpython/blob/3.6/Lib/pkgutil.py

--
components: Library (Lib)
files: test.py
messages: 314850
nosy: cykerway
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages gives incomplete results
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47516/test.py

___
Python tracker 

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



[issue33200] Optimize the empty set "literal"

2018-04-02 Thread Josh Rosenberg

Josh Rosenberg  added the comment:

I may have immediately latched onto this, dubbing it the "one-eyed monkey 
operator", the moment the generalized unpacking released.

I always hated the lack of an empty set literal, and enjoyed having this exist 
just to fill that asymmetry with the other built-in collection types (that 
said, I never use it in production code, nor teach it in classes I run).

--
nosy: +josh.r

___
Python tracker 

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



[issue30416] constant folding opens compiler to quadratic time hashing

2018-04-02 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

We should revert the breaking 2.7 changes.

On Sun, Mar 25, 2018, at 13:59, Gregory P. Smith wrote:
> 
> Change by Gregory P. Smith :
> 
> 
> --
> assignee:  -> benjamin.peterson
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue31814] subprocess_fork_exec more stable with vfork

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


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

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies: +Repeated Pickler.dump() doesn't reset the state in the C 
implementation of pickle
superseder: parameterize what serialization is used in multiprocessing -> 

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-02 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

test_clear_pickler_memo tested only the default protocol and fails when bump 
the default protocol to 4. For some reasons C implementation writes FRAME 
before PROTO when call Pickler.dump() repeatedly.

Python implementation:
b'\x80\x04\x95\x13\x00\x00\x00\x00\x00\x00\x00]\x94(\x8c\x07abcdefg\x94h\x01K,e.'
0: \x80 PROTO  4
2: \x95 FRAME  19
   11: ]EMPTY_LIST
   12: \x94 MEMOIZE(as 0)
   13: (MARK
   14: \x8c SHORT_BINUNICODE 'abcdefg'
   23: \x94 MEMOIZE(as 1)
   24: hBINGET 1
   26: KBININT144
   28: eAPPENDS(MARK at 13)
   29: .STOP
highest protocol among opcodes = 4

C implementation:
b'\x95\x15\x00\x00\x00\x00\x00\x00\x00\x80\x04]\x94(\x8c\x07abcdefg\x94h\x01K,e.'
0: \x95 FRAME  21
9: \x80 PROTO  4
   11: ]EMPTY_LIST
   12: \x94 MEMOIZE(as 0)
   13: (MARK
   14: \x8c SHORT_BINUNICODE 'abcdefg'
   23: \x94 MEMOIZE(as 1)
   24: hBINGET 1
   26: KBININT144
   28: eAPPENDS(MARK at 13)
   29: .STOP
highest protocol among opcodes = 4

--
components: Extension Modules
messages: 314847
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Repeated Pickler.dump() doesn't reset the state in the C implementation 
of pickle
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32174] nonASCII punctuation characters can not display in python363.chm.

2018-04-02 Thread wwq

wwq  added the comment:

And in python365.chm, also had some non ascii chars can not display.

--
Added file: https://bugs.python.org/file47515/QQ截图20180403090715.png

___
Python tracker 

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



[issue32174] nonASCII punctuation characters can not display in python363.chm.

2018-04-02 Thread wwq

wwq  added the comment:

In python365.chm, it loss the style in any page but can show in IE.

--
Added file: https://bugs.python.org/file47514/QQ截图20180403085952.png

___
Python tracker 

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



[issue31814] subprocess_fork_exec more stable with vfork

2018-04-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Greg, the flip side is that now any Python user is at the mercy of third-party 
library providers to do the right thing in terms of pthread_atfork(). It won't 
always be feasible for the user to influence the third party to fix the 
problem. You're right that vfork() won't solve the fundamental issue but will 
at least remove one case where it currently causes crashes.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue25170] 3.4.4, 3.4.5, 3.5.0, 3.5.1, 3.5.2 documentation archives missing

2018-04-02 Thread Ned Deily

Ned Deily  added the comment:

https://www.python.org/ftp/python/doc/3.5.0/ now contains copies of the 3.5.0 
final downloadable docs and no longer contains any pre-release versions.  
Thanks everyone!

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Should we bump the pickle protocol for shelve?

--

___
Python tracker 

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



[issue33207] typing.Generic does not correctly call super().__init_subclass__

2018-04-02 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


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

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


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

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


--
keywords: +patch, patch
pull_requests: +6064, 6065
stage:  -> patch review

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Now that Python 3.3 is dead and 3.4 is soon to follow, it's safe to bump 
DEFAULT_PROTOCOL to 4.

--
assignee:  -> lukasz.langa
resolution: duplicate -> 
status: closed -> open

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-02 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'll mull this over for while.  There is some merit in getting the various 
components to fit together more uniformly.  There's also the option of having 
choice() catch either a ZeroDivisionError or ValueError.

--

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Yury Selivanov

Yury Selivanov  added the comment:

3.5 is in security fixes only, so don't bother.

--

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

It would be hard to backport this to 3.5. Wordcode allows scanning back.

--

___
Python tracker 

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



[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-02 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, it was intended that the error checking (when required) occur at higher 
levels in the API rather than in the inner-most non-public utility function.  
Some calls to _randbelow cannot be zero or negative, so they shouldn't have to 
pay an penalty for the extra error check.  A comment to this effect should be 
added but I don't think the design should be changed.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6063

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6062

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset a68f2f0578bbf812fa2264d0e0bb388340d6e230 by Serhiy Storchaka in 
branch 'master':
bpo-29922: Improve error messages in 'async with' (GH-6352)
https://github.com/python/cpython/commit/a68f2f0578bbf812fa2264d0e0bb388340d6e230


--

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-02 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-02 Thread Michael Selik

Michael Selik  added the comment:

If you're going to tackle this problem, this should probably be solved for the 
general case of n <= 0 rather than just n == 0.

In [1]: import random

In [2]: class Random(random.Random):
   ...: def random(self):
   ...: return  super().random()
   ...:

In [3]: r = Random()

In [4]: r._randbelow(-1) # Should raise a ValueError
Out[4]: 0

But honestly, if someone is going to override ``random`` I think we can expect 
them to realize they're stepping into the deep end.

--
nosy: +selik

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Ned Deily

Ned Deily  added the comment:

> Can we backport it to 3.6 too?

I suppose so.  (Though you'll owe me if you break anything.)

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




[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Yury Selivanov

Yury Selivanov  added the comment:

> PR 6352 smells like a bug fix to me and I think it should be OK for 3.7.0b4.

Can we backport it to 3.6 too?

--

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Indeed, confirmed no `inet_pton()` on Windows in Python 2.7 :(.

--

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Ned Deily

Ned Deily  added the comment:

PR 6352 smells like a bug fix to me and I think it should be OK for 3.7.0b4.

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



[issue33208] Lib2to3 grammar.txt error

2018-04-02 Thread Lukasz

Change by Lukasz :


--
components: +IO
type:  -> crash
versions: +Python 2.7

___
Python tracker 

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



[issue33208] Lib2to3 grammar.txt error

2018-04-02 Thread Lukasz

New submission from Lukasz :

Hello I have problem with script
Im am totaly beginner in python
I'm using Qpython ( python 2.7 on android)

So  this  is  my error:
/data/user/0/org.qpython.qpy/files/bin/qpython-android5.sh 
"/storage/emulated/0/qpython/scripts/InstaPy-master/quickstart.py" && exit
ipts/InstaPy-master/quickstart.py" && exit <
Traceback (most recent call last):
  File "/storage/emulated/0/qpython/scripts/InstaPy-master/quickstart.py", line 
7, in 
from instapy import InstaPy
  File 
"/storage/emulated/0/qpython/scripts/InstaPy-master/instapy/__init__.py", line 
2, in 
from .instapy import InstaPy
  File "/storage/emulated/0/qpython/scripts/InstaPy-master/instapy/instapy.py", 
line 22, in 
from .clarifai_util import check_image
  File 
"/storage/emulated/0/qpython/scripts/InstaPy-master/instapy/clarifai_util.py", 
line 3, in 
from clarifai.rest import ClarifaiApp, Image as ClImage
  File 
"/storage/emulated/0/qpython/lib/python2.7/site-packages/clarifai/rest/__init__.py",
 line 3, in 
from .client import ApiClient, ApiError, UserError, TokenError
  File 
"/storage/emulated/0/qpython/lib/python2.7/site-packages/clarifai/rest/client.py",
 line 21, in 
from past.builtins import basestring
  File 
"/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/future-0.16.0-py2.7.egg/past/__init__.py",
 line 88, in 
from past.translation import install_hooks as autotranslate
  File 
"/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/future-0.16.0-py2.7.egg/past/translation/__init__.py",
 line 42, in 
from lib2to3.refactor import RefactoringTool
  File 
"/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/refactor.py", line 
27, in 
  File 
"/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/fixer_util.py", 
line 9, in 
  File "/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/pygram.py", 
line 32, in 
  File 
"/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/pgen2/driver.py", 
line 121, in load_grammar
  File 
"/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/pgen2/pgen.py", 
line 385, in generate_grammar
  File 
"/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/pgen2/pgen.py", 
line 15, in __init__
IOError: [Errno 20] Not a directory: 
'/data/user/0/org.qpython.qpy/files/lib/python27.zip/lib2to3/Grammar.txt'
1|dream2lte:/ $

--
messages: 314830
nosy: Lukasz00500
priority: normal
severity: normal
status: open
title: Lib2to3  grammar.txt error

___
Python tracker 

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



[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Will T

Will T  added the comment:

Done: https://bugs.python.org/issue33207 - thanks for the quick response!

--

___
Python tracker 

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



[issue33207] typing.Generic does not correctly call super().__init_subclass__

2018-04-02 Thread Ned Deily

Change by Ned Deily :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue33207] typing.Generic does not correctly call super().__init_subclass__

2018-04-02 Thread Will T

New submission from Will T :

Per the docs ( 
https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__ ) 
this should be chain-calling super but currently doesn't, and thus breaks base 
classes listed after it which depend on this functionality. Attached a test for 
a real-world usecase of mine. Originally noted in 
https://bugs.python.org/issue32162? but on a new ticket as requested. Thanks :)

--
components: Library (Lib)
files: generic_init_subclass.py
messages: 314828
nosy: wrmsr
priority: normal
severity: normal
status: open
title: typing.Generic does not correctly call super().__init_subclass__
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file47513/generic_init_subclass.py

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This issue looks unrelated to issue25538.

PR 6352 improves error messages without changing bytecode. It is so simple that 
could be backported to 3.7 if Ned approves this.

But it conflicts with issue32949. This way will not work after merging any of 
current issue32949 PRs. We will have to find other way for issue32949.

--
nosy: +Mark.Shannon, ned.deily, serhiy.storchaka
superseder: Traceback from __exit__ method is misleading -> 

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2018-04-02 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +6061
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



[issue20104] expose posix_spawn(p)

2018-04-02 Thread Ned Deily

Ned Deily  added the comment:

Thanks for adding the doc updates.  There are a few rendering issues:  
https://docs.python.org/3.7/library/os.html#os.posix_spawn

--

___
Python tracker 

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



[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Thanks Will!

I think this is actually a different (although very similar issue). It looks 
like it is easy to fix. Could you please open a separate issue (and mention it 
here)? Also could you please provide a typical example when this breaks so that 
I can add an appropriate test with the fix?

--

___
Python tracker 

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



[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Will T

Will T  added the comment:

I believe I'm experiencing a related bug in the new (3.7) version 
unfortunately. The current version of typing.Generic.__init_subclass__ isn't 
chaining to super(Generic, cls).__init_subclass__, meaning Generic's position 
in class bases can prevent subsequent bases from working properly. I can 
currently work around it with this unsightly hack but it's obviously suboptimal:

_old_generic_init_subclass = object.__getattribute__(ta.Generic, 
'__init_subclass__').__func__
@classmethod  # noqa
def _new_generic_init_subclass(cls, *args, **kwargs):  # noqa
_old_generic_init_subclass(cls, *args, **kwargs)
super(ta.Generic, cls).__init_subclass__(*args, **kwargs)
ta.Generic.__init_subclass__ = _new_generic_init_subclass  # noqa

--
nosy: +wrmsr

___
Python tracker 

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



[issue33162] TimedRotatingFileHandler in logging module

2018-04-02 Thread Ned Deily

Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue32216] Document PEP 557 Data Classes (dataclasses module)

2018-04-02 Thread Lino Mastrodomenico

Lino Mastrodomenico  added the comment:

Friendly ping, there's still no documentation for this wonderful new module and 
there's only one planned beta left for 3.7 before the release candidates.

Needless to say, https://www.python.org/dev/peps/pep-0557/ has lots of 
information that could be a starting point.

--
nosy: +mastrodomenico

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Zachary, thank you for noticing that Twisted is involved. inet_pton definitely 
exists on Windows 2.7.14, but it turns out that Twisted monkey-patches it if 
`socket.inet_pton(socket.AF_INET6, "::")` fails.

Aha! - but this suggests that Window's Python 2.7.14 implementation of 
`socket.inet_pton()` has a bug in that it fails to recognize '::' as the the 
IPv6 unspecified address 0:0:0:0:0:0:0:0, so `socket.inet_pton(socket.AF_INET6, 
"::")` fails. I wonder if this exists on Windows Python3 implementations?

--

___
Python tracker 

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



[issue32861] urllib.robotparser: incomplete __str__ methods

2018-04-02 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

> But two unnecessary trailing newlines should be kept for compatibility in 
> maintained versions.

Yup, that sounds good to me. It doesn't seem like any RFC requirements. It's 
just kept for the compatibility and we can do away with it in 3.8

--

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Zachary Ware

Zachary Ware  added the comment:

Your traceback seems to include both pika and twisted, and as best I can tell, 
`socket.inet_pton` does not exist on Windows in Python 2.7.  If I've diagnosed 
this incorrectly, please reopen the ticket with a reproducer that does not 
depend on pika or twisted.

--
resolution:  -> third party
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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-02 Thread Guido van Rossum

Guido van Rossum  added the comment:

That's rather disturbing, and none of that is reflected in the zipimport docs. 
Is there at least a bpo issue about it? I may be the last person in the world 
to still recommend putting a zipfile on sys.path -- I used to believe it's 
faster than directory searches, is that no longer the case?

--

___
Python tracker 

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



[issue30760] configparse module in python3 can not write '%' to config file

2018-04-02 Thread Łukasz Langa

Change by Łukasz Langa :


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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

In the context of this issue: zipimport doesn't properly lock on imports 
happening in multiple threads at the same time. This causes one thread to 
receive a partially imported module while the other thread is still performing 
the import.

zipimport also doesn't properly check __pycache__ directories but *does* look 
for old-style .pyc files next to the corresponding .py file.

IIRC Brett chooses not to deal with zipimport's warts and has no time to 
rewrite it in Python. Since the rest of the core team is less qualified, they 
steer clear, too.

So, don't use zipimport.

--

___
Python tracker 

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



[issue32380] functools.singledispatch interacts poorly with methods

2018-04-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

+1

--

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-04-02 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks!  :-)

--

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

This behavior goes against the socket documentation 
https://docs.python.org/2/library/socket.html which states "Supported values 
for address_family are currently AF_INET and AF_INET6. If the IP address string 
ip_string is invalid, *socket.error* will be raised."

--

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Change by Vitaly Kruglikov :


--
type:  -> behavior

___
Python tracker 

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



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

New submission from Vitaly Kruglikov :

I am seeing this with `socket.AF_INET6` on Windows running python 2.7.14
```
[00:02:33]   File "C:\projects\pika\pika\adapters\host_tcp_connector.py", line 
153, in _check_already_resolved
[00:02:33] socket.inet_pton(socket.AF_INET6, 'localhost')
[00:02:33]   File "C:\Python27\lib\site-packages\twisted\python\compat.py", 
line 68, in inet_pton
[00:02:33] raise ValueError("Illegal characters: %r" % (''.join(x),))
[00:02:33] ValueError: Illegal characters: 't'
```

With `socket.AF_INET`, `socket.inet_pton(socket.AF_INET, 'localhost')` raises 
`socket.error` as expected.

For comparison, with Python 2.7.10 running on OS X, both AF_INET and AF_INET6 
raise `socket.error`.

--
components: Library (Lib), Windows
messages: 314814
nosy: paul.moore, steve.dower, tim.golden, vitaly.krug, zach.ware
priority: normal
severity: normal
status: open
title: Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError 
instead of socket.error
versions: Python 2.7

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset 306559e6ca15b86eb230609f484f48132b7ca383 by Miss Islington (bot) 
in branch '3.6':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/306559e6ca15b86eb230609f484f48132b7ca383


--

___
Python tracker 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


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

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset fa91aff07c16ad48a63580c2909934be92a5e9c8 by Miss Islington (bot) 
in branch '3.7':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/fa91aff07c16ad48a63580c2909934be92a5e9c8


--

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6059

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6058

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset 55966f3a0d5f1bf823bd22ce1abbde267b06552f by Terry Jan Reedy in 
branch 'master':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/55966f3a0d5f1bf823bd22ce1abbde267b06552f


--

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
pull_requests: +6057

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Yes, still correct, as a keyword.  Legal "x or''" is colored as "x"  
"or"  "''" .  Legal "if'':" is colored as "if"  "''" 
 ":" ".  New PR revises colorizer test and add the above.

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think https://searchcode.com/ may have a larger indexing base than GitHub 
alone.

And, yes, you'll see many duplicates of the CPython source code... Visual 
inspection may be needed :-/

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-02 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks Antoine.

Do you have a good way for searching third party projects?  I searched on 
Github and I'm getting a lot of references to the CPython filenames.  I don't 
know how to check if anyone is making calls to the function.  But, maybe that's 
the point and it can't be removed if there's a chance that anyone uses it?  
Thanks!

This is what I tried on Github:
PyGen_NeedsFinalizing -filename:ceval -filename:genobject -filename:gcmodule

--

___
Python tracker 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-02 Thread Serhiy Storchaka

Change 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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-02 Thread INADA Naoki

INADA Naoki  added the comment:

# cap2.json is master (used*2 + dk_size/2)
# used3.json is patched (used*3)
$ ./python-master -m perf compare_to cap2.json used3.json  -G
Slower (2):
- rand_access(size=20): 2.67 ms +- 0.01 ms -> 2.80 ms +- 0.04 ms: 1.05x slower 
(+5%)
- rand_access(size=10): 2.70 ms +- 0.03 ms -> 2.80 ms +- 0.04 ms: 1.04x slower 
(+4%)

Faster (1):
- rand_access(size=50): 2.76 ms +- 0.06 ms -> 2.74 ms +- 0.02 ms: 1.01x faster 
(-1%)

Benchmark hidden because not significant (5): rand_access(size=2), 
rand_access(size=5), rand_access(size=100), rand_access(size=200), 
rand_access(size=500)

--
Added file: https://bugs.python.org/file47512/dict_rand.py

___
Python tracker 

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



[issue32623] Resize dict on del/pop

2018-04-02 Thread INADA Naoki

Change by INADA Naoki :


--
dependencies: +GROWTH_RATE prevents dict shrinking

___
Python tracker 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-02 Thread INADA Naoki

New submission from INADA Naoki :

GROWTH_RATE is changed from (used*2) to (used*2 + dk_size/2) in #17563, at 
Python 3.4.
It was for avoid resizing dict for massive del/insert use case, by increasing 
possibility of overwriting DUMMY entry.

>From Python 3.6, there are no DUMMY entry.  While there are dummy keys, we 
>resize (repack) when entries are full.
So there are no benefit from "possibility of overwriting dummy entry".

(Of course, there are still benefit from slow repacking rate for new dict.
So I don't propose to change it back to (used*2), but (used*3).)


This GROWTH_RATE prevents dict is shrinked in insertion_resize().

For example, consider this dict:

>>> d = dict.fromkeys(range(10900))
>>> len(d)
10900
>>> sys.getsizeof(d)
295008
>>> for i in range(10900):
... del d[i]
...
>>> len(d)
0
>>> sys.getsizeof(d)
295008

`del d[i]` doesn't shrink the dict.  This is another issue (#32623).

Current dk_size is 16384 and entries length is dk_size * 2 // 3 = 10922.
So dictresize will called when next 923 entries are added.

New dk_size is round_up_to_power_of_two(922 + 16384/2) = 16384.
So dict is not shrinked!

>>> for i in range(923):
... d[i] = i
...
>>> sys.getsizeof(d)
295008

round_up_to_power_of_two(used + dk_size/2) means dict is shrinked only when 
used == 0.

I propose changing GROWTH_RATE again to `used*3` from `used*2 + dk_size/2`

In case of dict growing without deletion, dk_size is doubled for each resize as 
current behavior.
When there are deletion, dk_size is growing aggressively than Python 3.3 
(used*2 -> used*3).  And it allows dict shrinking after massive deletions.

>>> import sys
>>> d = dict.fromkeys(range(10900))
>>> sys.getsizeof(d)
295008
>>> for i in range(10900):
... del d[i]
...
>>> len(d)
0
>>> sys.getsizeof(d)
295008
>>> for i in range(923):
... d[i] = i
...
>>> sys.getsizeof(d)
36968


I want to backport this change to Python 3.7.  While it's beta3, "dict can't be 
shrinked unless empty" behavior looks resource usage bug to me.

--
components: Interpreter Core
messages: 314806
nosy: Mark.Shannon, Yury.Selivanov, eric.snow, inada.naoki, rhettinger, vstinner
priority: normal
severity: normal
status: open
title: GROWTH_RATE prevents dict shrinking
type: resource usage
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Is ''or'' correctly colorized?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset 16cf84b4fbe78f9d876e0335f33459f1b92b7bf0 by Miss Islington (bot) 
in branch '3.6':
bpo-33204: IDLE: consistently color invalid string prefixes (GH-6344)
https://github.com/python/cpython/commit/16cf84b4fbe78f9d876e0335f33459f1b92b7bf0


--

___
Python tracker 

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



[issue33204] IDLE: remove \b from colorizer string prefix

2018-04-02 Thread miss-islington

miss-islington  added the comment:


New changeset 6130675efeb3c23cebc43ab07c49eb62cd03cacf by Miss Islington (bot) 
in branch '3.7':
bpo-33204: IDLE: consistently color invalid string prefixes (GH-6344)
https://github.com/python/cpython/commit/6130675efeb3c23cebc43ab07c49eb62cd03cacf


--
nosy: +miss-islington

___
Python tracker 

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