[issue26260] utf8 decoding inconsistency between P2 and P3

2016-02-01 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26261] NamedTemporaryFile documentation is vague about the `name` attribute

2016-02-01 Thread Antti Haapala

Changes by Antti Haapala :


--
type:  -> enhancement

___
Python tracker 

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



[issue26260] utf8 decoding inconsistency between P2 and P3

2016-02-01 Thread STINNER Victor

STINNER Victor added the comment:

> PAYLOAD.decode('utf8')  passes in P2.7.* and fails in P3.4

Well, Python 2 decoder didn't respect the Unicode standard. Please see:
http://unicodebook.readthedocs.org/issues.html#non-strict-utf-8-decoder-overlong-byte-sequences-and-surrogates

Python 3 is now stricted. You can still decode surrogate characters if you need 
them *for a good reason* using:

>>> b'\xed\xa0\x80'.decode('utf-8', 'surrogatepass')
'\ud800'

By they way, there is also:

>>> b'\xed\xa0\x80'.decode('utf-8', 'surrogateescape')
'\udced\udca0\udc80'

which is very different but may also help.

I suggest to close the issue as NOT A BUG.

--

___
Python tracker 

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



[issue26219] implement per-opcode cache in ceval

2016-02-01 Thread Yury Selivanov

Yury Selivanov added the comment:

Attaching a new version of the patch.  Issues #26058 and #26110 need to be 
merged before we can start reviewing it.

--
Added file: http://bugs.python.org/file41776/opcache2.patch

___
Python tracker 

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



[issue9779] argparse.ArgumentParser not support unicode in print help

2016-02-01 Thread Mark Stern

Mark Stern added the comment:

This bit me also. For anybody else reading this, argparsenobug.py includes a 
class that provides a workaround.

python argparsebug.py --help

works, but:

python argparsebug.py --help > 
python argparsebug.py --help | more

give the error.

However:

python argparsenobug.py --help
python argparsenobug.py --help > 
python argparsenobug.py --help | more

all work.

--
nosy: +markastern
Added file: http://bugs.python.org/file41774/argparsebug.py

___
Python tracker 

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



[issue9779] argparse.ArgumentParser not support unicode in print help

2016-02-01 Thread Mark Stern

Mark Stern added the comment:

And here is the source code with the workaround class

--
Added file: http://bugs.python.org/file41775/argparsenobug.py

___
Python tracker 

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



[issue26243] zlib.compress level as keyword argument

2016-02-01 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Thanks for the review.
1. Changed "bytes" to "data".
2. Updated Doc as in issue 26244 (will update the patch if there will be 
changes there).
3. Added version changed notice but i don't think there is a need for What's 
new update.

--
Added file: http://bugs.python.org/file41773/zlib-compress-level-keyword2.patch

___
Python tracker 

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



[issue26262] Cannot compile with /fp:strict with MSVC

2016-02-01 Thread Zachary Ware

New submission from Zachary Ware:

As reported in msg258685 (issue25934), Python cannot be built with /fp:strict 
while using MSVC.  As Mark showed in msg258686 and msg258689, there are three 
calculations that could be replaced with suitable constants to allow /fp:strict 
to be used.

