[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



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

2017-03-30 Thread Dominic Mayers

New submission from Dominic Mayers:

I am just curious to know if someone considered the idea of passing a factory 
instance that returns RequestHandlerClass instances instead of directly passing 
the class? It may affect existing handlers that read non local variables, but 
there should be a way to make the factory optional. The purpose is only 
aesthetic and a better organization of the code. I find it awkward to have to 
subclass the server every time that we have an handler that needs special 
objects, a database connection, a socket connection to another party, etc. The 
server class should have a single purpose: accept a request and pass it to an 
handler. We should only need to subclass a server when we need to do that in a 
different way : TCP vs UDP, Unix Vs INET, etc. The usage is simpler and more 
natural. Instead of subclassing the server, we create a factory for the handler.

--
components: Library (Lib)
messages: 290840
nosy: dominic108
priority: normal
severity: normal
status: open
title: In SocketServer, why not passing a factory instance for the 
RequestHandlerClass  instead of the class itself?
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, 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



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

2017-03-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +ncoghlan, xiang.zhang

___
Python tracker 

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



[issue29945] decode string:u"\ufffd" UnicodeEncodeError

2017-03-30 Thread Eryk Sun

Eryk Sun added the comment:

> windows version run success!

Trying to decode a non-ASCII unicode string should raise an exception on any 
platform:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40)
[MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a=u"\ufffd"
>>> a.decode("utf=8")
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Program Files\Python27\lib\encodings\utf_8.py",
  line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd'
in position 0: ordinal not in range(128)

Unless you've modified the default encoding to something other than ASCII. For 
example:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40)
[MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, inspect, sitecustomize
>>> print inspect.getsource(sitecustomize)
import sys
sys.setdefaultencoding('utf-8')

>>> sys.getdefaultencoding()
'utf-8'
>>> a=u"\ufffd"
>>> a.decode("utf=8")
u'\ufffd'

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



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

2017-03-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry, modifying these mature APIs is a really bad idea.  They are worked well 
as-is of over a decade.  Seeing people use None for these arguments makes the 
code less readable. 

Python has a number of APIs where the number of arguments controls the 
behavior.  For example, type() with one argument does something very different 
that type() with three arguments.  Likewise, iter() behaves differently with 
two arguments than three.  The pattern used by index() shows-up in a number of 
places where we have optional start and end arguments.  These APIs are a long 
standing Python norm, both for the core and for third-party modules.  Type 
checking will have to adapt to norms rather than having all of Python change 
for the convenience of typing.

Serhiy, please go ahead with the doc fix.

If the OP really wants to insist on changing old and stable APIs through out 
the language in a way that I consider harmful to readability, we can battle it 
out in a PEP and on mailing lists.

--

___
Python tracker 

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



[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-03-30 Thread Charalampos Stratakis

Changes by Charalampos Stratakis :


--
nosy: +cstratak

___
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 Louie Lu

Louie Lu added the comment:

I can reproduce on ArchLinux 4.10.1-1, GCC 6.3.1:

/home/louielu/Python/cpython/Modules/mathmodule.c:74:21: warning: ‘sqrtpi’ 
defined but not used [-Wunused-const-variable=]
 static const double sqrtpi = 1.772453850905516027298167483341145182798;



Is used by `m_erfc_contfrac` and `m_erf_series`, and inside the block of "#if 
!defined(HAVE_ERF) || !defined(HAVE_ERFC)", maybe sqrtpi should do the same 
condition?

--
nosy: +louielu

___
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

New submission from Xiang Zhang:

Ubuntu 16.10, GCC 6.2.0

/home/angwer/repos/cpython/Modules/mathmodule.c:74:21: warning: ‘sqrtpi’ 
defined but not used [-Wunused-const-variable=]
 static const double sqrtpi = 1.772453850905516027298167483341145182798;

--
components: Build
messages: 290836
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: compiler warning "sqrtpi defined but not used"
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



[issue29945] decode string:u"\ufffd" UnicodeEncodeError

2017-03-30 Thread STINNER Victor

STINNER Victor added the comment:

Decoding Unicode doesn't make any sense. You should take a look at 
http://unicodebook.readthedocs.io/ to understand what you are doing :-)

(On Python 3, Unicode strings, the str type, has no mode .decode() type.)

I suggest to close the issue has NOT A BUG.

--

___
Python tracker 

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



[issue29945] decode string:u"\ufffd" UnicodeEncodeError

2017-03-30 Thread webber

Changes by webber :


Added file: http://bugs.python.org/file46767/windows.jpg

___
Python tracker 

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



[issue29945] decode string:u"\ufffd" UnicodeEncodeError

2017-03-30 Thread webber

New submission from webber:

I use  python on linux, version is 2.7.13:

[root@localhost bin]# ./python2.7
Python 2.7.13 (default, Mar 30 2017, 00:54:08) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=u"\ufffd"
>>> a.decode("utf=8")
Traceback (most recent call last):
  File "", line 1, in 
  File "/opt/python2.7.13/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 
0: ordinal not in range(128)

but,windows version run success!

--
components: Unicode
messages: 290834
nosy: ezio.melotti, foxscheduler, haypo
priority: normal
severity: normal
status: open
title: decode string:u"\ufffd" UnicodeEncodeError
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



[issue29533] urllib2 works slowly with proxy on windows

2017-03-30 Thread Paul Moore

Paul Moore added the comment:

The behaviour you're describing for IE sounds like a bug to me. If you specify 
a host that should bypass the proxy, then that's what should happen - it 
shouldn't matter if you specify the host by IP address or by name.

I'm -1 on Python trying to match IE bugs.

--

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

Benjamin: "We should change the tests to fail if they get a 404."

Good idea. Currently, the test is explicitly skipped on this case. Since "-u 
urlfetch" option must be explicitly passed on the command line, it makes sense 
to fail on that case.

I proposed https://github.com/python/cpython/pull/905 change for that. Not sure 
if it's worth to backport such change to older Python versions?

--

___
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

Changes by STINNER Victor :


--
pull_requests: +805

___
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 Mark Dickinson

Mark Dickinson added the comment:

> I would have guessed that the C compiler would have automatically removed the 
> tail recursion

I think it probably does, unless optimisation is turned off: I'm unable to 
reproduce except in debug builds of Python.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-30 Thread Xiang Zhang

Changes by Xiang Zhang :


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

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-30 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 16f852345bcdec1bbb15e5363fad6b33bf960912 by Xiang Zhang 
(s-sanjay) in branch 'master':
bpo-29913: deprecate compare_networks() in documentation (GH-865)
https://github.com/python/cpython/commit/16f852345bcdec1bbb15e5363fad6b33bf960912


--

___
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 Raymond Hettinger

Raymond Hettinger added the comment:

This looks fine.  Feel free to apply and to backport this to earlier versions.

I would have guessed that the C compiler would have automatically removed the 
tail recursion, but your experience would indicate otherwise.

--
assignee:  -> twouters

___
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 c90ff1b78cb79bc3762184e03fa81f11984aaa45 by Serhiy Storchaka in 
branch '3.5':
bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#904)
https://github.com/python/cpython/commit/c90ff1b78cb79bc3762184e03fa81f11984aaa45


--

___
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

Changes by Serhiy Storchaka :


--
pull_requests: +804

___
Python tracker 

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



  1   2   >