[issue29952] "keys and values" is preferred to "keys and elements" for name of dict constituent

2017-03-30 Thread INADA Naoki

INADA Naoki added the comment:


New changeset cdcac039fb447f2ab04efcacbe663751bb2cb4ec by INADA Naoki 
(cocoatomo) in branch 'master':
bpo-29952: Use usual terminology of dict (GH-917)
https://github.com/python/cpython/commit/cdcac039fb447f2ab04efcacbe663751bb2cb4ec


--
nosy: +inada.naoki

___
Python tracker 

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



[issue29951] PyArg_ParseTupleAndKeywords exception messages containing "function"

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM in general. I was going to make similar changes.

While we a here, maybe add the function name to other TypeError messages 
specific to the function? "Required argument '%U' (pos %d) not found" and 
"Argument given by name ('%U') and position (%d)", but not to "keywords must be 
strings".

Classified this as an enhancement.

--
components: +Interpreter Core
nosy: +serhiy.storchaka
stage:  -> patch review
type: behavior -> enhancement
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



[issue29952] "keys and values" is preferred to "keys and elements" for name of dict constituent

2017-03-30 Thread Kinebuchi Tomohiko

Changes by Kinebuchi Tomohiko :


--
pull_requests: +818

___
Python tracker 

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



[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-03-30 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
nosy: +palaviv

___
Python tracker 

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



[issue29881] Add a new private API clear private variables, which are initialized once, at Python shutdown

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree with your rationale Nick, but _Py_SET_FINALIZED is a little too long 
and highlight only the second function of the macro. I don't have good name.

--

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2017-03-30 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +817

___
Python tracker 

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



[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-03-30 Thread Dominic Mayers

Dominic Mayers added the comment:

On the other hand, it occurs to me that this seems way more flexible than 
passing the object through the server, because you share the factory with the 
server, not only the object. This means that you could even change the type of 
the handler while the server is running !

--

___
Python tracker 

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



Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread Pavol Lisy
On 3/30/17, INADA Naoki  wrote:
> Maybe, this commit make this regression.
>
> https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6
>
> Old:
> minused = (so->used + other->used)*2  (L619)
>
> New:
> minused = so->used + other->used  (L620)
> minused = (minused > 5) ? minused * 2 : minused * 4;  (L293)
>
> So size of small set is doubled.
>
> $ /usr/bin/python3
> Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
> [GCC 6.2.0 20160927] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import sys
 s = set(range(10))
 sys.getsizeof(frozenset(s))
> 736

>
> $ python3
> Python 3.6.0 (default, Dec 30 2016, 20:49:54)
> [GCC 6.2.0 20161005] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import  sys
 s = set(range(10))
 sys.getsizeof(frozenset(s))
> 1248

>
>
>
> On Fri, Mar 31, 2017 at 2:34 AM, INADA Naoki 
> wrote:
>> I reproduced the issue.
>> This is very usual, memory usage issue.  Slashing is just a result of
>> large memory usage.
>>
>> After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and
>> 30GB on Python 3.6.
>> And Python 3.6 starts slashing in 2nd optimization pass.
>>
>> I enabled tracemalloc while 1st pass.  Results is end of this mail.
>> It seems frozenset() cause regression, but I'm not sure yet.
>> I don't know what is contents of frozenset yet.  (I know almost
>> nothing about this application).
>>
>> Jan, do you know about what this is?
>> Could you make script which just runs `transitive_closure(edges)` with
>> edges similar to
>> `log_reduction.py spaun`?
>>
>> I'll dig into it later, maybe next week.
>>
>> ---
>> Python 3.6.1
>> 1191896 memory blocks: 22086104.2 KiB
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 85
>> reachables[vertex] = frozenset(reachables[vertex])
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 410
>> self.dependents = transitive_closure(self.dg.forward)
>> 602986 memory blocks: 51819.1 KiB
>>   File "", line 14
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 634
>> first_view=None, v_offset=0, v_size=0, v_base=None)
>>
>> Python 3.5.3
>> 1166804 memory blocks: 6407.0 KiB
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 85
>> reachables[vertex] = frozenset(reachables[vertex])
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 410
>> self.dependents = transitive_closure(self.dg.forward)
>> 602989 memory blocks: 51819.3 KiB
>>   File "", line 14
>>   File
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 634
>> first_view=None, v_offset=0, v_size=0, v_base=None)
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Interesting.

1. using set_table_resize with growing factor 2 or 4 doesn't seem to
be optimal for constructing (immutable) frozenset from set.

2. growth factor 2 could be too big too (
https://en.wikipedia.org/wiki/Dynamic_array#Growth_factor
,https://github.com/python/cpython/blob/80ec8364f15857c405ef0ecb1e758c8fc6b332f7/Objects/listobject.c#L58
)

PL.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29881] Add a new private API clear private variables, which are initialized once, at Python shutdown

2017-03-30 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm +1 for _Py_SET_FINALIZED with the semantics Serhiy suggests, and +0 for 
_Py_SET_ONCE.

My rationale for that preference is that _Py_SET_ONCE is a misnomer in the 
presence of

* multiple Py_Initialize/Py_Finalize cycles; and/or
* _Py_SETREF calls that replace the value to be finalized

 while _Py_SET_FINALIZED remains accurate in both cases.

--

___
Python tracker 

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



[issue29952] "keys and values" is preferred to "keys and elements" for name of dict constituent

2017-03-30 Thread Kinebuchi Tomohiko

New submission from Kinebuchi Tomohiko:

In the section "6.10.1. Value comparisons" [1]_::

   Equality comparison of the keys and elements enforces reflexivity.

would be

   Equality comparison of the keys and values enforces reflexivity.

because we usually call an entry of dict as "key-value pair".

.. [1] https://docs.python.org/3.6/reference/expressions.html#value-comparisons

--
assignee: docs@python
components: Documentation
messages: 290890
nosy: cocoatomo, docs@python
priority: normal
severity: normal
status: open
title: "keys and values" is preferred to "keys and elements" for name of dict 
constituent
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



