[issue892902] problem with pickling newstyle class instances

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch addresses Alexandre's comments.

--
Added file: http://bugs.python.org/file40947/pickle_recursive-2.7_2.patch

___
Python tracker 

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



[issue25555] Fix parser and AST: fill lineno and col_offset when compiling AST from Python objects

2015-11-05 Thread STINNER Victor

New submission from STINNER Victor:

I wrote an AST optimizer which build AST from source code using ast.parse(), 
modify AST in place, and then compile the AST to bytecode.

The problem is that the lineno and col_offset attributes of the "arg" AST node 
are uninitialized when AST is rebuild from Python objects: compile(ast_tree, 
...). As a consequence, the compilation may fail because lineno or col_offset 
values are invalid.

Attached patch enhances Parser/asdl_c.py to take "arg" attributes in account. 
It also updates the generated files Include/Python-ast.h and 
Python/Python-ast.c, and fix usage of the arg() function in Python/ast.c.

It looks like only the "arg" AST node had attributes which were initialized 
(other AST nodes are handled with a different code path which already filled 
attributes).

See Parser/Python.asdl for the definition of the "arg" AST node.

Note: Python 2.7 is not affected. In Python 2, function arguments are simple 
expressions, they don't have a dedicated type with lineno and col_offset 
attributes. "arg" was introduced in Python 3 with the PEP 3107 (function 
annotations).

--
files: ast.patch
keywords: patch
messages: 254093
nosy: benjamin.peterson, haypo, matrixise, yselivanov
priority: normal
severity: normal
status: open
title: Fix parser and AST: fill lineno and col_offset when compiling AST from 
Python objects
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40949/ast.patch

___
Python tracker 

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



[issue25545] email parsing docs need to be clear that only ASCII strings are supported

2015-11-05 Thread Christian Tanzer

Christian Tanzer added the comment:

> Yes, the port from python2 to python3 of the email package
> was...suboptimal.
> ...
> The whole concept of using unicode as a 7bit data channel only is
> just...weird.

+100 to both.

> But, we are now stuck with maintaining that API for backward
> compatibility reasons.

That's a weird definition of backward compatibility, though. The API
breaks backward compatibility to Python 2. Any Python 3 user shouldn't
use the broken API anyway, IMHO.

> To fix it, I rewrote significant parts of the email package, which
> is the new API.

Which unfortunately isn't any help if one needs to stay compatible to
2.7.

> It also is...fraught with the danger of bugs...to talk about
> serializing an email message as a string, transforming it, and then
> trying to re-parse it as an email message.  If your transformations
> are simple, it will probably work, but anything at all complex runs
> the risk of breaking the message.

One of Python's mottos used to be:

   We are all consenting adults here.

But there are other uses for converting a message instance to a
unicode string. Display, printing, and grepping come to mind.

> And having non-ascii bodies counts as non-trivial.

For anybody living in a non-ascii country that statement sounds
**very strange**.

To start with, I have many friends with names that contain non-ascii
characters.

> You do have to conditionalize your 2/3 code to use the bytes parser
> and generator if you are dealing with 8-bit messages. There's just no
> way around that.

I did that yesterday. There are problems with that though:

* Recognizing the problem for what it is.

  Trying to run Python 2.7 code that *should* run under 3.5 but breaks
  with weird errors wastes a lot of time.

  Multiply with the number of Python programmers that want to migrate
  and you get a problem.

  If `message_as_string` and `as_string` just weren't there in 3.x it
  would be much less of a problem (clear documentation would also help
  but not as much).

* Lots of ugly workarounds for the same problem.

  Most of them (mine certainly included) are done quick and ad-hoc and
  probably break in many ways.

  The question then arises: why should one use the email package at
  all. But of course that way lies madness.

Just more roadblocks for the move to Python 3.

--

___
Python tracker 

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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Jeroen van der Heijden

New submission from Jeroen van der Heijden:

When compiling a regular expression with groups (subpatterns), 
circular references are created.
Here is an example to illustrate the problem:

>>> import gc
>>> import re
>>> gc.disable() # disable garbage collector
>>> gc.collect() # make sure we start with 0
0
>>> re.compile('(a|b)') # compile something with groups
re.compile('(a|b)')
>>> gc.collect() # collects x objects depending on the compiled string
11


To fix the issue a weakref object for p is used.

--
components: Library (Lib)
files: fix_mem_sre_parse.patch
keywords: patch
messages: 254092
nosy: joente
priority: normal
severity: normal
status: open
title: memory leak (reference cycles) using re
type: resource usage
versions: Python 3.5
Added file: http://bugs.python.org/file40948/fix_mem_sre_parse.patch

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch adds assertions to PyObject_GetItem() to ensure that an 
exception is raised if the function failed. _Py_CheckFunctionResult() could be 
used to implement such check, but it might adds a little overhead, whereas I 
really don't think that such bug occurs in the wild. The assertion only helps 
when you develop a new custom type implementing the mapping API.

The patch also simplifies Python/ceval.c: it now considers that an exception is 
raised if PyObject_GetItem() returns NULL.

Finally, the patch also fixes a bug in the LOAD_NAME bytecode, when globals are 
not a dict but a custom type and the name doesn't exist in globals: clear the 
exception before calling PyObject_GetItem() on builtins.

--
components: Interpreter Core
messages: 254094
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fixes for PyObject_GetItem()
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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Where is a patch?

--

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. The fix for LOAD_GLOBAL should be applied for all versions.