(Nosy list copied from #25934)

--
components: Build, Windows
keywords: easy
messages: 259336
nosy: haypo, mark.dickinson, paul.moore, pitrou, python-dev, r.david.murray, 
serhiy.storchaka, skrah, steve.dower, tim.golden, tim.peters, zach.ware
priority: low
severity: normal
stage: needs patch
status: open
title: Cannot compile with /fp:strict with MSVC
type: compile error
versions: Python 3.6

___
Python tracker 

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



[issue25934] ICC compiler: ICC treats denormal floating point numbers as 0.0

2016-02-01 Thread Zachary Ware

Zachary Ware added the comment:

With the buildbots not angry over this, I'm closing the issue.  I opened #26262 
to follow the possibility of changing the initializers to allow /fp:strict with 
MSVC.

--
assignee:  -> zach.ware
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



[issue26110] Speedup method calls 1.2x

2016-02-01 Thread Yury Selivanov

Yury Selivanov added the comment:

For those interested in reviewing this patch at some point: please wait until I 
upload a new version.  The current patch is somewhat outdated.

--

___
Python tracker 

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



[issue26263] Serialize array.array to JSON by default

2016-02-01 Thread Omer Katz

New submission from Omer Katz:

Is there a reason why the JSON module doesn't serialize array.array() instances 
by default?
Currently you need to convert them to tuples but I'm confident that the C API 
for those types is enough to iterate over the array and serialize it to a JSON 
list.
We should support serializing arrays by default in my opinion.

--
components: Interpreter Core
messages: 259341
nosy: Omer.Katz
priority: normal
severity: normal
status: open
title: Serialize array.array to JSON by default
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2016-02-01 Thread Jonas Brunsgaard

Jonas Brunsgaard added the comment:

In my particular case, I developed an application close to beanstalkd, but with 
redis as "engine". I did create a callbackback reader class for users to 
subclass, the callbackreader is checking every second, on every 
tube(queue.Object). If new data has arrived for processing (this subroutine is 
using queue.get with wait_for). Maybe asyncio.Condition would have been the 
better choice. The easy solution was to check if the queue was empty and skip 
the read (get call) if there was nothing in the queue.

Before my fix, over a week the program would take up 10 Gigs of memory in our 
staging environment if nothing was touched, so I was assigned to investigate 
the cause. I think the current behavior is undesirable and cumbersome to see 
through, and if not changed there should be some kind of note in the 
documentation, so other good python folks will have a better chance to 
understand the behavior without reading the cpython asyncio queue 
implementation.

--

___
Python tracker 

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



[issue25788] fileinput.hook_encoded has no way to pass arguments to codecs

2016-02-01 Thread Joseph Hackman

Joseph Hackman added the comment:

I haven't seen OP in over 30 days, so am posting my own patch.

I've added an optional argument that defaults to strict and gets passed along.

I've updated the primary test to verify the argument passing, as well as that 
things get handled as specified in the documentation at 
https://docs.python.org/3.5/library/codecs.html

This is off-topic, but is there any way I can submit a patch that allows a 
similar fix for stdin? Presently there is no way at all to pass malformed 
unicode through fileinput using stdin that I can find.

--
keywords: +patch
nosy: +Joseph Hackman
Added file: http://bugs.python.org/file41777/issue25788.patch

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-02-01 Thread Andrew Barnert

Andrew Barnert added the comment:

> I did actually mean a version changed notice for the data model change. I see 
> this as a small expansion of the Python object API. Previously, 
> __reversed__() had to be a function, now you are also allowed to set it to 
> None. The collections ABCs are just catching up with the API change.

Are you suggesting that in Python 3.5, it's not defined what happens if you set 
__reversed__ = None on a sequence-like object and then call reversed()? I think 
any implementation has to raise a TypeError; the only difference is that we're 
now documenting the behavior directly, rather than forcing you to infer it from 
reading a half-dozen different parts of the docs and tracing through the 
implied behavior. It's already the best way to do it in 3.5, or even 2.5; the 
problem is that it isn't _obviously_ the best way. And I think a 
version-changed would send the wrong message: someone might think, "Oh, I can't 
use None here because I can't require 3.6, so what should I do? Write a method 
that raises TypeError when called?" (Which will work, but will then make it 
very hard to write a Reversible implicit ABC if they later want to.)

> Imagine someone using an Orderable virtual base class that tested for 
> __gt__() etc.

That's part of what we're trying to solve. Do you test that with hasattr, like 
Sized, or do you test for getattr with default None, like Hashable?

--

___
Python tracker 

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



[issue11597] Can't get ConfigParser.write to write unicode strings

2016-02-01 Thread neo gurb

neo gurb added the comment:

In file ConfigParser.py, def write, replace line

key = " = ".join((key, str(value).replace('\n', '\n\t')))

by

key = " = ".join((key, str(value).decode('utf-8').replace('\n', '\n\t')))

Tested in Windows7 and Ubuntu 15.04.

--
nosy: +neo gurb

___
Python tracker 

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



[issue26264] keyword.py missing async await

2016-02-01 Thread Timo Furrer

New submission from Timo Furrer:

I had a look at the *Lib/keyword.py* module. It seems like the auto generated 
*kwlist* is missing the *await* and *async* keywords.
At least according to https://www.python.org/dev/peps/pep-0492/ they are called 
*keywords*. 

The keyword module generates the *kwlist* from *Python/graminit.c*.