[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, there's a very similar instance-method-reuse related problem described 
in http://bugs.python.org/issue29270, where ctypes re-uses a class namespace is 
define a swapped-endianness version of the originally defined class.

The easiest place to deflect conflicts is at the point where bound instance 
methods are created:


>>> bound_method = MyList().insert
>>> bound_method.__self__.__class__

>>> bound_method.__func__.__closure__[0].cell_contents

>>> bound_method.__self__.__class__ is 
>>> bound_method.__func__.__closure__[0].cell_contents
False

However, that method of detection only works for plain instance methods that 
only close over the `__class__` variable: as soon as you wrap them in a 
decorator, you may not have easy access to the `__closure__` attribute any 
more, and if the method has closure references to more than just `__class__`, 
then it's a bit more work to find the right closure index from outside the 
function.

--

___
Python tracker 

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



[issue29946] compiler warning "sqrtpi defined but not used"

2017-03-30 Thread Xiang Zhang

Changes by Xiang Zhang :


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



[issue29949] sizeof set after set_merge() is doubled from 3.5

2017-03-30 Thread INADA Naoki

INADA Naoki added the comment:

https://gist.github.com/methane/8faf12621cdb2166019bbcee65987e99
This patch fixes the regression.

But I think it is still larger than idiomatic.  See this code:

code:
minused *= 2;
/* Find the smallest table size > minused. */
/* XXX speed-up with intrinsics */
for (newsize = PySet_MINSIZE;
 newsize <= minused && newsize > 0;
 newsize <<= 1)
;

When original minused is X, newsize will be about 2X ~ 4X.

For set.add(), preserving extra space for further add() make sense.
But for set_merge(), intention is avoiding repeated resize while merging.
There may be not "further add()", especially for `frozenset(s)`.
So 30% ~ 60% seems better than 25% ~ 50%.

How do you think, Raymond?

--

___
Python tracker 

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



[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-03-30 Thread Dominic Mayers

Changes by Dominic Mayers :


--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-03-30 Thread Dominic Mayers

Dominic Mayers added the comment:

Finally, I looked around and people just use the server to pass any extra 
parameter. I do find it awkward, but it works and it is simple, in fact simpler 
than having to define a factory object. I don't close it, because I will be 
happy to see another opinion. I would use this factory approach for myself, 
because I am just not comfortable to add an attribute to a server that would 
not even look at it, but maybe that it just me.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-03-30 Thread Dominic Mayers

Dominic Mayers added the comment:

One way to make the factory optional is to offer a MixIn. I attached a file 
with a FactoryMixIn. It's just that I find it awkward that the proposed 
approach is to pass the extra parameters in a subclassed server. More modern 
approaches should also be offered.

--
resolution: rejected -> 
status: closed -> open
Added file: http://bugs.python.org/file46768/factorymixinclass

___
Python tracker 

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



Re: error in syntax description for comprehensions?

2017-03-30 Thread Terry Reedy

On 3/30/2017 4:57 PM, Boylan, Ross wrote:

https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
describes the syntax for comprehensions as
comprehension ::=  expression comp_for
comp_for  ::=  [ASYNC] "for" target_list "in" or_test [comp_iter]
comp_iter ::=  comp_for | comp_if
comp_if   ::=  "if" expression_nocond [comp_iter]

Is the comp_for missing an argument after "in"?


The or_test *is* the 'argument'.


One has to follow the definition of or_test and its components,

> but I can't find anything that results to a single variable
> or expression.

An or_test *is* a single expression.  Like all python expressions, it 
evaluates to a python object.  In this case, the object is passed to 
iter() and so the object must be an iterable.


>>> a, b = None, range(3)
>>> a or b
range(0, 3)
>>> for i in a or b: print(i)

0
1
2

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread MRAB

On 2017-03-30 19:04, INADA Naoki wrote:

Maybe, this commit make this regression.

https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6

Old:
minused = (so->used + other->used)*2  (L619)

New:
minused = so->used + other->used  (L620)
minused = (minused > 5) ? minused * 2 : minused * 4;  (L293)

So size of small set is doubled.

$ /usr/bin/python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sys
s = set(range(10))
sys.getsizeof(frozenset(s))

736




$ python3
Python 3.6.0 (default, Dec 30 2016, 20:49:54)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.

import  sys
s = set(range(10))
sys.getsizeof(frozenset(s))

1248



Copying a small set _might_ double its memory usage.


Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 
bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> s = set(range(10))
>>> sys.getsizeof(s)
736
>>> sys.getsizeof(set(s))
736
>>>
>>> sys.getsizeof(set(set(s)))
736


Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit 
(AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> s = set(range(10))
>>> sys.getsizeof(s)
736
>>> sys.getsizeof(set(s))
1248
>>>
>>> sys.getsizeof(set(set(s)))
1248
>>>

--
https://mail.python.org/mailman/listinfo/python-list


[issue29951] PyArg_ParseTupleAndKeywords exception messages containing "function"

2017-03-30 Thread Michael Seifert

Changes by Michael Seifert :


--
pull_requests: +816

___
Python tracker 

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



[issue29951] PyArg_ParseTupleAndKeywords exception messages containing "function"

2017-03-30 Thread Michael Seifert

New submission from Michael Seifert:

Some exceptions thrown by `PyArg_ParseTupleAndKeywords` refer to "function" or 
"this function" even when a function name was specified.

For example:

>>> import bisect
>>> bisect.bisect_right([1,2,3,4], 2, low=10)
TypeError: 'low' is an invalid keyword argument for this function

Wouldn't it be better to replace the "this function" part (if given) with the 
actual function name?

--
messages: 290885
nosy: MSeifert
priority: normal
severity: normal
status: open
title: PyArg_ParseTupleAndKeywords exception messages containing "function"
type: behavior
versions: 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



Re: error in syntax description for comprehensions?

2017-03-30 Thread Ned Batchelder
On Thursday, March 30, 2017 at 4:59:03 PM UTC-4, Boylan, Ross wrote:
> https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
> describes the syntax for comprehensions as
> comprehension ::=  expression comp_for
> comp_for  ::=  [ASYNC] "for" target_list "in" or_test [comp_iter]
> comp_iter ::=  comp_for | comp_if
> comp_if   ::=  "if" expression_nocond [comp_iter]
> 
> Is the comp_for missing an argument after "in"?
> One has to follow the definition of or_test and its components, but I can't 
> find anything that results to a single variable or expression.
> 
> Actually, I'm not sure what or_test would do there either with or  without an 
> additional element following "in". 


Syntax grammars can be obtuse. An or_test can be an and_test, which
can be a not_test, which can be a comparison.  It continues from there.
The whole chain of "can be" is:

or_test
and_test
not_test
comparison
or_expr
xor_expr
and_expr
shift_expr
a_expr
m_expr
u_expr
power
primary
atom
identifier

... and identifier is what you are looking for.

--Ned.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29533] urllib2 works slowly with proxy on windows

2017-03-30 Thread Steve Dower

Steve Dower added the comment:

I think the point is that we don't want to be grabbing settings like this from 
other configuration locations. Ideally, there'd be a way to provide a list of 
"don't bypass the proxy for these names", which a caller could then read from 
the IE configuration if they want.

The other part of the problem is it seems that nobody on this thread (apart 
from perhaps you) understands exactly what's going on here :) You may want to 
post to python-dev and see if anyone who understands the intricacies of how 
gethostbyaddr() should/does work is willing to chime in.

--

___
Python tracker 

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



[issue29950] Rename SlotWrapperType to WrapperDescriptorType

2017-03-30 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

The name SlotWrapperType was added in #29377 but it added the type based on the 
repr of the object instead of it's type as `type(object.__init__)` results in. 

I proposed this be named to WrapperDescriptorType to avoid and any unecessary 
confusion down the line.

--
components: Library (Lib)
messages: 290883
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Rename SlotWrapperType to WrapperDescriptorType
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



[issue29251] Class __dict__ is only a mapping proxy

2017-03-30 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

I believe the docs defined that, usually using a bold "CPython implementation 
detail" sentence.

It seems like it's something that would be considered an implementation detail, 
though, according to Raymond's answer here: 
http://stackoverflow.com/questions/32720492/why-is-a-class-dict-a-mappingproxy

Changing it to just state it's a mapping definitely looks like the safest 
option.

--

___
Python tracker 

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



error in syntax description for comprehensions?

2017-03-30 Thread Boylan, Ross
https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
describes the syntax for comprehensions as
comprehension ::=  expression comp_for
comp_for  ::=  [ASYNC] "for" target_list "in" or_test [comp_iter]
comp_iter ::=  comp_for | comp_if
comp_if   ::=  "if" expression_nocond [comp_iter]

Is the comp_for missing an argument after "in"?
One has to follow the definition of or_test and its components, but I can't 
find anything that results to a single variable or expression.

Actually, I'm not sure what or_test would do there either with or  without an 
additional element following "in". 

Ross Boylan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28415] PyUnicode_FromFormat integer format handling different from printf about zeropad

2017-03-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

*Way* too wordy. In msg278666, I suggested minimal and terse alternatives.
a. /exactly/nearly/
b. add "except that a 0 conversion flag is not ignored when a precision is 
given for d, i, o, u, x and X conversion types"

--

___
Python tracker 

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



[issue22392] Clarify documentation of __getinitargs__

2017-03-30 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue22392] Clarify documentation of __getinitargs__