--
assignee:  -> haypo
stage: patch review -> commit review

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e87bcf20707 by Victor Stinner in branch '3.5':
Issue #25556: Fix LOAD_GLOBAL bytecode when globals type is not dict and the
https://hg.python.org/cpython/rev/1e87bcf20707

New changeset c1414f80ebc9 by Victor Stinner in branch 'default':
Issue #25556: Add assertions to PyObject_GetItem() to ensure that an exception
https://hg.python.org/cpython/rev/c1414f80ebc9

--
nosy: +python-dev

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed
versions: +Python 3.5

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about 3.4?

--

___
Python tracker 

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



[issue25557] Optimize LOAD_NAME bytecode

2015-11-05 Thread STINNER Victor

New submission from STINNER Victor:

The LOAD_GLOBAL bytecode has a fast-path when globals and builtins have exactly 
the type 'dict'. It calls the _PyDict_LoadGlobal() function.

I propose to implement a similar optimization for LOAD_NAME, see attached patch.

The patch also fixes LOAD_GLOBAL and LOAD_NAME bytecodes when locals, globals 
or builtins are not exactly the type 'dict'. It clears the KeyError before 
trying the next PyObject_GetItem().

The patch changes also _PyDict_LoadGlobal() to call PyObject_Hash() if the hash 
was not computed yet. It might make it a little bit faster.

--
components: Interpreter Core
files: pydict_loadname.patch
keywords: patch
messages: 254097
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize LOAD_NAME bytecode
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40950/pydict_loadname.patch

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

Oops, sorry. It's now attached to the issue :-)

--
keywords: +patch
Added file: http://bugs.python.org/file40951/pyobject_getitem.patch

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2015-11-05 Thread Alex Champandard

Alex Champandard added the comment:

I agree this makes --system-site-packages a useless option unless it's fixed. 
We just had many beginners install pyvenv's and get very confused because of 
this.

Passing ensurepip a new option to force it to install within a venv I think 
would work. What would it take to make progress on this?

--
nosy: +alexjc

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> LGTM. The fix for LOAD_GLOBAL should be applied for all versions.

Thanks for the review. I applied the LOAD_GLOBAL fix to Python 3.5 and 3.6. 
Python 2.7 doesn't support globals not being dict.

--

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> What about 3.4?

I consider it as almost dead (no more bugfixes), and this really is really a 
corner case. Except me, I don't think that anyone uses globals which are not 
dict :-D (It never worked...)

--

___
Python tracker 

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



[issue25557] Optimize LOAD_NAME bytecode

2015-11-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report and patch Jeroen.

Indeed, there is a regression, and your patch fixes it. But I don't like the 
idea of using weakref. For now sre_parse has very little dependencies, but 
weakref depends on collections that depends on a number of modules. For now 
importing weakref works, but it is too easy to create a dependency loop in 
future.

Here is alternative patch that gets rid of references at all. The subpatterns 
list was added in the patch for issue9179 and is an implementation detail. We 
can replace it with a list of subpattern widths.

--
assignee:  -> serhiy.storchaka
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett, serhiy.storchaka
stage:  -> patch review
versions: +Python 2.7, Python 3.4, Python 3.6
Added file: http://bugs.python.org/file40952/fix_mem_sre_parse_2.patch

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-11-05 Thread Martin Panter

Martin Panter added the comment:

Perhaps we can focus on the Python 2 version where there is always a newline 
appended. Here is a possible patch.

--
Added file: http://bugs.python.org/file40953/issue25495.base64.2.7.patch

___
Python tracker 

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



[issue25557] Optimize LOAD_NAME bytecode

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> When LOAD_NAME is generated? Is it worth to optimize this case? Aren't 
> LOAD_FAST and LOAD_GLOBAL used in performance critical code?

I guess that it's only used to execute the body of modules.

> Is it worth to optimize this case?

Hum, I don't know :-)

> It looks to me that there is a bug in fast path of _PyDict_LoadGlobal. If the 
> first lookup fails, it can raise an exception.

Sorry, where exactly? Can you maybe put a comment on the review? I see many 
checks to handle errors.

--

___
Python tracker 

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-11-05 Thread gul916

gul916 added the comment:

Hi,
Just a few words to tell you that I had the same problem to compile scipy 
0.16.0 with mkl libraries under python 3.5 and linux fedora 22. 
Pyatomic-2.patch solved the problem.
Thanks

--
nosy: +gul916

___
Python tracker 

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

"Pyatomic-2.patch solved the problem."

Great! The good news is that the Python 3.5.1 release has now a schedule: 
https://www.python.org/dev/peps/pep-0478/

"3.5.1 final: December 6, 2015"

--

___
Python tracker 

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



[issue25557] Optimize LOAD_NAME bytecode

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

When LOAD_NAME is generated? Is it worth to optimize this case? Aren't 
LOAD_FAST and LOAD_GLOBAL used in performance critical code?

It looks to me that there is a bug in fast path of _PyDict_LoadGlobal. If the 
first lookup fails, it can raise an exception. We have to add

if (PyErr_Occurred())
return NULL;

before the second lookup.

Just for reference, the fast path for LOAD_GLOBAL was added in 8f8fe990e82c.

--
nosy: +benjamin.peterson, rhettinger

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-11-05 Thread Mouse

Mouse added the comment:

Unfortunately, NO. The problem (and this bug report) is for Python-3 
documentation, so trying to address it in Python-2 rather than in Python-3 does 
not make sense.

We seem to both understand and agree that there is no length limitation on 
b2a_base64() input, either recommended or enforced - contrary to what the 
current Python-3 documentation implies.