--
components: Library (Lib)
messages: 259349
nosy: tuxtimo
priority: normal
severity: normal
status: open
title: keyword.py missing async await
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



[issue26264] keyword module missing async and await keywords

2016-02-01 Thread Yury Selivanov

Yury Selivanov added the comment:

`async` and `await` are only keywords in the context of an 'async def' 
function.  It will be that way until Python 3.7.  That said, I'm not sure what 
to do about the keywords module.

Nick, Victor, thoughts?

--
nosy: +haypo, ncoghlan, yselivanov

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

This is not really my area of expertise, but I would have thought if you 
defined a __special__ method to something illegal (non-callable, or wrong 
signature) it would be reasonable for Python to raise an error at class 
definition (or assignment) time, not just later when you try to use it. 
Somewhere I think the documentation says you are only allowed to use these 
names as documented.

--

___
Python tracker 

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



[issue26254] ssl should raise an exception when trying to load an unusable key (ECC key not using a named curve)

2016-02-01 Thread Evgeny Kapun

Evgeny Kapun added the comment:

So, it looks like OpenSSL doesn't support keys using arbitrary curves at all. 
Then why don't I get an exception when trying to load such a key? Instead it 
just quietly disables all authenticated ciphersuites (anonymous ciphersuites 
still work) and then I get a confusing exception about lack of shared ciphers. 
I think that if it can't use a key, it should raise an exception right away.

--
resolution: not a bug -> 
status: closed -> open
title: ssl server doesn't work with ECC certificates -> ssl should raise an 
exception when trying to load an unusable key (ECC key not using a named curve)

___
Python tracker 

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



[issue26261] NamedTemporaryFile documentation is vague about the `name` attribute

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

Also the doc string could be updated. I guess suggesting “file.name” is even 
more confusing :)

--
nosy: +martin.panter
stage:  -> needs patch
versions: +Python 2.7, 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



[issue26255] symtable.Symbol.is_referenced() returns false for valid use

2016-02-01 Thread Luke Schubert

New submission from Luke Schubert:

If the following function is saved in listcomp.py:

def encode(inputLetters):
code = {'C':'D', 'F':'E'}
return set(code[x] for x in inputLetters)

and the following code is used to create a symtable for this function:

import symtable

if __name__ == "__main__":
fileName = 'listcomp.py'
f = open(fileName, 'r')
source = f.read()
table = symtable.symtable(source, fileName, 'exec')
children = table.get_children()
for childTable in children:
symbols = childTable.get_symbols()
for s in symbols:
if (not s.is_referenced()):
print ("Unused symbol '%s' in function '%s'"
   % (s.get_name(), childTable.get_name()))

then is_referenced() returns false for the 'code' symbol.

If the following function is saved instead:

def encode2(inputLetters):
code = {'C':'D', 'F':'E'}
return [ code[x] for x in inputLetters ]

then is_referenced() returns true for the 'code' symbol.

Possibly I'm misunderstanding what is_referenced() means, but I thought it 
should return true in both cases?

--
messages: 259316
nosy: luke.schubert
priority: normal
severity: normal
status: open
title: symtable.Symbol.is_referenced() returns false for valid use
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



[issue26256] Fast decimalisation and conversion to other bases

2016-02-01 Thread Jurjen N.E. Bos

New submission from Jurjen N.E. Bos:

Inspired by the recently new discovered 49th Mersenne prime number I wrote a 
module to do high speed long/int to decimal conversion. I can now output the 
new Mersenne number in 18.5 minutes (instead of several hours) on my machine.
For numbers longer than about 10 bits, this routine it is faster than 
str(number) thanks to the Karatsuba multiplication in CPython.
The module supports all number bases 2 through 36, and is written in pure 
python (both 2 and 3).
There is a simple way to save more time by reusing the conversion object 
(saving about half the time for later calls).
My suggestion is to incorporate this into some library, since Python still 
lacks a routine to convert to any number base. Ideally, it could be 
incorporated in the builtin str function, but this would need more work. 
When converting to C, it is recommended to optimize bases 4 and 32 the same way 
as oct, hex and bin do (which isn't easily accessible from Python).

Hope you like it. At least, it was a lot of fun to write...

Hope you like it.

--
components: Library (Lib)
files: fastStr.py
messages: 259317
nosy: jneb
priority: normal
severity: normal
status: open
title: Fast decimalisation and conversion to other bases
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file41770/fastStr.py

___
Python tracker 

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



[issue23735] Readline not adjusting width after resize with 6.3

2016-02-01 Thread Tiago Peixoto

Changes by Tiago Peixoto :


--
nosy: +count0

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-02-01 Thread Martin Panter

New submission from Martin Panter:

This sort of follows on from other cleanup of test_bytes.py in Issue 19587.

Currently buffer_tests defines one base test class, 
MixinBytesBufferCommonTests, which is used by test_bytes.py to test bytearray 
(but not bytes!). However there are other tests defined in test_bytes.py, or 
string_tests.py, which are run, or could be run, for both bytearray and bytes. 
I haven’t checking too closely, but I think all the methods in buffer_tests 
could be merged with other methods and collected into string_tests.BaseTest. 
Then they would get run for bytes, bytearray, str, and UserString.

The following methods are probably redundant with class 
string_tests.MixinStrUnicodeUserStringTest (only run for str and UserString). 
It looks like there is no bytes version of these tests:

* test_islower/upper/title/space/alpha/alnum/digit()
* test_title()
* test_splitlines()

test_capitalize() looks redundant with half of the method in 
string_tests.CommonTest (also only run for str and UserString). Again there 
doesn’t seem to be a bytes version of it. I think the common part could be 
moved into BaseTest, and the unicode-specific part left where it is.

The following are probably also redundant with class string_tests.CommonTest:

* test_ljust/rjust/center()
* test_swapcase()
* test_zfill()

For ljust(), rjust() and center(), there are also tests run for bytes and 
bytearray in test_bytes.BaseBytesTest that could also be merged at the same 
time. But swapcase() and zfill() don’t seem to be currently tested for bytes.

--
components: Tests
messages: 259318
nosy: martin.panter
priority: normal
severity: normal
stage: needs patch
status: open
title: Eliminate buffer_tests.py
type: 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



[issue26255] symtable.Symbol.is_referenced() returns false for valid use

2016-02-01 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules, Library (Lib)
nosy: +benjamin.peterson

___
Python tracker 

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



[issue26255] symtable.Symbol.is_referenced() returns false for valid use

2016-02-01 Thread Xiang Zhang

Changes by Xiang Zhang <18518281...@126.com>:


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue26125] Incorrect error message in the module asyncio.selector_events.

2016-02-01 Thread Berker Peksag

Berker Peksag added the comment:

Victor committed this in 97c80e317ab8 (3.5) and c7f1acdd8be1 (default). Closing 
as "fixed".

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue26257] Eliminate buffer_tests.py

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

I didn’t end up merging test_ljust/rjust/center() from test_bytes. Those tests 
are more specific to bytes and bytearray, so they are better left as-is.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file41771/buffer_tests.patch

___
Python tracker 

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



[issue19587] Remove empty tests in test_bytes.FixedStringTest

2016-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 22c2dd04a3d3 by Martin Panter in branch '3.5':
Issue #19587: Remove masked and redundant tests in test_bytes
https://hg.python.org/cpython/rev/22c2dd04a3d3

New changeset 8545a082fcaa by Martin Panter in branch 'default':
Issue #19587: Merge test_bytes cleanup from 3.5
https://hg.python.org/cpython/rev/8545a082fcaa

--
nosy: +python-dev

___
Python tracker 

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



[issue19587] Remove empty tests in test_bytes.FixedStringTest

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

Thanks Serhiy for reviewing. You are right that buffer_tests is only run on 
bytearray; I must have gotten mixed up. I fixed the comment in the version I 
committed.

Yes I think I agree with eliminating buffer_tests.py, which is only run for 
bytearray. I opened Issue 26257 for that.

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



[issue26256] Fast decimalisation and conversion to other bases

2016-02-01 Thread Mark Dickinson

Mark Dickinson added the comment:

Very nice. I'd suggest posting it as a recipe or as a Python package on PyPI 
for others to use. It's not really something that it would be appropriate to 
add to the Python core: Python isn't really intended for super-efficient 
high-precision arithmetic, and there are external libraries for that sort of 
thing (like gmpy2, for example).

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue26261] NamedTemporaryFile documentation is vague about the `name` attribute