2017-03-30 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 2ee01ecf419a392f0b6a33ca10d1f747adb6c43a by Mariatta (Mandeep 
Singh) in branch '2.7':
[2.7] bpo-22392: Improve documentation for __getinitargs__  (GH-899)
https://github.com/python/cpython/commit/2ee01ecf419a392f0b6a33ca10d1f747adb6c43a


--

___
Python tracker 

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



[issue29751] PyLong_FromString documentation wrong on numbers with leading zero and base=0

2017-03-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

String arguments to int are quoted int literals.  From
https://docs.python.org/3/reference/lexical_analysis.html#literals
'Underscores are ignored for determining the numeric value of the literal. They 
can be used to group digits for enhanced readability. One underscore can occur 
between digits, and after base specifiers like 0x.'

For your patch, I would summarize this by expanding 'Leading spaces are 
ignored.' to the following (in patch comment also).
"Leading spaces and single underscores after a base specifier and between 
digits are ignored."

--
nosy: +terry.reedy

___
Python tracker 

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



[issue29751] PyLong_FromString documentation wrong on numbers with leading zero and base=0

2017-03-30 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review
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



[issue29887] test_normalization doesn't work

2017-03-30 Thread STINNER Victor

STINNER Victor added the comment:

Oh, Zachary reported me the following failure which is legitimate. The code 
doesn't handle correctly read-only library directory.

The test should try to write the file in a temporary file, or simply skip the 
test.

http://buildbot.python.org/all/builders/x86%20Gentoo%20Installed%20with%20X%203.x/builds/500/steps/test/logs/stdio

==
FAIL: test_main (test.test_normalization.NormalizationTest)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/test_normalization.py",
 line 42, in test_main
check=check_version)
PermissionError: [Errno 13] Permission denied: 
'/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/data/NormalizationTest.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/test_normalization.py",
 line 44, in test_main
self.fail(f"Could not retrieve {TESTDATAURL}")
AssertionError: Could not retrieve 
http://www.pythontest.net/unicode/9.0.0/NormalizationTest.txt

--
Ran 2 tests in 0.149s

--

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Changes by Thomas Wouters :


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



[issue29751] PyLong_FromString documentation wrong on numbers with leading zero and base=0

2017-03-30 Thread Cheryl Sabella

Cheryl Sabella added the comment:

I have a pull request ready for the documentation, but I didn't understand the 
underscore usage, so I couldn't add that.

If you explain it, then I can try to add it.

--
nosy: +csabella

___
Python tracker 

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



[issue29751] PyLong_FromString documentation wrong on numbers with leading zero and base=0

2017-03-30 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +815

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:


New changeset d694a06206fc09b76b4507aacde5e69a248f434f by T. Wouters in branch 
'2.7':
bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#913)
https://github.com/python/cpython/commit/d694a06206fc09b76b4507aacde5e69a248f434f


--

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:


New changeset 9273dfe1800fc7241d69f4d523d748ebd35b3801 by T. Wouters in branch 
'3.5':
bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#912)
https://github.com/python/cpython/commit/9273dfe1800fc7241d69f4d523d748ebd35b3801


--

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:


New changeset 599bb181036f724629a515317f0f39520950d51c by T. Wouters in branch 
'3.6':
bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#911)
https://github.com/python/cpython/commit/599bb181036f724629a515317f0f39520950d51c


--

___
Python tracker 

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



[issue29928] Add f-strings to Glossary

2017-03-30 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks all!

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



[issue29928] Add f-strings to Glossary

2017-03-30 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 7b5b1379ac2c1e89ebf90b88b5d32457910e975e by Mariatta in branch 
'3.6':
bpo-29928: Add f-string to the Glossary (GH-864) (GH-914)
https://github.com/python/cpython/commit/7b5b1379ac2c1e89ebf90b88b5d32457910e975e


--

___
Python tracker 

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



[issue29928] Add f-strings to Glossary

2017-03-30 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +814

___
Python tracker 

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



[issue29928] Add f-strings to Glossary

2017-03-30 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 33db068dac7686e37736f7ecf8abb2aee0345cf2 by Mariatta in branch 
'master':
bpo-29928: Add f-string to the Glossary (GH-864)
https://github.com/python/cpython/commit/33db068dac7686e37736f7ecf8abb2aee0345cf2


--

___
Python tracker 

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



[issue29941] Confusion between asserts and Py_DEBUG

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:

Dropped the Py_DEBUG guards from the dubious asserts in the PR.

--

___
Python tracker 

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



[issue29881] Add a new private API clear private variables, which are initialized once, at Python shutdown

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping. My suggestion is to rename _PY_ONCEVAR_INIT to _Py_SET_ONCE and make it 
returning the value. And apply this to more static and global variables.

--

___
Python tracker 

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



[issue29949] sizeof set after set_merge() is doubled from 3.5

2017-03-30 Thread Jan Gosmann

Changes by Jan Gosmann :


--
nosy: +jgosmann

___
Python tracker 

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



Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
FYI, this small patch may fix your issue:
https://gist.github.com/methane/8faf12621cdb2166019bbcee65987e99
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29949] sizeof set after set_merge() is doubled from 3.5

2017-03-30 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



Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread Jan Gosmann
That's great news. I'm busy with other things right now, but will look 
into your findings in more detail later.



On 03/30/2017 02:09 PM, INADA Naoki wrote:

Filed an issue: https://bugs.python.org/issue29949

Thanks for your report, Jan.

On Fri, Mar 31, 2017 at 3:04 AM, INADA Naoki  wrote:

Maybe, this commit make this regression.

https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6

Old:
minused = (so->used + other->used)*2  (L619)

New:
minused = so->used + other->used  (L620)
minused = (minused > 5) ? minused * 2 : minused * 4;  (L293)

So size of small set is doubled.

$ /usr/bin/python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sys
s = set(range(10))
sys.getsizeof(frozenset(s))

736
$ python3
Python 3.6.0 (default, Dec 30 2016, 20:49:54)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.

import  sys
s = set(range(10))
sys.getsizeof(frozenset(s))

1248


On Fri, Mar 31, 2017 at 2:34 AM, INADA Naoki  wrote:

I reproduced the issue.
This is very usual, memory usage issue.  Slashing is just a result of
large memory usage.

After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and
30GB on Python 3.6.
And Python 3.6 starts slashing in 2nd optimization pass.

I enabled tracemalloc while 1st pass.  Results is end of this mail.
It seems frozenset() cause regression, but I'm not sure yet.
I don't know what is contents of frozenset yet.  (I know almost
nothing about this application).

Jan, do you know about what this is?
Could you make script which just runs `transitive_closure(edges)` with
edges similar to
`log_reduction.py spaun`?

I'll dig into it later, maybe next week.

---
Python 3.6.1
1191896 memory blocks: 22086104.2 KiB
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 85
 reachables[vertex] = frozenset(reachables[vertex])
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 410
 self.dependents = transitive_closure(self.dg.forward)