We understand that *if* the *output* of this function is intended for use in 
MIME (rather than X.509 or whatever else Base64 is good for), then the caller 
should do other things besides calling b2a_base64(), and in all likelihood the 
caller is already aware of that - after all, if he figured that he needs Base64 
in his stuff, he probably knows something about what MIME standards say and 
require?. 

I repeat my original complaint: Python-3 documentation is buggy because it 
implies a restriction on the input that is not there. This reference should be 
removed from there because it confuses people. 
I've talked to those confused personally, so this is first-hand.

I refer you to the original msg253572 of this bug report.

If you want to write a MIME-in-Python tutorial, it is up to you - but 
b2a_base64() does not seem to be the right place for it.  
(And I'd rather see an X.509 tutorial if you're dead set on writing something 
besides strict plain b2a_base64() doc. :-)

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch converts some dynamic assert to static asserts 
(Py_BUILD_ASSERT_EXPR). This allows to check static invariants at compile time.

--
components: Extension Modules, Interpreter Core
files: use_Py_BUILD_ASSERT_EXPR.patch
keywords: patch
messages: 254117
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use static asserts in C code
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file40955/use_Py_BUILD_ASSERT_EXPR.patch

___
Python tracker 

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



[issue25553] SMTP.data(msg) function may cause the last CRLF of msg lost if msg is quoted-printable encoding.

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

RFC 2812 says:

  Note that the first  of this terminating sequence is also the  
that ends the final line of the data (message text)

So, smtplib is correct.  If you have a server that is not respecting this, then 
that server is out of compliance and there isn't anything we can do about it.

However, I don't think that is your problem.  = at the end of a line actually 
represents a "soft carriage return", which means one that is *eliminated* in 
the decoded output.  If you will read section 6.7 of rfc 2045, specifically 
notes (2) and (3) in the second block of numbered paragraphs, you will see that 
an 'ultimate' = (an = at the end of an encoded block, with or without a CRLF 
after it), such as you have in your sample, is illegal.  Further, the 
recommended recovery action if one is seen while decoding is to leave the = in 
the decoded output, just as you are observing happening.

So, there is no bug here except in your message :)

--
nosy: +r.david.murray
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



[issue25558] Use static asserts in C code

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

OK, I'll exclude Modules/_decimal/_decimal.c.

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread Stefan Krah

Stefan Krah added the comment:

Thank you!

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> This is a public name and can be used in third-party code.

Do you mean that a library can really rely on the result!? It would be insane 
:-)

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

A library can follow the example in the comment.

   #define foo_to_char(foo)  \
   ((char *)(foo)\
+ Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

+(void)Py_BUILD_ASSERT_EXPR(INT_MAX <= _PyTime_MAX / SEC_TO_NS);

Hum, maybe the existing macro should be renamed to Py_BUILD_ASSERT_EXPR and a 
new Py_BUILD_ASSERT_EXPR macro should add the (void) to ignore the result? It 
would avoid to have to repeat (void) everywhere.

What do you think?

--

___
Python tracker 

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



[issue25559] signal.siginterrupt description has typo

2015-11-05 Thread Tom Meagher

New submission from Tom Meagher:

"if flag is False, system calls will be restarted when interrupted by signal 
signalnum, otherwise system calls will be interrupted."

This sentence doesn't make any sense as written.  I assume there should be a 
"not" in there somewhere, but I'm unclear if signal calls are not interrupted 
when the flag is false, or not interrupted when they are true.

--
assignee: docs@python
components: Documentation
messages: 254121
nosy: Tom Meagher, docs@python
priority: normal
severity: normal
status: open
title: signal.siginterrupt description has typo
type: enhancement

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

Hum, maybe I wasn't clear: I propose attached macro.patch.

--
Added file: http://bugs.python.org/file40956/macro.patch

___
Python tracker 

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



[issue25559] signal.siginterrupt description has typo

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

The first phase says "restarted when interrupted", the second phrase says 
"interrupted".  So the difference is whether the system call is restarted or 
left in interrupted state (ie: the signal will propagate, which is confirmed by 
the second paragraph).  I can't see a way to phrase it any more clearly, can 
you?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-11-05 Thread Mouse

Mouse added the comment:

To add: I do not understand your attachment to that 57 "...(exactly 57 bytes of 
input data per line)", and request that this parenthesized sentence is removed 
from your Python-2.7 doc patch. 

Please give the reader the benefit of the doubt, and allow that *if* he wants 
to repeatedly call b2a_base64() instead of splitting its output - the ability 
to compute (76 * 3 / 4) is within his skill level.

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a public name and can be used in third-party code.

--

___
Python tracker 

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



[issue25545] email parsing docs need to be clear that only ASCII strings are supported

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

I agree that the situation is not the best, but it is the one we have.  I can't 
delete those methods now, they've existed in Python3 for too long, and 
initially were the only thing that worked (albeit only with ASCII only 
strings).  

If you can suggest ways of improving the string support without breaking 
existing python3 code that may be using it (most likely wrongly, but working 
for them), then I will happily review them.

As for "that sounds strange" about non-ascii bodies being non-trivial, remember 
that the context is the byte-string serialization protocol defined in RFC 5322. 
 This is the *evolution* of a protocol that started out ascii only, learned 
something about 8-bit data, then learned something about using bytes for 
handling other languages.  It is an evolutionary mess that has lots of 
pitfalls.  You can't simply serialize a message to unicode, preserving the RFC 
5322/MIME markup, and have a valid email, unless you make it a 7-bit clean 
(ascii only) representation.  And that is what the email package does.  So, 
conversely, email can only *parse* (as a string) a 7-bit, ASCII only, 
representation.