2016-02-01 Thread Antti Haapala

New submission from Antti Haapala:

The documentation for NamedTemporaryFile is a bit vague. It says

[--] That name can be retrieved from the name attribute of the file object. 
[--] The returned object is always a file-like object whose file
attribute is the underlying true file object. This file-like object can be used 
in a with statement, just like a normal file.

That `file-like object` vs `true file object` made me assume that I need to do

f = NamedTemporaryFile()
f.file.name

to get the filename, which sort of worked, but only later realized that 
`f.file.name` is actually the file descriptor number on Linux, a.k.a an 
integer. Thus I suggest that the one sentence be changed to "That name can be 
retrieved from the name attribute of the returned file-like object."

--
assignee: docs@python
components: Documentation
messages: 259334
nosy: docs@python, ztane
priority: normal
severity: normal
status: open
title: NamedTemporaryFile documentation is vague about the `name` attribute

___
Python tracker 

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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2016-02-01 Thread Guido van Rossum

Guido van Rossum added the comment:

I think this is expected behavior when you do a lot of get() calls
that are cancelled by a timeout. Each call leaves a cancelled Future
in the deque self._getters; these are removed only when _wakeup_next()
is called (by put or put_nowait).

Why is your app doing this?

I suppose we could band-aid this by removing cancelled Futures when
next calling get(), but that won't help if you start a load of get()
calls and then cancel them all.

Note that I don't want to complicate this code -- in the past it has
been very difficult to prove it was correct under all circumstances,
and now I am sure it is correct (barring memory leaks, as you've
shown). I want to make sure any fix for this issue doesn't complicate
the code, making it harder to understand or prove its correctness.

On Mon, Feb 1, 2016 at 8:06 AM, Jonas Brunsgaard  wrote:
>
> New submission from Jonas Brunsgaard:
>
> When making repeated calls to queue.get, memory is building up and is not 
> freed until queue.push is called.
>
> I wrote this little program to show my findings. The program will perform a 
> lot of calls to queue.get and once every 60 seconds a queue.push is 
> performed. Every 15 seconds the memory usage of dictionaries is printet to 
> the console. You can find the output below the program
>
> ```
> import asyncio
> from pympler import muppy
> from pympler import summary
>
>
> q = asyncio.Queue()
> loop = asyncio.get_event_loop()
> closing = False
>
>
> async def get_with_timeout():
> while not closing:
> try:
> task = asyncio.ensure_future(q.get())
> await asyncio.wait_for(task, 0.2)
> except asyncio.TimeoutError:
> pass
>
> def mem_profiling():
> if not closing:
> types_ = muppy.filter(muppy.get_objects(), Type=dict)
> summary.print_(summary.summarize(types_))
> loop.call_later(15, mem_profiling)
>
> def put():
> q.put_nowait(None)
> loop.call_later(60, put)
>
> put()
> tasks = [asyncio.ensure_future(get_with_timeout()) for _ in range(1)]
> mem_profiling()
>
> try:
> loop.run_forever()
> except KeyboardInterrupt:
> closing = True
> loop.run_until_complete(
> asyncio.ensure_future(asyncio.wait(tasks)))
> finally:
> loop.close()
> ```
>
> Output:
>
>types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>  types |   # objects |   total size
>  | === | 
>
> What we see is that memory builds up ~3mb/s, and when the push method is 
> called the memory usage returns to normal.
>
> Is this the expected behavior or is this a bug? If it is expected I think we 
> should update the documentation, to let people know about this behavior.
>
> --
> Jonas Brunsgaard
>
> --
> components: asyncio
> files: poc.py
> messages: 259327
> nosy: Jonas Brunsgaard, gvanrossum, haypo, yselivanov
> priority: normal
> severity: normal
> status: open
> title: Memleak when repeated calls to asyncio.queue.Queue.get is performed, 
> without push to queue.
> type: resource usage
> versions: Python 3.5
> Added file: http://bugs.python.org/file41772/poc.py
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

___

[issue26110] Speedup method calls 1.2x

2016-02-01 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu :


--
nosy: +alecsandru.patrascu

___
Python tracker 

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



[issue26258] readline module for python 3.x on windows

2016-02-01 Thread STINNER Victor

STINNER Victor added the comment:

The Python readline is a thin wrapper on top of the UNIX readline library.

You need a port of the readline library to Windows. There are some ports, but I 
don't think that Python can take the responsability to endorse them, ports seem 
unofficial.

Example: http://gnuwin32.sourceforge.net/packages/readline.htm -- last release 
8 years ago...

MinGW & Cygwin have readline on Windows, but it's a different tool chain (GCC) 
than the current toolchain used by Python on Windows (Visual Studio).

--
nosy: +haypo

___
Python tracker 

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



[issue26248] Improve scandir DirEntry docs, especially re symlinks and caching

2016-02-01 Thread Ben Hoyt

Ben Hoyt added the comment:

Thanks, Victor!

--

___
Python tracker 

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



[issue26260] utf8 decoding inconsistency between P2 and P3

2016-02-01 Thread Jim Jin

Jim Jin added the comment:

Thank you very much for your help!

--

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

The documentation about double-underscore names: 
.
 It says any undocumented usage may be broken. The technique with __hash__() is 
already documented: 
.

I have seen your 5th patch, and do appreciate the new improvements. (I think I 
did see an email for it. But a while ago G Mail started treating a lot of stuff 
as spam until I made a special rule for bug tracker emails.)

--

___
Python tracker 

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



[issue26238] httplib use wrong hostname in https request with SNI support

2016-02-01 Thread lirenke

lirenke added the comment:

In RFC6066, literal IPv4 is not allowed as hostname indeed. Actually, many 
requests still use the format of "IP+PORT" to access the server, and it seems 
Python don't prohibit this action explicitly. The explorer Chrome also use 
literal IP address to access for instance.

In our case, all requests will be forwarded by apacheproxy and there is another 
apache server that receiving them. The URL is like 
"https://128.6.42.21:8088/xx/;, and the SNI will be added by OpenSSL in 
TLS-handshake packet when new https connection create. In this time, 
"128.6.42.21:8088" is set to self._tunnel_host in set_tunnel(), then, the 
server_hostname, as SNI, is determined.

The Server side's apache will check the SNI between handshake packet and local 
vHost configuration. So it is the place where mismatch happen. Error Code 400, 
Bad Request will return to 
client.
 
Definitely, port number shouldn't be a part of SNI. Compare with Chrome do, we 
hope Python could handle the server_hostname precisely too. Calling 
self._get_hostport() again and setting the IP address to server_hostname 
without port number is our suggestion.

--

___
Python tracker 

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



[issue26219] implement per-opcode cache in ceval

2016-02-01 Thread Yury Selivanov

Changes by Yury Selivanov :


--
hgrepos: +333

___
Python tracker 

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



[issue26244] zlib.compressobj level default value documentation

2016-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 650cf38fba28 by Martin Panter in branch '2.7':
Issue #26244: Clarify default zlib compression level in documentation
https://hg.python.org/cpython/rev/650cf38fba28

New changeset 950e0bfe94ae by Martin Panter in branch '3.5':
Issue #26244: Clarify default zlib compression level in documentation
https://hg.python.org/cpython/rev/950e0bfe94ae

New changeset 03708c680eca by Martin Panter in branch 'default':
Issue #26244: Merge zlib documentation from 3.5
https://hg.python.org/cpython/rev/03708c680eca

--
nosy: +python-dev

___
Python tracker 

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



[issue26194] Undefined behavior for deque.insert() when len(d) == maxlen

2016-02-01 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue26238] httplib use wrong hostname in https request with SNI support

2016-02-01 Thread lirenke

lirenke added the comment:

We use Python 2.7.9, and I have checked the httplib.py in 2.7.11 version same 
time. Notice that in set_tunnel(), self._tunnel_host have already updated by 
calling _get_hostport(), just like you said. It's different between 2.7.9 and 
2.7.11.

Then, I replace the file and retry, the problem is gone. Maybe this is an fixed 
bug before which I don't notice.

I think it's time to upgrade python for us...
Thank you for your remind and help, Martin.

--
status: open -> closed

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-02-01 Thread Guido van Rossum

Guido van Rossum added the comment:

> This is not really my area of expertise, but I would have thought if you 
> defined a __special__ method to something illegal (non-callable, or wrong 
> signature) it would be reasonable for Python to raise an error at class 
> definition (or assignment) time, not just later when you try to use it.

No, that's not the intention.

> Somewhere I think the documentation says you are only allowed to use these 
> names as documented.

Indeed, but it's not enforced. What it means is that when the next
release of Python (or a different implementation) changes the meaning
of a __special__ name, you can't complain that your code broke.

(And please don't go suggesting that we start enforcing it.)

--

___
Python tracker 

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



[issue25945] Type confusion in partial_setstate and partial_call leads to memory corruption

2016-02-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This looks correct.

--
assignee: rhettinger -> serhiy.storchaka

___
Python tracker 

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



[issue26194] Undefined behavior for deque.insert() when len(d) == maxlen

2016-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7dabb94bdf63 by Raymond Hettinger in branch '3.5':
Issue #26194:  Inserting into a full deque to raise an IndexError
https://hg.python.org/cpython/rev/7dabb94bdf63

--

___
Python tracker 

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



[issue26110] Speedup method calls 1.2x

2016-02-01 Thread Eric Fahlgren

Changes by Eric Fahlgren :


--
nosy: +eric.fahlgren

___
Python tracker 

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



[issue26255] symtable.Symbol.is_referenced() returns false for valid use

2016-02-01 Thread Benjamin Peterson

Benjamin Peterson added the comment:

The genexp implicitly creates a nested function in which *code* is referenced.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26264] keyword module missing async and await keywords

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

What happened in cases like “with” and “yield”, when these names were turned 
into reserved keywords depending on a __future__ statement?

--
nosy: +martin.panter

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-02-01 Thread Andrew Barnert

Andrew Barnert added the comment:

> This is not really my area of expertise, but I would have thought if you 
> defined a __special__ method to something illegal (non-callable, or wrong 
> signature) it would be reasonable for Python to raise an error at class 
> definition (or assignment) time, not just later when you try to use it.

As Guido pointed out on the -ideas thread, defining __spam__ = None to block 
inheritance of a superclass implementation has long been the standard way to 
mark a class unhashable. So, any Python that raised such an error would break a 
lot of code. 

> Somewhere I think the documentation says you are only allowed to use these 
> names as documented.

I can't find anything that says that. Any idea where to look? That might be 
worth adding, but if we add it at the same time as (or after) we explicitly 
document the None behavior, that's not a problem. :)

By the way, did you not review my last patch because you didn't get an email 
for it? I think Rietveld #439 
(http://psf.upfronthosting.co.za/roundup/meta/issue439) may be causing issues 
to get stalled in the patch stage because people are expecting to get flagged 
when a new patch goes up but never see it (unless they're on the same mail 
domain as the patcher).

--

___
Python tracker 

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



[issue24421] Race condition compiling Modules/_math.c

2016-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 76624d47ee99 by Martin Panter in branch 'default':
Issue #24421: Compile _math.c separately to avoid race condition
https://hg.python.org/cpython/rev/76624d47ee99

--
nosy: +python-dev

___
Python tracker 

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



[issue26264] keyword module missing async and await keywords

2016-02-01 Thread Timo Furrer

Changes by Timo Furrer :


--
title: keyword.py missing async await -> keyword module missing async and await 
keywords

___
Python tracker 

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



[issue26243] zlib.compress level as keyword argument

2016-02-01 Thread Martin Panter

Martin Panter added the comment:

Thanks, it looks good to me. I think “data” is a better name than “bytes”.

About What’s New, I thought the general idea was to document all enhancements, 
though I admit this is about as small as they come. There is precedent with the 
compile() builtin (Issue 1444529, Python 2.6), although there is no indication 
of kwargs in the main documentation for compile(). But on the other hand, 
str.split() didn’t get any What’s New entry (Issue 14081, Python 3.3). See also 
.

--

___
Python tracker 

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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2016-02-01 Thread Guido van Rossum

Guido van Rossum added the comment:

> The easy solution was to check if the queue was empty and skip the read (get 
> call) if there was nothing in the queue.

There's an API for that -- get_nowait().

I'm happy to review a fix if you come up with one. But I currently
don't have time to devise a fix myself. (Not even a docfix, if you
think that's sufficient, but if you submit one it will swiftly be
applied.)