602986 memory blocks: 51819.1 KiB
   File "", line 14
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 634
 first_view=None, v_offset=0, v_size=0, v_base=None)

Python 3.5.3
1166804 memory blocks: 6407.0 KiB
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 85
 reachables[vertex] = frozenset(reachables[vertex])
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 410
 self.dependents = transitive_closure(self.dg.forward)
602989 memory blocks: 51819.3 KiB
   File "", line 14
   File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 634
 first_view=None, v_offset=0, v_size=0, v_base=None)


--
https://mail.python.org/mailman/listinfo/python-list


Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
Filed an issue: https://bugs.python.org/issue29949

Thanks for your report, Jan.

On Fri, Mar 31, 2017 at 3:04 AM, INADA Naoki  wrote:
> Maybe, this commit make this regression.
>
> https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6
>
> Old:
> minused = (so->used + other->used)*2  (L619)
>
> New:
> minused = so->used + other->used  (L620)
> minused = (minused > 5) ? minused * 2 : minused * 4;  (L293)
>
> So size of small set is doubled.
>
> $ /usr/bin/python3
> Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
> [GCC 6.2.0 20160927] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import sys
 s = set(range(10))
 sys.getsizeof(frozenset(s))
> 736

>
> $ python3
> Python 3.6.0 (default, Dec 30 2016, 20:49:54)
> [GCC 6.2.0 20161005] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import  sys
 s = set(range(10))
 sys.getsizeof(frozenset(s))
> 1248

>
>
>
> On Fri, Mar 31, 2017 at 2:34 AM, INADA Naoki  wrote:
>> I reproduced the issue.
>> This is very usual, memory usage issue.  Slashing is just a result of
>> large memory usage.
>>
>> After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and
>> 30GB on Python 3.6.
>> And Python 3.6 starts slashing in 2nd optimization pass.
>>
>> I enabled tracemalloc while 1st pass.  Results is end of this mail.
>> It seems frozenset() cause regression, but I'm not sure yet.
>> I don't know what is contents of frozenset yet.  (I know almost
>> nothing about this application).
>>
>> Jan, do you know about what this is?
>> Could you make script which just runs `transitive_closure(edges)` with
>> edges similar to
>> `log_reduction.py spaun`?
>>
>> I'll dig into it later, maybe next week.
>>
>> ---
>> Python 3.6.1
>> 1191896 memory blocks: 22086104.2 KiB
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 85
>> reachables[vertex] = frozenset(reachables[vertex])
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 410
>> self.dependents = transitive_closure(self.dg.forward)
>> 602986 memory blocks: 51819.1 KiB
>>   File "", line 14
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 634
>> first_view=None, v_offset=0, v_size=0, v_base=None)
>>
>> Python 3.5.3
>> 1166804 memory blocks: 6407.0 KiB
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 85
>> reachables[vertex] = frozenset(reachables[vertex])
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 410
>> self.dependents = transitive_closure(self.dg.forward)
>> 602989 memory blocks: 51819.3 KiB
>>   File "", line 14
>>   File 
>> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
>> line 634
>> first_view=None, v_offset=0, v_size=0, v_base=None)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29949] sizeof set after set_merge() is doubled from 3.5

2017-03-30 Thread INADA Naoki

New submission from INADA Naoki:

(original thread is 
https://mail.python.org/pipermail/python-list/2017-March/720391.html)

https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6

this commit doubles sizeof set object created by set_merge().
It is used by constructor of set and frozenset.

$ /usr/bin/python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> s = set(range(10))
>>> sys.getsizeof(frozenset(s))
736

$ python3
Python 3.6.0 (default, Dec 30 2016, 20:49:54)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import  sys
>>> s = set(range(10))
>>> sys.getsizeof(frozenset(s))
1248

--
components: Interpreter Core
keywords: 3.6regression
messages: 290868
nosy: inada.naoki, rhettinger
priority: normal
severity: normal
status: open
title: sizeof set after set_merge() is doubled from 3.5
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



Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
Maybe, this commit make this regression.

https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6

Old:
minused = (so->used + other->used)*2  (L619)

New:
minused = so->used + other->used  (L620)
minused = (minused > 5) ? minused * 2 : minused * 4;  (L293)

So size of small set is doubled.

$ /usr/bin/python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> s = set(range(10))
>>> sys.getsizeof(frozenset(s))
736
>>>

$ python3
Python 3.6.0 (default, Dec 30 2016, 20:49:54)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import  sys
>>> s = set(range(10))
>>> sys.getsizeof(frozenset(s))
1248
>>>



On Fri, Mar 31, 2017 at 2:34 AM, INADA Naoki  wrote:
> I reproduced the issue.
> This is very usual, memory usage issue.  Slashing is just a result of
> large memory usage.
>
> After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and
> 30GB on Python 3.6.
> And Python 3.6 starts slashing in 2nd optimization pass.
>
> I enabled tracemalloc while 1st pass.  Results is end of this mail.
> It seems frozenset() cause regression, but I'm not sure yet.
> I don't know what is contents of frozenset yet.  (I know almost
> nothing about this application).
>
> Jan, do you know about what this is?
> Could you make script which just runs `transitive_closure(edges)` with
> edges similar to
> `log_reduction.py spaun`?
>
> I'll dig into it later, maybe next week.
>
> ---
> Python 3.6.1
> 1191896 memory blocks: 22086104.2 KiB
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 85
> reachables[vertex] = frozenset(reachables[vertex])
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 410
> self.dependents = transitive_closure(self.dg.forward)
> 602986 memory blocks: 51819.1 KiB
>   File "", line 14
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 634
> first_view=None, v_offset=0, v_size=0, v_base=None)
>
> Python 3.5.3
> 1166804 memory blocks: 6407.0 KiB
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 85
> reachables[vertex] = frozenset(reachables[vertex])
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 410
> self.dependents = transitive_closure(self.dg.forward)
> 602989 memory blocks: 51819.3 KiB
>   File "", line 14
>   File 
> "/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
> line 634
> first_view=None, v_offset=0, v_size=0, v_base=None)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29941] Confusion between asserts and Py_DEBUG

2017-03-30 Thread Tim Peters

Tim Peters added the comment:

So there's more than one issue here.

First, should asserts be supported in the absence of Py_DEBUG?  It seems, so 
far, everyone agrees they should be.

Second, ...?  I'm really not following your argument.  It _appears_ to be 
something along the lines that code "shouldn't be" checking for 
PyErr_Occurred() at all ... because "nothing goes 'more wrong' when the assert 
is not there".  Maybe, maybe not.  For example, if a C function _assumes_ no 
exception is pending at entry, then it could try some speculative code and 
deliberately PyErr_Clear() if PyErr_Occurred() is true after - and end up 
erasing all knowledge of that an exception _was_ in fact pending (upon function 
entry).  An assert at the start prevents such an error when asserts are 
enabled.  Violations of preconditions can have bad consequences.

But whatever the second argument is, it seems independent of whether asserts 
should be supported in the absence of Py_DEBUG.

For the rest, I just don't think "internal to CPython" versus "external to 
CPython".  That's a matter of how things happen to be packaged today.  I do 
think "written in C" versus "not written in C".  That's the level asserts live 
in.  Any C code (internal or external) mucking with the Python C API has to 
adhere to a mountain of rules, and asserts are a lightweight way to help check 
for compliance in cases where it's thought to be "too expensive" to do even 
cheap unconditional checks all the time.  Of course asserts are also useful for 
verifying invariants and postconditions, but I wouldn't want to rule out using 
them to verify preconditions too.