To do what you appear to want, to be able to represent non-ascii as the 
equivalent unicode *cannot work*, because email messages may contain binary 
data which *cannot* be represented in printable unicode.

So, it is *unfortunate* that a non-ascii body is non-trivial in email, but 
there's no getting around the fact that it is.  The new API in python3 aims to 
make it as simple as possible, but of course that doesn't help python2 users.  
But, making unicode easier is one big reason python3 exists (the biggest one, 
in practice).

--

___
Python tracker 

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



[issue25558] Use static asserts in C code

2015-11-05 Thread Stefan Krah

Stefan Krah added the comment:

Serhiy, could you please not change stuff that I maintain?  I know
you have the best intentions, but I really don't like these kinds
of changes (just like you don't like trailing whitespace :).

--
nosy: +skrah

___
Python tracker 

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



[issue24623] Parser: broken line numbers for triple-quoted strings

2015-11-05 Thread Stefan Krah

Stefan Krah added the comment:

Victor, I'm adding you just in case this also affects your
optimizer (like #2).

--

___
Python tracker 

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



[issue24623] Parser: broken line numbers for triple-quoted strings

2015-11-05 Thread Stefan Krah

Changes by Stefan Krah :


--
nosy: +haypo

___
Python tracker 

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



[issue25552] python turtle page does not run

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

This is not a place to get help with turtle programming, but rather a place to 
report bugs.  We know turtle works, we have tests :).  For help  your best bet 
would be the python-list mailing list, or perhaps python-tutor.  Probably the 
latter: I note that your program doesn't actually do anything, it just defines 
some functions.

--
nosy: +r.david.murray
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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue18010] pydoc search chokes on import errors

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I were not expected that the test will be so complex, and now I'm not sure 
that want it. :-(  But looks it can't be written simpler. The patch LGTM in any 
case.

--

___
Python tracker 

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



[issue25560] Unhandled warning in test_unicode_file

2015-11-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue25561] unstable result of time.monotonic

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> unstable result of time.monotonic

I'm sorry, I don't understand your problem. What do you expect? Why do you 
consider that your results are a bug? You computed the duration of "import 
unicodedata" using the system clock and using the monotonic clock. So what?

--

___
Python tracker 

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



[issue18010] pydoc search chokes on import errors

2015-11-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue25561] unstable result of time.monotonic

2015-11-05 Thread Ivan Bykov

New submission from Ivan Bykov:

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import platform
>>> platform.win32_ver()
('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
>>> 
Result of test.py:
C:\1>"test.py"
0.00 0.001000
C:\1>"test.py"
0.00 0.001001
C:\1>"test.py"
0.00 0.001000
C:\1>"test.py"
0.016000 0.001000
C:\1>"test.py"
0.00 0.001000
C:\1>"test.py"
0.016000 0.001000
C:\1>"test.py"
0.00 0.001000
C:\1>"test.py"
0.00 0.001000
C:\1>"test.py"
0.016000 0.001000

--
components: Windows
files: test.py
messages: 254136
nosy: haypo, ivb, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: unstable result of time.monotonic
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file40957/test.py

___
Python tracker 

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



[issue24802] int and float constructing from non NUL-terminated buffer

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Great! Besides few nitpicks the patch LGTM.

> However I don’t understand what you meant about restoring int(bytes, base) 
> behaviour. None of the patches here, nor in Issue 22896, touch long_new() in 
> /Objects/longobject.c.

long_new() uses PyNumber_Long(). I was wrong, the contrary case is affected, 
when the base is not specified.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue25560] Unhandled warning in test_unicode_file

2015-11-05 Thread ppperry

New submission from ppperry:

>python -Wall -m test.regrtest test_unicode_file
[1/1] test_unicode_file
C:\Python27\lib\shutil.py:64: UnicodeWarning: Unicode equal comparison failed 
to convert both arguments to Unicode - interpreting them as being unequal
  os.path.normcase(os.path.abspath(dst)))
C:\Python27\lib\shutil.py:64: UnicodeWarning: Unicode equal comparison failed 
to convert both arguments to Unicode - interpreting them as being unequal
  os.path.normcase(os.path.abspath(dst)))
C:\Python27\lib\shutil.py:64: UnicodeWarning: Unicode equal comparison failed 
to convert both arguments to Unicode - interpreting them as being unequal
  os.path.normcase(os.path.abspath(dst)))
C:\Python27\lib\shutil.py:64: UnicodeWarning: Unicode equal comparison failed 
to convert both arguments to Unicode - interpreting them as being unequal
  os.path.normcase(os.path.abspath(dst)))
1 test OK.

--
components: Tests
messages: 254133
nosy: ppperry
priority: normal
severity: normal
status: open
title: Unhandled warning in test_unicode_file
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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2015-11-05 Thread GuiHome

GuiHome added the comment:

We have been running this patch for several month now without any issue. 
Would be glad if a maintainer could review it and merge it upstream.

thanks

--
nosy: +guihome

___
Python tracker 

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



[issue12612] Valgrind suppressions

2015-11-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92dda5f00b0f by doko in branch '2.7':
Issue #12612: Add some Valgrind suppressions for 64-bit machines.
https://hg.python.org/cpython/rev/92dda5f00b0f

--

___
Python tracker 

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



[issue25469] multiprocessing .Condition.notify(_all) function has O(N) time complexity where N is the number of wait() calls with a timeout since the last notify(_all) call

2015-11-05 Thread Vilnis Termanis

Vilnis Termanis added the comment:

I've added a regression test for the proposed patch along the lines of the 
example script (i.e. fails before and passes with patch). Apologies if the test 
is a bit clumsy - maybe there is a more elegant way?