On Mon, Feb 1, 2016 at 9:28 AM, Jonas Brunsgaard  wrote:
>
> Jonas Brunsgaard added the comment:
>
> In my particular case, I developed an application close to beanstalkd, but 
> with redis as "engine". I did create a callbackback reader class for users to 
> subclass, the callbackreader is checking every second, on every 
> tube(queue.Object). If new data has arrived for processing (this subroutine 
> is using queue.get with wait_for). Maybe asyncio.Condition would have been 
> the better choice. The easy solution was to check if the queue was empty and 
> skip the read (get call) if there was nothing in the queue.
>
> Before my fix, over a week the program would take up 10 Gigs of memory in our 
> staging environment if nothing was touched, so I was assigned to investigate 
> the cause. I think the current behavior is undesirable and cumbersome to see 
> through, and if not changed there should be some kind of note in the 
> documentation, so other good python folks will have a better chance to 
> understand the behavior without reading the cpython asyncio queue 
> implementation.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue26258] readline module for python 3.x on windows

2016-02-01 Thread Ali Razmjoo

New submission from Ali Razmjoo:

Hello,

I using python 2.7.10 on windows and there isn't any problem with this readline 
module, but it's not exist in python3.x on windows, is it possible to add it ? 
how?

--
messages: 259322
nosy: Ali Razmjoo
priority: normal
severity: normal
status: open
title: readline module for python 3.x on windows

___
Python tracker 

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



[issue26256] Fast decimalisation and conversion to other bases

2016-02-01 Thread Jurjen N.E. Bos

Jurjen N.E. Bos added the comment:

Thanks for the tip. I'll consider making it a recipe.
- Jurjen

--

___
Python tracker 

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



[issue26110] Speedup method calls 1.2x

2016-02-01 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

Yury, thank you for the heads up! Here at Intel, in the Dynamic Scripting 
Languages Optimization Team, we can help the community with reviewing and 
measuring this patch in our quiet and stable environment, the same one that we 
use to provide public CPython daily measurements. We will wait for your update.

--

___
Python tracker 

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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2016-02-01 Thread Jonas Brunsgaard

New submission from Jonas Brunsgaard:

When making repeated calls to queue.get, memory is building up and is not freed 
until queue.push is called.

I wrote this little program to show my findings. The program will perform a lot 
of calls to queue.get and once every 60 seconds a queue.push is performed. 
Every 15 seconds the memory usage of dictionaries is printet to the console. 
You can find the output below the program

```
import asyncio
from pympler import muppy
from pympler import summary


q = asyncio.Queue()
loop = asyncio.get_event_loop()
closing = False


async def get_with_timeout():
while not closing:
try:
task = asyncio.ensure_future(q.get())
await asyncio.wait_for(task, 0.2)
except asyncio.TimeoutError:
pass

def mem_profiling():
if not closing:
types_ = muppy.filter(muppy.get_objects(), Type=dict)
summary.print_(summary.summarize(types_))
loop.call_later(15, mem_profiling)

def put():
q.put_nowait(None)
loop.call_later(60, put)

put()
tasks = [asyncio.ensure_future(get_with_timeout()) for _ in range(1)]
mem_profiling()

try:
loop.run_forever()
except KeyboardInterrupt:
closing = True
loop.run_until_complete(
asyncio.ensure_future(asyncio.wait(tasks)))
finally:
loop.close()
```

Output:

   types |   # objects |   total size
 | === | 
http://bugs.python.org/file41772/poc.py

___
Python tracker 

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



[issue26260] utf8 decoding inconsistency between P2 and P3

2016-02-01 Thread Jim Jin

New submission from Jim Jin:

PAYLOAD1 = b'\xce\xba\xe1\xbd\xb9\xcf\x83\xce\xbc\xce\xb5'
   PAYLOAD2 = b'\xed\xa0\x80'  
   PAYLOAD3 = b'\x65\x64\x69\x74\x65\x64'
   PAYLOAD = PAYLOAD1 + PAYLOAD2 + PAYLOAD3

   PAYLOAD.decode('utf8')  passes in P2.7.* and fails in P3.4

   Thank you for reading.

--
components: Unicode
messages: 259329
nosy: ezio.melotti, haypo, jinz
priority: normal
severity: normal
status: open
title: utf8 decoding inconsistency between P2 and P3
type: enhancement
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



[issue26252] Add an example to importlib docs on setting up an importer

2016-02-01 Thread jan matejek

Changes by jan matejek :


--
nosy: +matejcik

___
Python tracker 

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