In short, I'd like to see a patch limited to the obvious win:  whatever changes 
are needed to support asserts in the absence of Py_DEBUG.  Anything beyond that 
is "a crusade" ;-)

--

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Possible workaround: use chain.from_iterable(filter(None, iterables)) instead 
of chain.from_iterable(iterables). But this works only when iterables are 
collections, not iterators.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Changes by Thomas Wouters :


--
pull_requests: +811

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Changes by Thomas Wouters :


--
pull_requests: +812

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Changes by Thomas Wouters :


--
pull_requests: +813

___
Python tracker 

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



Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
I reproduced the issue.
This is very usual, memory usage issue.  Slashing is just a result of
large memory usage.

After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and
30GB on Python 3.6.
And Python 3.6 starts slashing in 2nd optimization pass.

I enabled tracemalloc while 1st pass.  Results is end of this mail.
It seems frozenset() cause regression, but I'm not sure yet.
I don't know what is contents of frozenset yet.  (I know almost
nothing about this application).

Jan, do you know about what this is?
Could you make script which just runs `transitive_closure(edges)` with
edges similar to
`log_reduction.py spaun`?

I'll dig into it later, maybe next week.

---
Python 3.6.1
1191896 memory blocks: 22086104.2 KiB
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 85
reachables[vertex] = frozenset(reachables[vertex])
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 410
self.dependents = transitive_closure(self.dg.forward)
602986 memory blocks: 51819.1 KiB
  File "", line 14
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 634
first_view=None, v_offset=0, v_size=0, v_base=None)

Python 3.5.3
1166804 memory blocks: 6407.0 KiB
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 85
reachables[vertex] = frozenset(reachables[vertex])
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 410
self.dependents = transitive_closure(self.dg.forward)
602989 memory blocks: 51819.3 KiB
  File "", line 14
  File 