--
Added file: http://bugs.python.org/file40958/mp_sync_condition_with_test.patch

___
Python tracker 

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



[issue25563] Windows 10 IDLE / Tkinter startup problem

2015-11-05 Thread Martin Panter

Changes by Martin Panter :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
title: Windows 10 IDLE /Tniker  startup problem -> Windows 10 IDLE / Tkinter 
startup problem

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-11-05 Thread Martin Panter

Martin Panter added the comment:

Mouse, I know you originally opened this against 3.5. Apart from the module 
description at the bottom, my patch should be valid for 3.5 also. The relevant 
wording is identical to 2.7.

I have resisted removing the magic number 57 for a couple of reasons. Reading 
existing code that uses this number may be harder. David said he would be 
happier with it kept. I believed we could solve your original complaint and 
explain why the number was really there at the same time. It helps explain how 
the function was originally to be used, and why the newline is appended.

Anyway, I think it is best if I let this go, and someone else pick it up.

--

___
Python tracker 

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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread ppperry

Changes by ppperry :


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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread ppperry

ppperry added the comment:

`del __builtins__;min` only fails in IDLE if someone has previously set 
`__builtins__ to something else.
>>>__builtins__ = 7
>>> min
Traceback (most recent call last):
  File "", line 1, in 
min
NameError: name 'min' is not defined
>>>del __builtins__;min
Traceback (most recent call last):
  File "", line 1, in 
del __builtins__;min
NameError: name 'min' is not defined
>>del __builtins__;min


--

___
Python tracker 

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



[issue25563] Windows 10 IDLE / Tkinter startup problem

2015-11-05 Thread ppperry

Changes by ppperry :


--
nosy:  -ppperry

___
Python tracker 

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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread ppperry

New submission from ppperry:

In IDLE the following code silently works:
>>> del __builtins__
>>> min


In the standard interpreter, it produces an error:
>>> del __builtins__
>>> min
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'min' is not defined

Note that saying `__builtins__ = 7` fails in idle as well.

--
components: IDLE, Interpreter Core
messages: 254149
nosy: ppperry
priority: normal
severity: normal
status: open
title: IDLE behaves differently that the standard interpreter when someone 
types `del __builtins__`

___
Python tracker 

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



[issue25410] Clean up and fix OrderedDict

2015-11-05 Thread Eric Snow

Eric Snow added the comment:

All 3 patches look fine to me.

In "odict_resize_sentinel.patch", it would be nice if you could accomplish that 
with a single sentinel.  However, fixing the bug is more critical.

--

___
Python tracker 

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



[issue25410] Clean up and fix OrderedDict

2015-11-05 Thread Eric Snow

Changes by Eric Snow :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue25562] Python 2 & 3 don't allow the user to disable ctypes SEH in windows

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

This would be a new feature and so would not be acceptable for python2.7.

I wonder if cffi has such a switch.

--
nosy: +r.david.murray
type: behavior -> 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



[issue25563] Windows 10 IDLE / Tkinter startup problem

2015-11-05 Thread ppperry

ppperry added the comment:

This might be a duplicate of issue8820

--
nosy: +ppperry

___
Python tracker 

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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread ppperry

ppperry added the comment:

If you type `del __builtins__;min` an error is raise in both IDLE and the 
standard interpreter.

--

___
Python tracker 

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



[issue25465] Pickle uses O(n) memory overhead

2015-11-05 Thread Lukas Lueg

Lukas Lueg added the comment:

I very strongly doubt that it actually crashes your kernel - it basically 
can't. Your desktop becomes unresponsive for up to several minutes as the 
kernel has paged out about every single bit of memory to disk, raising access 
times by several orders of magnitude. Disable your swap and try again, it will 
just die.

--
nosy: +ebfe

___
Python tracker 

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



[issue25563] Windows 10 IDLE /Tniker startup problem

2015-11-05 Thread Lester Veenstra

New submission from Lester Veenstra:

C:\Users\lbv>python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
  File "", line 1, in 
  File "d:\python27\lib\lib-tk\Tkinter.py", line 38, in 
import FixTk
  File "d:\python27\lib\lib-tk\FixTk.py", line 65, in 
import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.

--
components: Tkinter
messages: 254144
nosy: veensl
priority: normal
severity: normal
status: open
title: Windows 10 IDLE /Tniker  startup problem
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



[issue25559] signal.siginterrupt description has typo

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

For more information on how Python handles signals, you can also read the PEP 
475 (which changed how Python 3.5 handles signals ;-))

--
nosy: +haypo

___
Python tracker 

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



[issue25495] binascii documentation incorrect

2015-11-05 Thread Georg Brandl

Georg Brandl added the comment:

issue25495.base64.2.7.patch looks good to me.  A similar patch can be adapted 
for 3.x.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue25562] Python 2 & 3 don't allow the user to disable ctypes SEH in windows

2015-11-05 Thread tzickel

New submission from tzickel:

In Windows, there is a mechanizm called SEH that allows C/C++ programs to catch 
OS Exceptions (such as divide by zero, page faults, etc..).

Python's ctypes module for some reason forces the user to wrap all ctypes FFI 
calls with a special SEH wrapper that converts those exceptions to Python 
exceptions.

For the UNIX people think about it that python installs a signal handler 
without you asking (or being able to remove it) when calling FFI functions.

The main issue with this, is that when you want to debug why a DLL behaves 
badly and you want a process dump (or catch the stack trace in the DLL) you 
can't without attaching a debugger and catching first-chance exceptions 
(because the ctypes SEH handling masks the issue).

My proposal is to have both in python 2 and in python 3 an option to call an 
FFI function with selectively using or not SEH.

Here is the SEH wrap (as you can see it's not optional in runtime):
https://github.com/python/cpython/blob/master/Modules/_ctypes/callproc.c#L806

--
components: ctypes
messages: 254143
nosy: amaury.forgeotdarc, belopolsky, meador.inge, tzickel
priority: normal
severity: normal
status: open
title: Python 2 & 3 don't allow the user to disable ctypes SEH in windows
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue25565] subprocess.Popen creates inheritable file descriptors on Windows, can leak to other child processes

2015-11-05 Thread Jack O'Connor

New submission from Jack O'Connor:

The Windows implementation of Popen calls _make_inheritable(), which creates 
inheritable copies of Popen's file descriptors. If two Popen calls happen at 
the same time on different threads, these descriptors can leak to both child 
processes. Here's a demonstration of a deadlock caused by this bug:

https://gist.github.com/oconnor663/b1d39d58b232fc627d84

Victor Stinner also wrote up a summary of the security issues associated with 
leaking file descriptors in PEP 0446.

A workaround for this issue is to protect all Popen calls with a lock. Calls to 
wait() and communicate() don't need to be protected, so you can release the 
lock before you make those blocking calls. I don't see a way to safely use 
run() or the other convenience functions, if you're using pipes and multiple 
threads. Unfortunately close_fds=True is not allowed on Windows when any of 
stdin/stdout/stderr are set, which is going the be the case here.

Would it be feasible for Popen.__init__() to automatically protect the 
inheritable copies it creates, with a lock around that section? We already have 
the _waitpid_lock for POSIX, so it seems like thread safety is a goal.

--
components: Library (Lib)
messages: 254168
nosy: oconnor663
priority: normal
severity: normal
status: open
title: subprocess.Popen creates inheritable file descriptors on Windows, can 
leak to other child processes
type: security
versions: Python 3.5

___
Python tracker 

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



[issue20607] multiprocessing cx_Freeze windows GUI bug (& easy fixes)

2015-11-05 Thread Mark Summerfield

Mark Summerfield added the comment:

No, I'm sorry I haven't tried with 3.5; in fact, there doesn't seem to be a 
cx_Freeze available for 3.5 yet.

--

___
Python tracker 

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



[issue21224] BaseHTTPRequestHandler, update the protocol version to http 1.1 by default?

2015-11-05 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

pong


patience is one key to success ;-)

--

___
Python tracker 

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



[issue21224] BaseHTTPRequestHandler, update the protocol version to http 1.1 by default?

2015-11-05 Thread Martin Panter

Martin Panter added the comment:

Actually RFC 7230 says “A server may reject a request that contains a message 
body but not a Content-Length by responding with 411 (Length Required)”, so 
maybe it is only clients that have to support chunked decoding. So I take back 
my paragraph about POST requests.

--

___
Python tracker 

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



[issue3353] make built-in tokenizer available via Python C API

2015-11-05 Thread Rose Ames

Changes by Rose Ames :


--
nosy: +superluser

___
Python tracker 

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



[issue25555] Fix parser and AST: fill lineno and col_offset when compiling AST from Python objects

2015-11-05 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Victor,

1. Result of the compilation -> success
2. I have checked your patch, I think there is no problem.
3. How can I test it? currently, everything is fine.

For me, this patch is ok and working, but I need the point 3.

--

___
Python tracker 

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



[issue25177] OverflowError in statistics.mean when summing large floats

2015-11-05 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Has anyone confirmed that this bug actually exists? I'm afraid that I cannot 
verify it. I get these results on three different computers:

py> x = 8.988465674311579e+307
py> statistics.mean([x, x])
8.988465674311579e+307
py> statistics.mean([x, x]) == x
True

running Python 3.4.3, a backport on 3.3.0rc3, and the default branch in the 
repo (3.6.0a).

--

___
Python tracker 

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



[issue25561] unstable result of time.monotonic

2015-11-05 Thread Eric V. Smith

Eric V. Smith added the comment:

I agree that there's no bug here: the timers are working as expected.

ivb: if you disagree, please explain what behavior you expected, versus what 
you see.

--
nosy: +eric.smith
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



[issue25469] multiprocessing .Condition.notify(_all) function has O(N) time complexity where N is the number of wait() calls with a timeout since the last notify(_all) call

2015-11-05 Thread Davin Potts

Changes by Davin Potts :


--
nosy: +davin
versions: +Python 2.7, Python 3.5

___
Python tracker 

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



[issue18010] pydoc search chokes on import errors

2015-11-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9098731de840 by Martin Panter in branch '3.4':
Issue #18010: Fix pydoc web server search to handle package exceptions
https://hg.python.org/cpython/rev/9098731de840

New changeset 8702efa1feb4 by Martin Panter in branch '3.5':
Issue #18010: Merge pydoc web search fix from 3.4 into 3.5
https://hg.python.org/cpython/rev/8702efa1feb4

New changeset d86ff708f545 by Martin Panter in branch 'default':
Issue #18010: Merge pydoc web search fix from 3.5
https://hg.python.org/cpython/rev/d86ff708f545

--
nosy: +python-dev

___
Python tracker 

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



[issue18010] pydoc search chokes on import errors

2015-11-05 Thread Martin Panter

Martin Panter added the comment:

In Python 2, it looks like instead of the web server search function there is a 
GUI search function. Here is a patch to fix the equivalent problem there. 
However I am not volunteering to make a test case; there does not seem to be 
any GUI tests to start with.

--
stage: commit review -> patch review
Added file: http://bugs.python.org/file40959/gui-search.patch

___
Python tracker 

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



[issue21224] BaseHTTPRequestHandler, update the protocol version to http 1.1 by default?

2015-11-05 Thread Martin Panter

Martin Panter added the comment:

What are the advantages of changing the default? Just that the user no longer 
has to set it manually?

What do you think of the problem mentioned in the documentation? If an existing 
HTTP 1.0 server that works fine in Python 3.5 were to suddenly have 
protocol_version="HTTP/1.1" forced by default, it sounds like all its responses 
may stop working (hang from the client’s POV) if they don’t explicitly close 
the connection.

One option could be to wrap the “wfile” stream in a chunk encoder, and insert 
Transfer-Encoding: chunked. I haven’t thought through this much, and it may not 
work very well because Python’s HTTP server is so low-level. This would 
basically be a HTTP 1.1 to HTTP 1.0 proxy.

Similarly, I understand HTTP 1.1 requires chunked encoding support for 
requests, but there is no support for that in the Python implementation. 
Existing servers accepting e.g. POST uploads would expect a Content-Length 
header, which would be hard to fake with a compatibility proxy (may need to 
buffer it all to count the bytes).

Another way might be a deprecation cycle, to force people using 3.6 to set 
protocol_version.

--
type:  -> enhancement

___
Python tracker 

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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread Steven D'Aprano

Changes by Steven D'Aprano :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue25157] Installing Python 3.5.0 32bit on Windows 8.1 64bit system gives Error 0x80240017

2015-11-05 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I confirm the problem can be fixed by installing SP-1 (on Windows 7). Thanks 
eryksun.

--

___
Python tracker 

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



[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2015-11-05 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am puzzled at the following.  Some reported today that IDLE crashed when 
pasting the Snake emoji U+1F40D .  I copied from Thunderbird and pasted in 
IDLE on Win10, with same UnicodeDecodeError as before.  I then ran this simple 
code

from tkinter import *  # 3.4, 3.5, 2.7 with Tkinter
root = Tk()
text = Text(root)
text.pack()
text.focus_set()  # required to work
root.mainloop()

pasted the char there, and to my surprise, a black & white version of the snake 
appeared. How?  I thought tk does not support astral chars? I copied from the 
Text window to paste above, where it is green for me.

--

___
Python tracker 

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



[issue20607] multiprocessing cx_Freeze windows GUI bug (& easy fixes)

2015-11-05 Thread Davin Potts

Davin Potts added the comment:

Mark:  Patches to 3.3 are generally not being considered (due to its age) but 
patches to 3.5 (possibly 3.4) would be.  You suggest the issue can't be 
reproduced in 3.4 but have to tried in the current 3.5 release?

--
nosy: +davin
type:  -> behavior

___
Python tracker 

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



[issue3559] Pasted \n not same as typed \n

2015-11-05 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In #9618, it was pointed out that IDLE Shell inherits from 
code.InteractiveConsole, and that #7741 proposes to allow multiple statements 
there.

In 3.5, this example from msg114561 now gives a SyntaxError, as it should.

>>> x = 3
y = 7

Seven years after opening this, I am more appreciative of 'enter and execute 
(and recall)' one statement at a time, especially for beginners.  Ditto for 
being able to edit a paste before executing.  So I am more inclined to just add 
the note to the doc (which currently says nothing about executing anyway).

Someone who wants to paste, execute, and recall multiple statements as a block, 
without having output interleaved, can wrap with 'if 1:'.

>>> if 1:
1+2
3+4

3
7

--
assignee:  -> terry.reedy
components: +Documentation
stage: patch review -> needs patch
versions: +Python 3.5, Python 3.6 -Python 3.3

___
Python tracker 

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



[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread Steven D'Aprano

Steven D'Aprano added the comment:

__builtins__ is a private implementation detail in CPython. There is no 
guarantees made about whether it exists or not. E.g. it doesn't exist in Jython.

steve@orac:~/python$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[OpenJDK Server VM (Sun Microsystems Inc.)] on java1.6.0_31
Type "help", "copyright", "credits" or "license" for more information.
>>> __builtins__
Traceback (most recent call last):
  File "", line 1, in 
NameError: name '__builtins__' is not defined

You should use `__builtin__` in Python 2 and `builtins` in Python 3. *Anything* 
you do to `__builtins__` with an S is implementation-dependent.


I don't think it is a bug that CPython behaves differently regarding 
__builtins__ depending on whether IDLE is running or not.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue25177] OverflowError in statistics.mean when summing large floats

2015-11-05 Thread Steven D'Aprano

Steven D'Aprano added the comment:

> Has anyone confirmed that this bug actually exists? 

Confirmed. The initial report is not quite correct: you need three 
values to trigger the overflow, not two:

py> x = 8.988465674311579e+307
py> statistics.mean([x]*2) == x
True
py> statistics.mean([x]*3) == x
Traceback (most recent call last):
  File "", line 1, in 
  File "./statistics.py", line 289, in mean
return _sum(data)/n
  File "./statistics.py", line 184, in _sum
return T(total)
  File "/usr/local/lib/python3.3/numbers.py", line 296, in __float__
return self.numerator / self.denominator
OverflowError: integer division result too large for a float

--

___
Python tracker 

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



[issue25563] Windows 10 IDLE / Tkinter startup problem

2015-11-05 Thread Lester Veenstra

Lester Veenstra added the comment:

May well be a duplicate of issue 8820 but never the less it is still a real 
problem

--

___
Python tracker 

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



[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is no the Snake emoji in my font, I use the Cat Face emoji U+1F431  
(\xf0\x9f\x90\xb1 in UTF-8, \x3d\xd8\x31\xdc in UTF-16LE).

Move cursor or press Backspace. I had needed to press Left 2 times to move 
cursor to the begin of the line, press Right 4 times to move cursor back to the 
end of line, and press Backspace 4 times to remove all stuff. What is called 
"Tk doesn't support astral characters".

Get the text programmically.

>>> text.get('1.0', '1.end')
'ð゚ミᄆ'
>>> print(ascii(text.get('1.0', '1.end')))
'\xf0\uff9f\uff90\uffb1'

On Linux the clipboard uses UTF-8, and this symbol is represented by 4-bytes 
bytestring b'\xf0\x9f\x90\xb1' (that is why Tk sometimes interpret it as 4 
characters). When you request the text content as a Unicode, Tcl fails to 
decode the string from UTF-8 and falls back to Latin1. Due to other bug it 
extends the sign of some bytes. When you programmically insert the same string 
back, it will be encoded to b'\xc3\xb0\xef\xbe\x9f\xef\xbe\x90\xef\xbe\xb1' and 
displayed as 'ð゚ミᄆ'.

On Windows the clipboard uses UTF-16LE and you can see different results.

The underlying graphical system can support astral characters, but Tk fails to 
handle them correctly.

--

___
Python tracker 

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



[issue25531] greenlet header file is missing inside virtualenv

2015-11-05 Thread Ned Deily

Ned Deily added the comment:

I've looked at this some more using variations of Alexy's test case and I now 
think there are at least two problems here.  And both issues have to do with 
confusion about exactly where a distribution's header files should be installed 
in venvs (created with the standard library venv) or virtual environments 
(created with the third-party virtualenv).

One, when building an extension module from a venv, py3 Distutils tries to add 
the path of the venv include directory to the list of include directories 
supplied to the C compiler front-end.  However, build_ext assumes that the 
include files have been installed in venv/include 
(Lib/distutils/command/build_ext.py#l157) while install.py uses an "install 
scheme"-specific location to install headers 
(Lib/distutils/command/install.py#l22); for unix non-user installs, that may be 
something like venv/include/python3.5m.  This is particularly a problem for a 
situation like here where the build of an extension module from one 
distribution, uwsgi, is dependent on the header files for an extension module 
from a previously installed distribution, greenlet.  So, to resolve this, it 
seems like build_ext needs to be smarter about the include path for venvs.  
There should also be test case(s) to ensure that install_headers and build_ext 
are using the same paths in all relevant environments, e.g. ven
 v, non-venv, user install, Windows, etc.

But even if that is fixed, there is another issue.  It appears pip uses yet 
another location for installing distribution header files in virtualenvs and 
venvs: venv/include/site/python3.5. So, if pip is used to install the 
distribution supplying the include files, the dependent distribution will still 
fail to build.  From the deleted comments in a recent commit 
(https://github.com/pypa/pip/commit/882cd358d1abd5e42df6333dddc42f52ab7d6ff2), 
it appears the reason why pip does this is that virtualenv creates a symlink to 
the interpreter's global include directory which means that include files from 
distributions installing to the virtualenv cannot be written to the normal 
(non-virtualenv) path.  It also looks like venv does not create such a symlink 
but depends on Distutils build_ext to supply paths to both the venv include 
directory and the global include directory to compilers.  I'm not sure what the 
right solution is here and I certainly may be missing something.  In any case, 
it must
  be possible for distributions to find the header files from other 
distributions regardless how they were installed.

Since these are all packaging issues, I think the PyPA folks need to take this 
and decide what action(s) are needed where.

--
components: +Distutils -Macintosh
nosy: +Marcus.Smith, dstufft, eric.araujo, ncoghlan, paul.moore -ronaldoussoren
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



[issue25531] greenlet header file is missing inside virtualenv

2015-11-05 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue18010] pydoc search chokes on import errors

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

gui-search.patch LGTM.

--

___
Python tracker 

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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7f4fca8f13a2 by Serhiy Storchaka in branch '3.5':
Issue #25554: Got rid of circular references in regular expression parsing.
https://hg.python.org/cpython/rev/7f4fca8f13a2

New changeset 8621727dd9f7 by Serhiy Storchaka in branch 'default':
Issue #25554: Got rid of circular references in regular expression parsing.
https://hg.python.org/cpython/rev/8621727dd9f7

--
nosy: +python-dev

___
Python tracker 

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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Jeroen van der Heijden

Jeroen van der Heijden added the comment:

Thanks Serhiy,

I totally agree with your solution. Using a list with subpattern widths is 
definitely better compared to using weakref.

--

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In issue25557 I mentioned that there is the same error for globals which are 
dict.

--

___
Python tracker 

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



[issue25556] Fixes for PyObject_GetItem()

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

> In issue25557 I mentioned that there is the same error for globals which are 
> dict.

This issue fixed a bug for LOAD_GLOBAL bytecode bytecode when globals are not 
dict. (Sorry, I wrote LOAD_NAME bytecode in my first message, it was a mistake.)

Please discuss the issue #25557 in the issue #issue25557. (I already replied 
there, I don't understand where you spotted a bug.)

--

___
Python tracker 

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



[issue25557] Optimize LOAD_NAME bytecode

2015-11-05 Thread STINNER Victor

STINNER Victor added the comment:

Rebased patch (ceval.c was modified by the changeset of c1414f80ebc9, issue 
#25556).

--
Added file: http://bugs.python.org/file40954/pydict_loadname-2.patch

___
Python tracker 

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