"/home/inada-n/work/gosmann-frontiers2017/gosmann_frontiers2017/optimized/optimizer.py",
line 634
first_view=None, v_offset=0, v_size=0, v_base=None)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 079f21f873b99f9564a41c5b7f3e0d7035847ae5 by Serhiy Storchaka in 
branch '2.7':
bpo-29935: Fixed error messages in the index() method of tuple and list (#887) 
(#907) (#910)
https://github.com/python/cpython/commit/079f21f873b99f9564a41c5b7f3e0d7035847ae5


--

___
Python tracker 

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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 8b8bde44f3912d8b2df5591ffc31d2d8c6dcca6c by Serhiy Storchaka in 
branch '3.5':
bpo-29935: Fixed error messages in the index() method of tuple, list and deque 
(#887) (#907) (#909)
https://github.com/python/cpython/commit/8b8bde44f3912d8b2df5591ffc31d2d8c6dcca6c


--

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:

FWIW, we ran into this in real-world cases (Youtube, I think), when we switched 
from using a pre-built Python interpreter to one built from source using the 
same optimisation and debug levels as we use for all other C/C++ code. Even so, 
the accompanying test really does fail in pydebug mode ;-P

I'll backport to 3.6, 3.5 and 2.7.

--

___
Python tracker 

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



[issue29946] compiler warning "sqrtpi defined but not used"

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 7a26464c6496c29244072fdd80f9b92c68174742 by Serhiy Storchaka 
(Louie Lu) in branch 'master':
bpo-29946: Fix "sqrtpi defined but not used" (#908)
https://github.com/python/cpython/commit/7a26464c6496c29244072fdd80f9b92c68174742


--

___
Python tracker 

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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +810

___
Python tracker 

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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +809

___
Python tracker 

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



[issue29942] Stack overflow in itertools.chain.from_iterable.

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:


New changeset 5466d4af5fe76ec0a5fbc8a05675287d9e8e9d14 by T. Wouters in branch 
'master':
bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#889)
https://github.com/python/cpython/commit/5466d4af5fe76ec0a5fbc8a05675287d9e8e9d14


--

___
Python tracker 

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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset bf4bb2e43030661e568d5d4b046e8b9351cc164c by Serhiy Storchaka in 
branch '3.6':
bpo-29935: Fixed error messages in the index() method of tuple, list and deque 
(#887) (#907)
https://github.com/python/cpython/commit/bf4bb2e43030661e568d5d4b046e8b9351cc164c


--

___
Python tracker 

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



[issue29941] Confusion between asserts and Py_DEBUG

2017-03-30 Thread Thomas Wouters

Thomas Wouters added the comment:

What happens when you don't have the assert depends on whether the new function 
call raises an exception or not, and keep in mind *this is what most people see 
anyway*: if the new call does not raise an exception, a SystemError is raised, 
with the original exception as cause:

Traceback (most recent call last):
  File "", line 5, in func
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
SystemError: PyEval_EvalFrameEx returned a result with an error set

If the new call does raise an exception, the original exception is lost 
(although this may depend on the exact path through the code here; there's 
quite a few places that deal with this kind of thing.)

I don't mind dropping the assert changes from my PR, but I don't really 
understand why it is better to be *less* helpful when asserts are enabled :) As 
I said, the actual assert failure does very little to point to the real 
problem, as the problem is *some* extension module not clearing the error (or 
not returning an error value), and the assert does not guard against actual 
problems -- nothing goes "more wrong" when the assert is not there. I would 
also argue that an extension module is not *internal* to CPython, any more than 
arguments passed to a builtin function are.

--

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Rhodri James

On 30/03/17 16:57, Mikhail V wrote:

Steve, it is not bad to want to spell your name using spelling which
was taught you in the school. But it is bad to stay in illusion that there
is something good in using accents.


*plonk*

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue29946] compiler warning "sqrtpi defined but not used"

2017-03-30 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +808

___
Python tracker 

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



[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Josh Rosenberg

Josh Rosenberg added the comment:

This is what I get for leaving a response up and working on it intermittently 
for three hours, and not rechecking: I found the same basic problem.

For the record, I also found a terribly hacky way of doing this sort of 
rebinding manually, should you actually need to do so under the current design:

def make_class_closure(__class__):
'''Makes a one-tuple closure with a cell for the provided class'''
return (lambda: super).__closure__

class MyList(list):
def insert(self, index, object):
super().insert(index, object)

class MyList2(list):
pass

MyList2.insert = types.FunctionType(MyList.insert.__code__, globals(), 
closure=make_class_closure(MyList2))

It would need further improvements to recognize when it needs to run, deal with 
existing closures, handle top-level functions without __class__ in their 
closure co_freevars, etc., and I won't even pretend that's a sane workaround 
for the problem, but it does demonstrate what is happening/what would need to 
be changed to make it work, if indeed that's desirable.

--

___
Python tracker 

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



[issue10030] Patch for zip decryption speedup

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +807

___
Python tracker 

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



[issue10030] Patch for zip decryption speedup

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 06e522521c06671b4559eecf9e2a185c2d62c141 by Serhiy Storchaka in 
branch 'master':
bpo-10030: Sped up reading encrypted ZIP files by 2 times. (#550)
https://github.com/python/cpython/commit/06e522521c06671b4559eecf9e2a185c2d62c141


--

___
Python tracker 

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



[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-03-30 Thread Eric V. Smith

Eric V. Smith added the comment:

Just a guess, but it's because this code was written at a time when subclassing 
was the preferred way to extend code. Now we know better :), but it's not 
possible to change history, unfortunately. Lots of code depends on the current 
behavior.

If you find a way to make a factory function work, while preserving backward 
comparability, then we can re-open this issue and consider the enhancement 
request then.

--
nosy: +eric.smith
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.3, Python 3.4, 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



[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Josh Rosenberg

Josh Rosenberg added the comment:

It looks like this is a general problem caused by the fact that a function that 
is:

1. Defined in a class
2. References the name "super" (even if it's a local variable name, even if 
it's never called)

isn't "just" a plain function. Even though Python 3 officially removed the 
concept of unbound methods, there is still some unbound method-like behavior 
going on, which makes that sort of function intrinsically tied to where it 
executes.

Specifically, a function of that sort is effectively a closure, where the 
closure scope defines __class__ (insert.__code__.co_freevars will be non-empty 
with the string '__class__' in it); the value of that closure variable cell is 
set when the class finishes being defined (that is, the closure cell is empty 
when the def block finishes, but when the class block itself completes, the 
cell is populated with a reference to the class).

No argument super (specifically, super_init) relies on this assistance, as it 
looks up the __class__ cell in the caller's frame when not provided a class 
explicitly. In your repro, the problem is that __class__ is set to the original 
MyList (it was set at the moment the class MyList(list): block finished, before 
the decorator was invoked), but at call time, the self instance is of the new 
type you created (which has the same name, but the name isn't looked up, it has 
a cached reference to the class).

The same problem applies if you do:

class MyList(list):
def insert(self, index, object):
super().insert(index, object)

class MyOtherList(list):
insert = MyList.insert

because MyList.insert is permanently tied to MyList, it doesn't get 
"reclosured" as a result of MyOtherList using it. Similarly:

class MyList(list):
pass

def insert(self, index, object):
super().insert(index, object)

MyList.insert = insert

fails when insert is called with error: "RuntimeError: super(): __class__ cell 
not found", because functions def-ed outside a class block entirely don't have 
__class__ as "virtual closure" scope.

It's arguable whether this should be changed: If you're using super() without 
arguments, the implicit behavior is that it works with "whatever class I'm 
currently defining", so trying to reuse it with some other class is trying to 
extend that implicit behavior to "whatever class I was eventually assigned to". 
Making it work would mean that already "class bound" methods must be rebound 
when assigned to a new class, and non-bound methods must be bound (in both 
cases, you'd need to handle this when implicitly assigned in the class body, or 
explicitly assigned later as an attribute on the constructed class).

Doing so would break at least one pattern someone might be using already, where 
they have multiple inheritance, and while most methods should prioritize the 
first class in the MRO, they want a specific method to bypass one or more 
classes in the MRO without calling it. For example:

class Stuff:  # Top of diamond, just so super().stuff() valid in all children
def stuff(self):
print("Stuff")

class Spam:
def stuff(self):
print("Spam")
super().stuff()

class Eggs:
def stuff(self):
print("Eggs")
super().stuff()

class SpamAndEggsWithoutSpam(Spam, Eggs):
stuff = Eggs.stuff  # I'd like my stuff without Spam

Under the current design, Eggs.stuff is already bound to Eggs, so this works; 
you see:

Eggs
Stuff

printed, but not Spam. If rebinding were made a thing, you'd end up with:

Eggs
Spam
Eggs
Stuff

with the first Eggs being from the rebound method.

--
nosy: +josh.r

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Mikhail V
On 30 March 2017 at 16:14, Steve D'Aprano  wrote:
> On Thu, 30 Mar 2017 03:21 pm, Rick Johnson wrote:
>
>> On Sunday, March 26, 2017 at 2:53:49 PM UTC-5, Chris Angelico wrote:
>>> On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V  wrote:
>>> > On 26 March 2017 at 20:10, Steve D'Aprano 
>>> > wrote:

>>> [ ] Uses no diacritical marks
>>
>> Why is it my responsibiliy to encode my text with
>> pronuciation tutorials? Are we adults here or what?
>
> Now you're just being absurd. Supporting diacritics doesn't mean you are
> responsible for teaching your users what they're for. They already know.
> That's why they want to use them.
>
> Diacritics are for:
>
> - distinguishing between words which look the same, but have
>   different pronunciation;
>
> - distinguishing between different letters of the alphabet, like
>   dotted-i and dotless-ı (or ı and ı-with-a-dot, if you prefer),
>   or a and å;
>
> - distinguishing between words which look and sound the same but
>   mean something different;
>
> - and making band names look ǨØØĻ and annoy old fuddy-duddies.
>

Steve, it is not bad to want to spell your name using spelling which
was taught you in the school. But it is bad to stay in illusion that there
is something good in using accents. As said it _is_ selfish to force
people to use e.g. umlauts and noun Capitalisations in German.
It is an big obstacle for reading and burdle for typing.
Initially it has nothing to do with people's choice, it is politics only.
I can speak and write German fluently, so I know how much
better would it be without those odd spelling rules.

So don't mix the spoken language and writing system - spoken
language will never be extinct, but most writing systems will be obsolete
and should be obsolete (you can call me bigot again ;-)

Some other interesting aspects: if I localise a software in Russian
language and use Cyrillic letters, english speakers will not be able
to read _anything_, and if I'll use Latin letters instead, then
non-russian users
will be at least able to read something, so if you know some Russian
spoken language it will be much more help for you.

Concrete software example - lets say I make an IDE.
It is far more important to give the users mechanisms to customize
the glyphs (e.g. edit math signs) than supporting Unicode.
And therefore it is much more important to make those font
format definitions transparent, non-bloated and easily editable.
Where is it all?


Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29946] compiler warning "sqrtpi defined but not used"

2017-03-30 Thread Mark Dickinson

Mark Dickinson added the comment:

This is almost certainly the result of #26121.

+1 to moving the `sqrtpi` definition inside the relevant `#if` blocks.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Michael Torrie
On 03/30/2017 08:14 AM, Steve D'Aprano wrote:
>> Why is it my responsibiliy to encode my text with
>> pronuciation tutorials? Are we adults here or what?
>
> Now you're just being absurd. 

Ahh yes, good old RR with his reductio ad absurdum fallacies when he's
lost the argument.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset d4edfc9abffca965e76ebc5957a92031a4d6c4d4 by Serhiy Storchaka in 
branch 'master':
bpo-29935: Fixed error messages in the index() method of tuple, list and deque 
(#887)
https://github.com/python/cpython/commit/d4edfc9abffca965e76ebc5957a92031a4d6c4d4


--

___
Python tracker 

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



[issue29204] Add code deprecations in ElementTree

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The deprecation of the cElementTree module was excluded.

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



[issue29935] list and tuple index methods should accept None parameters

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Raymond for your review.

In any case we should first fix error messages in maintain releases. Changing 
signatures of methods of basic type should be discussed on the mailing lists. I 
don't think this needs a PEP, unless this change will be extended to many other 
methods and types.

--

___
Python tracker 

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



[issue29204] Add code deprecations in ElementTree

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 762ec97ea68a1126b8855996c61fa8239dc9fff7 by Serhiy Storchaka in 
branch 'master':
bpo-29204: Emit warnings for already deprecated ElementTree features. (#773)
https://github.com/python/cpython/commit/762ec97ea68a1126b8855996c61fa8239dc9fff7


--

___
Python tracker 

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



django authentication multi upload files

2017-03-30 Thread Xristos Xristoou
I have create I simple Django auth project and I need to add the user to can 
upload some images. multi upload images from internet
views.py
from django.shortcuts import render
from django.http import HttpResponse

def Form(request):
return render(request, "index/form.html", {})

def Upload(request):
for count, x in enumerate(request.FILES.getlist("files")):
def process(f):
with open('/Users/Michel/django_1.8/projects/upload/media/file_' + 
str(count), 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)
process(x)
return HttpResponse("File(s) uploaded!")
but how to define that to multi upload images in specific unique folder for any 
user. first I use login_required and in destination I use user_directory_path. 
But how to define the code in the views.py to work with authentication per 
user. for example for user_1 upload images in your folder for user_1 in folder 
for user_2.
medels.py
def user_directory_path(instance, filename):
return 'user_{0}/{1}'.format(instance.user.id, filename)

class MyModel(models.Model):
user = models.ForeignKey(User, unique=True)
upload = models.ImageField(upload_to=user_directory_path)
-- 
https://mail.python.org/mailman/listinfo/python-list


add processing images in the model.py using django

2017-03-30 Thread Xristos Xristoou
want to create a simple image processing using Django. my tasks is easy I have 
some user a simple model and that user can upload images in my project using 
html form or django form and then that images saves to upload_to='mypath' in 
upload from my model. but I have some questions :
I have a simple image processing in my views.py if the processing complete 
success then create new image and I want that image to add in the upload from 
my model .
how to do that in Django ?
models.py
class MyModel(models.Model):
user = models.ForeignKey(User)
upload = models.ImageField(upload_to='mypath/personal/folder/per/user')
views.py
def index(request):
form = ImageUploadForm(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
image_file = request.FILES['image'].read()
'''
image processing new image
'''


return render_to_response("blog/success.html", {"new image":new image})
return render_to_response('blog/images.html', {'form': form}, 
RequestContext(request))
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29946] compiler warning "sqrtpi defined but not used"

2017-03-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +mark.dickinson, rhettinger, stutzbach

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset a6b4e1902250d6f28ca6d083ce1c8d7e9b91974b by Serhiy Storchaka in 
branch '3.6':
bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#903)
https://github.com/python/cpython/commit/a6b4e1902250d6f28ca6d083ce1c8d7e9b91974b


--

___
Python tracker 

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



[issue20548] Use specific asserts in warnings and exceptions tests

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7 -Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue29887] test_normalization doesn't work

2017-03-30 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 722a3af092b94983aa26f5e591fb1b45e2c2a0ff by Victor Stinner in 
branch 'master':
bpo-29887: Test normalization now fails if download fails (#905)
https://github.com/python/cpython/commit/722a3af092b94983aa26f5e591fb1b45e2c2a0ff


--

___
Python tracker 

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



[issue20548] Use specific asserts in warnings and exceptions tests

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset f15c4d374a07c576c0e8349b16604f6dbad0b953 by Serhiy Storchaka in 
branch 'master':
bpo-20548: Use specific asserts in warnings and exceptions tests (#788)
https://github.com/python/cpython/commit/f15c4d374a07c576c0e8349b16604f6dbad0b953


--

___
Python tracker 

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



[issue29948] DeprecationWarning when parse ElementTree with a doctype in 2.7

2017-03-30 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

DeprecationWarning is emitted when parse ElementTree with a doctype in 2.7.

$ python2.7 -Wa
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as ET
>>> ET.XML('>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;>text')
/usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This 
method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder 
target.
  DeprecationWarning,
/usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This 
method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder 
target.
  DeprecationWarning,


--
assignee: serhiy.storchaka
components: XML
messages: 290846
nosy: eli.bendersky, scoder, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: DeprecationWarning when parse ElementTree with a doctype in 2.7
type: behavior
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



[issue27863] multiple issues in _elementtree module

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since it is hard to backport the bugfix to 2.7 without test, issue15083 is a 
dependence.

--
dependencies: +Rewrite ElementTree tests in a cleaner and safer way
stage: needs patch -> backport needed

___
Python tracker 

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



[issue29948] DeprecationWarning when parse ElementTree with a doctype in 2.7

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Rewrite ElementTree tests in a cleaner and safer way

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Chris Angelico
On Fri, Mar 31, 2017 at 1:16 AM, Steve D'Aprano
 wrote:
> On Fri, 31 Mar 2017 12:25 am, Mikhail V wrote:
>
>> Call me a bigot
>
> Okay. You're a bigot.

+1 QOTD

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2017-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is hard to backport bugfixes to 2.7 since tests are too different. Due to 
this I backported some bugfixes without tests and omitted backporting other 
bugfixes.

PR 906 converts doctests in 2.7 to unittests. This will help backporting 
bugfixes too much.

Actually I have backported tests from 3.5 and checked that all old tests are 
present in new tests. Perhaps I found a bug in ElementTree in 2.7. Will open an 
issue after merging tests.

--

___
Python tracker 

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



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2017-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +806

___
Python tracker 

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



[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Interestingly, even `types.new_class` misbehaves in this case:

```
>>> def mydec(cls):
... return types.new_class(cls.__name__, cls.__bases__, exec_body=lambda 
ns: ns.update(cls.__dict__))
... 
>>> @mydec
... class MyList(list):
... def insert(self, idx, obj):
... super().insert(idx, obj)
... 
>>> MyList().insert(0, 1)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in insert
TypeError: super(type, obj): obj must be an instance or subtype of type
```

The error message is confusing here because it's using 'type' as a metavariable 
to refer to the first argument of super(), *not* to the builtin called "type".

If we poke around in the MyList.insert closure, we can see the origin of the 
problem:

```
>>> MyList.insert.__closure__[0].cell_contents

>>> MyList.insert.__closure__[0].cell_contents is MyList
False
```

The class cell is still bound to the originally created class object, but the 
decorator threw that away and returned a completely different object. As a 
result, the "self" passed to the bound method is *not* an instance of the type 
stored in the "__class__" cell, and super() complains.

Given that super() doesn't take keyword arguments, perhaps we should propose on 
python-dev that "type" be changed to "starting_type" in the super() error 
messages and documentation?

--

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Steve D'Aprano
On Fri, 31 Mar 2017 12:25 am, Mikhail V wrote:

> Call me a bigot

Okay. You're a bigot.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-03-30 Thread Cheryl Sabella

Cheryl Sabella added the comment:

I wanted to try to work on the documentation for this, but I had some questions.

I looked at:
https://github.com/python/cpython/blob/master/Modules/_sqlite/cursor.c

And I don't see arraysize being set to anything other than 1.  I also don't see 
fetchall using it like the documentation says.  fetchmany does seem to be using 
the size sent in as an argument or using the arraysize (which is 1) to break 
out of the loop early, so the default behaviour appears to be the similar to 
fetchone.  Please take this all with the caveat that I don't know c, so I may 
be missing something really obvious.  But, I can see all the other cursor 
attributes being changed within this module, so I expected arraysize to work in 
a similar way.

I did find this website which has a definition of arraysize:
http://initd.org/psycopg/docs/cursor.html#cursor.arraysize

Sorry if this is too many questions.  I've just started trying to help with 
documentation issues and I may have gotten in over my head.

--
nosy: +csabella

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Steve D'Aprano
On Thu, 30 Mar 2017 03:21 pm, Rick Johnson wrote:

> On Sunday, March 26, 2017 at 2:53:49 PM UTC-5, Chris Angelico wrote:
>> On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V  wrote:
>> > On 26 March 2017 at 20:10, Steve D'Aprano 
>> > wrote:
>> >> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
> 
>> I generally find that when people say that Unicode doesn't
>> solve their problems and they need to roll their own, it's
>> usually one of two possibilities:  1) "Their problems" are
>> all about simplicity. They don't want to have to deal with
>> all the complexities of real-world text, so they
>> arbitrarily restrict things.
> 
> There are only so many hours in the day Chris. Not every
> progammer has the time to cater to every selfish desire of
> every potential client.

Oh, you're one of *those* coders. The ones who believe that if they
personally don't need something, nobody needs it.

Listen, I'm 100% in favour of the open source model. I think that coders who
scratch their own itch is a great way to produce some really fantastic
software. Look at the Linux kernel, and think about how that has evolved
from Linus Torvalds scratching his own itch.

It can also produce some real garbage too, usually from the kind of coder
whose answer to everything is "you don't need to do that".

But whatever, its a free country. If you don't want to support a subset of
your potential users, or customers, that's entirely up to you.

The honest truth is that most software ends up languishing in obscurity,
only used by a relative handful of people, so its quite unlikely that
you'll every have any users wanting support for Old Persian or Ogham.

But if you have any users at all, there's a good chance they'll want to
write their name correctly even if they are called Zöe, or include the
trademarked name of their Awesome™ product, or write the name of that hot
new metal band THЯДSHËR, or use emoji, or to refer to ¢ and °F
temperatures.

You might call it "selfish" for somebody to want to spell their name
correctly, or write in their native language, but selfish or not if you
don't give your users the features they want, they are unlikely to use your
software. Outside of the Democratic People's Republic of Trumpistan, the
world is full of about seven billion people who don't have any interest in
your ASCII-only software. It's not 1970 any more, the world is connected.

And the brilliant thing about Unicode is that for a little bit of effort you
can support Zöe and her French girlfriends, and that Swedish metal band
with the umlauts, and the President's Russian backers, and once you've done
that, you get at least partial support for Hebrew and Chinese and Korean
and Vietnamese and a dozen different Indian languages, and even Old Persian
and Ogham, FOR FREE.

So if you're wanting to create "the best product you can", why *wouldn't*
you use Unicode?


> You try to create the best product you can, 
> but at the end of the process, there will always be 
> someone (or a group of someones) who are unhappy with the
> result.


[...]
>> [ ] Speaks English exclusively
> 
> Of course, your comment presupposing that every programmer
> is fluent in every natural language. Which is not only
> impractical, it's impossible.

Don't be silly. You don't have to be fluent in a language in order for your
program to support users who are. All you have to do is not stop them from
using their own native language by forcing them to use ASCII and nothing
but ASCII.

Of course, if you want to *localise* your UI to their language, then you
need somebody to translate error messages, menus, window titles, etc. I'll
grant that's not always an easy job.

But aren't you lucky, you speak one of a handful of lingua francas in the
world, so the chances are your users will be pathetically grateful if all
you do is let them type in their own language. Actual UI localisation is a
bonus.


>> [ ] Uses no diacritical marks
> 
> Why is it my responsibiliy to encode my text with
> pronuciation tutorials? Are we adults here or what?

Now you're just being absurd. Supporting diacritics doesn't mean you are
responsible for teaching your users what they're for. They already know.
That's why they want to use them.

Diacritics are for:

- distinguishing between words which look the same, but have 
  different pronunciation;

- distinguishing between different letters of the alphabet, like 
  dotted-i and dotless-ı (or ı and ı-with-a-dot, if you prefer), 
  or a and å;

- distinguishing between words which look and sound the same but
  mean something different;

- and making band names look ǨØØĻ and annoy old fuddy-duddies.


>> [ ] Writes all text top-to-bottom, left-to-right
> 
> Not my problem. Learn the King's English or go wait for
> extinction to arrive.

Which king?

Harald V speaks Norwegian, Felipe VI speaks Spanish, Hamad bin Isa speaks
whatever they speak in Bahrain (probably Arabic), Norodom Sihamoni speaks
Cambodian, 

[issue29533] urllib2 works slowly with proxy on windows

2017-03-30 Thread Julia Dolgova

Julia Dolgova added the comment:

Ok, but may be there are some Windows users, that have different opinion, who 
prefer to put up with this bug for the benefit of better performance. Could you 
leave them an opportunity to refuse this behavior of urllib?

--

___
Python tracker 

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



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Mikhail V
On 30 March 2017 at 07:43, Chris Angelico  wrote:
> On Thu, Mar 30, 2017 at 3:21 PM, Rick Johnson
>  wrote:
>> On Sunday, March 26, 2017 at 2:53:49 PM UTC-5, Chris Angelico wrote:
>>> On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V  wrote:
>>> > On 26 March 2017 at 20:10, Steve D'Aprano  
>>> > wrote:
>>> >> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
>>

>>> """
>>> I, the undersigned, acknowledge that my program is
>>> intentionally excluding everyone who does not fit the
>>> following requirements: [choose all applicable]
>>>
>>> [ ] Speaks English exclusively
>>
>> Of course, your comment presupposing that every programmer
>> is fluent in every natural language. Which is not only
>> impractical, it's impossible.
>
> Nope. I can't speak Mandarin, but I can make absolutely sure that all
> my programs can accept Chinese characters. A friend of mine sent me an
> audio file with a name that included some Chinese, and I was able to
> handle it no problem.
>

Naming files is another point. Generally if I can't speak Mandarin,
I have no right to make support for it since I know nothing about this
language nor do I know their symbols.

>>> [ ] Uses no diacritical marks
>>
>> Why is it my responsibiliy to encode my text with
>> pronuciation tutorials? Are we adults here or what?
>>
>>> [ ] Writes all text top-to-bottom, left-to-right
>>
>> Not my problem. Learn the King's English or go wait for
>> extinction to arrive.
>
> And these two cement your parochialism thoroughly in everyone's minds.
> "Pronunciation tutorials", eh? Sure. Tell that to everyone who speaks
> Spanish, Turkish, Norwegian, German, or Vietnamese, all of which use
> diacritical marks to distinguish between letters. English is the weird
> language in that it uses letter pairs instead of adorned letters (eg
> "ch" and "sh" instead of "ç" and "ş").

Because "Pronunciation tutorials" is one of rare excuses to use those
special characters at all. Now do you know how many phonetical
systems linguist have invented over past 200 years? Will you find
all them in Unicode? And why you need them today, if you can
learn pronunciation by audio tutorials?

And letter pair usage is not for fun there, I think we've discussed this
some time ago on python-ideas, it is merely a political problem,
since every 'king' in each land suddenly thinks that he is a genius
typographer and adds few custom characters to Latin after he realizes
that there is no sense in forcing everyone to use some outdated system,
or even rolls his own bizzare system (e.g. Hangul).

>> What don't you add these:
>>
>> [ ] Has the ability to read and comprehend at a high
>> school level.
>> [ ] Has functioning visual receptors.
>> [ ] Has a functioning brain.
>> [ ] Is not currently in a vegetative state
>
> Nah. If I did, I'd have to say "[ ] Is not trolling python-list" as well.

Call me a bigot, but I would say:
[x]  people, become adult finally and stop playing with your funny
hieroglyphs, use Latin set, and concentrate on real problems.

If I produce an arcade game or an IDE, would it lose much if
I don't include Unicode support? I personally would not do it
even in the fear of punishment.


Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >