[issue26211] HTMLParser: “AssertionError: we should not get here!”

2016-01-27 Thread Yannick Duchêne

Yannick Duchêne added the comment:

`reset` is called to stop the parser.

If really `reset` should not be called during parser hooks execution, then the 
documentation should says so and an error should be raised when `reset` is 
invoked.

--

___
Python tracker 

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



[issue26214] textwrap should minimize breaks

2016-01-27 Thread Tuomas Salo

New submission from Tuomas Salo:

This code:

import textwrap
textwrap.wrap("123 123 1234567", width=5)

currently* produces this output:

['123', '123 1', '23456', '7']

I would expect the textwrap module to only break words when absolutely 
necessary. That is, I would have expected it to produce one break less:

['123', '123', '12345', '67']

This is of course a matter of taste - the current implementation produces more 
efficiently filled lines.

(* I only have access to Python 2.7 and 3.4)

--
messages: 258999
nosy: Tuomas Salo
priority: normal
severity: normal
status: open
title: textwrap should minimize breaks
type: behavior
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



[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-27 Thread Tuomas Salo

Changes by Tuomas Salo :


--
title: textwrap should minimize breaks -> textwrap should minimize number of 
breaks in extra long words

___
Python tracker 

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



[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-27 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +georg.brandl
versions: +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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Yannick Duchêne

Yannick Duchêne added the comment:

The documentation says:
> Reset the instance. Loses all unprocessed data.

How can parsing go ahead with all unprocessed data lost? This is the “Loses all 
unprocessed data” which made me believe it is to stop it.

May be the documentation is unclear.

By the way, if `reset` does not stop the parser, then a `stop` method is 
missing. I searched for it, and as there was nothing else and could not imagine 
the parser cannot be stopped, I though `reset` is the way to stop it.

--

___
Python tracker 

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



[issue17394] Add slicing support to collections.deque

2016-01-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thank you for doing this work.

--

___
Python tracker 

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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Actually it does move forward since in goahead, it first store a "copy" of the 
initial self.rawdata and use it to control the flow. If you make some change to 
self.rawdata when parsing, for example call reset, goahead can not feel it. But 
methods parse_* can. So the data conflicts.

I think it's not proper to change self.rawdata when parsing. You can easily get 
various errors by doing that.

--

___
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-01-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

But the postcondition d[i] == newitem is broken if i is negative.

>>> d = deque('ABC', maxlen=3)
>>> d.insert(-1, None)
>>> d
deque(['A', None, 'B'], maxlen=3)

I would expected ['A', 'B', None].

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

___
Python tracker 

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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Yannick Duchêne

Yannick Duchêne added the comment:

Thanks Xiang, for the clear explanations.

So an error should be triggered when `reset` is invoked while it should not. 
And remains the issue about how to stop the parser: should an exception be 
raised and caught at an outer invocation level? Something like raising 
StopIteration? (I don't enjoy using exceptions for flow control, but that seems 
to be the Python way, cheese).

--

___
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-01-27 Thread STINNER Victor

STINNER Victor added the comment:

> I would expected ['A', 'B', None].

Hum, it seems consistent with list behaviour, no?

>>> x=list("abc")
>>> x.insert(-1, "X")
>>> x
['a', 'b', 'X', 'c']

-1 is the same than len(x)-1 (2 in this example).

deque(['A', None, 'B'], maxlen=3) seems correct to me.

--
nosy: +haypo

___
Python tracker 

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



[issue26211] HTMLParser: “AssertionError: we should not get here!”

2016-01-27 Thread Yannick Duchêne

Yannick Duchêne added the comment:

I'm closing this issue, as the the issue http://bugs.python.org/issue26210 is 
the real one and this one seems to be a variant of the former.

--
status: open -> closed

___
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-01-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

-1 is the position before the last element ('C'). After popping-off extra 
element the result can be ['A', 'B', None] or ['B', None, 'C'].

--

___
Python tracker 

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



[issue26206] test_socket.testRecvmsgPeek() timeout on "AMD64 Debian root 3.x" buildbot

2016-01-27 Thread Martin Panter

Martin Panter added the comment:

A few more details from 
:

* Affects Python 3 but not 2.7.
* Offending test case: RecvmsgUDP6Test.testRecvmsgPeek()
* Seems to correspond with the buildbot VM’s config recently being rebuilt

--
nosy: +martin.panter
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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Hmm, I don't know whether I am right or not. Let's wait for a core member to 
clarify. If I am wrong, I am quite sorry.

I don't think invoking reset when parsing should raise an error(and I don't 
know how to achieve that). When to invoke a subroutine is determined by the 
programmer. You can always put a well-written subroutine in some wrong place 
and then cause error. And I don't see how to stop the process either.

--

___
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-01-27 Thread STINNER Victor

STINNER Victor added the comment:

> -1 is the position before the last element ('C'). After popping-off extra 
> element the result can be ['A', 'B', None] or ['B', None, 'C'].

Oh ok :-) Now I'm confused, I don't know what is the expected behaviour :-)

--

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2016-01-27 Thread tony gaetani

Changes by tony gaetani :


--
nosy: +tonygaetani

___
Python tracker 

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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Yannick Duchêne

Yannick Duchêne added the comment:

> And I don't see how to stop the process either.

I just did it with `raise StopIteration`, caught at a proper place (in the 
procedure which invokes `feed` and `close`), and it seems to be fine, I have no 
more strange behaviours. At least, I cannot see a cleaner way.

Now `reset` is invoked after end of parsing only (thus to be able to have a 
next round).

--

___
Python tracker 

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



[issue26210] `HTMLParser.handle_data` may be invoked although `HTMLParser.reset` was invoked

2016-01-27 Thread Yannick Duchêne

Changes by Yannick Duchêne :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue26098] PEP 510: Specialize functions with guards

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 5: implement PyFunction_RemoveSpecialized() and 
PyFunction_RemoveAllSpecialized() functions (with unit tests!).

I'm not sure that PyFunction_RemoveSpecialized() must return 0 (success) if the 
removed specialized code doesn't exist (invalid index).

--
Added file: http://bugs.python.org/file41724/specialize-5.patch

___
Python tracker 

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



[issue26215] remove gc from CPython

2016-01-27 Thread yuriy_levchenko

New submission from yuriy_levchenko:

I permanently use gc.disable() but CPython create object with GC_Head.
it's use big memory.
I suggest add define to a few file that remove use GC_Head and allocate extra 
memory.

--
messages: 259013
nosy: yuriy_levchenko
priority: normal
severity: normal
status: open
title: remove gc from CPython
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



[issue26215] remove gc from CPython

2016-01-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue24841] Some test_ssl network tests fail if svn.python.org is not accessible.

2016-01-27 Thread Martin Panter

Martin Panter added the comment:

The two changes to test_ssl.py look okay to me, although they will need 
updating since the Issue 24841 changeover to pythontest.net.

But I don’t think it is a good idea to add ENOTCONN to the list of errors 
ignored by all transient_internet() tests. In most cases, ENOTCONN suggests a 
programming error, not a network problem. I think a better solution would be to 
call connect_ex() again in test_non_blocking_connect_ex(), and retrieve the 
result (probably also ECONNREFUSED like the other failures, or 0 if successful).

--
nosy: +martin.panter

___
Python tracker 

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



[issue26146] PEP 511: Add ast.Constant to allow AST optimizer to emit constants

2016-01-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16f60cd918e0 by Victor Stinner in branch 'default':
PEP 511
https://hg.python.org/peps/rev/16f60cd918e0

--

___
Python tracker 

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



[issue26107] PEP 511: code.co_lnotab: use signed line number delta to support moving instructions in an optimizer

2016-01-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16f60cd918e0 by Victor Stinner in branch 'default':
PEP 511
https://hg.python.org/peps/rev/16f60cd918e0

--

___
Python tracker 

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



[issue25843] code_richcompare() don't use constant type when comparing code constants

2016-01-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16f60cd918e0 by Victor Stinner in branch 'default':
PEP 511
https://hg.python.org/peps/rev/16f60cd918e0

--

___
Python tracker 

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



[issue26173] test_ssl.bad_cert_test() exception handling

2016-01-27 Thread Martin Panter

Changes by Martin Panter :


--
keywords: +patch
Added file: http://bugs.python.org/file41725/bad-cert-py3.patch

___
Python tracker 

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



[issue25868] test_eintr.test_sigwaitinfo() hangs on "AMD64 FreeBSD CURRENT 3.x" buildbot

2016-01-27 Thread Martin Panter

Martin Panter added the comment:

(Wrote this ages ago but never hit send:)

Here is another theory to explain the hang: When sigwaitinfo() is being called, 
and the SIGALRM signal arrives, it executes the signal handler (both the C 
handler and later the Python handler). If the SIGUSR1 signal arrives while 
either of these signal handlers are executing, it will be missed, and when 
sigwaitinfo() resumes it will hang. This would also be avoided by blocking 
SIGUSR1.

I wonder why the hang only seems to happen with BSD though.

--
components: +Tests
keywords: +buildbot
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



[issue26182] Deprecation warnings for the future async and await keywords

2016-01-27 Thread Anish Shah

Changes by Anish Shah :


--
nosy: +anish.shah

___
Python tracker 

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



[issue25702] Link Time Optimizations support for GCC and CLANG

2016-01-27 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

As Steve mentioned, the Microsoft compiler uses LTO (they call it Link-Time 
Code Generation) and the flags are used when compiling CPython on Windows 
systems. Thus our proposal to enable it on GCC and CLANG also.

--

___
Python tracker 

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



[issue25314] Documentation: argparse's actions store_{true, false} default to False/True (undocumented)

2016-01-27 Thread Julien Baley

Julien Baley added the comment:

This issue has now been open for nearly three months. I think my patch is an 
improvement over the current documentation. If people want to improve the 
documentation further, they can probably submit a patch for that.

What can I do to get this accepted?

--

___
Python tracker 

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



[issue26216] run runtktests.py error when test tkinter

2016-01-27 Thread allensll

New submission from allensll:

When I run the following:
python ...\Python35\Lib\tkinter\test\runtktests.py
Error:
SystemError: Parent module 'tkinter.test' not loaded, cannot perform relative 
import
When I add "import tkinter.test" into runtktests.py,it's working.

--
components: Tkinter
messages: 259021
nosy: allensll
priority: normal
severity: normal
status: open
title: run runtktests.py error when test tkinter
type: behavior
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



[issue1528593] Printing: No print dialog or page setup

2016-01-27 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy:  -gpolo, kbk
versions: +Python 3.5, Python 3.6 -Python 3.2

___
Python tracker 

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



[issue26039] More flexibility in zipfile interface

2016-01-27 Thread Thomas Kluyver

Thomas Kluyver added the comment:

The '2' versions of the two different patches include some docs and tests for 
these new features.

--
Added file: http://bugs.python.org/file41726/zipfile-open-w2.patch

___
Python tracker 

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



[issue19225] lack of PyExc_BufferError doc

2016-01-27 Thread Gedai Tamás Bence

Gedai Tamás Bence added the comment:

Thanks Martin for the review!

I tried to fix the problems, I hope now it'll be good.

Changes:
- fixed uppercase 'B'
- removed VMSError
- moved notes after versionchanged
- added two indices for the different tables
* put BufferError in it's place

I didn't fix the alphabetical order to keep the patch clean. If you find this 
patch good, I'll fix that as well if it's needed.

--
Added file: http://bugs.python.org/file41727/doc_exceptions_v1.patch

___
Python tracker 

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



[issue26217] Fatal error when importing ``test.test_os`` in debug mode on Windows

2016-01-27 Thread Emanuel Barry

New submission from Emanuel Barry:

I compiled CPython from latest trunk on GitHub (revision 
a587bc1eea903dfac94a85324cc6ab39755769a8), compiled with Py_DEBUG and went to 
run the test suite. Here's the (rather long) output:

E:\GitHub\cpython\PCbuild\win32>python_d -m test
== CPython 3.6.0a0 (default, Jan 26 2016, 23:23:12) [MSC v.1900 32 bit (Intel)]
==   Windows-7-6.1.7601-SP1 little-endian
==   hash algorithm: siphash24 32bit
==   E:\GitHub\cpython\build\test_python_464
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0,
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0,
bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[  1/400] test_grammar
[  2/400] test_opcodes
[  3/400] test_dict
[  4/400] test_builtin
[  5/400] test_exceptions
[  6/400] test_types
[  7/400] test_unittest
[  8/400] test_doctest
[  9/400] test_doctest2
[ 10/400] test_support
[ 11/400] test___all__
Assertion failed: compact->wstr_length == 0, file ..\Objects\unicodeobject.c, 
line 427
Fatal Python error: Aborted

Current thread 0x0a88 (most recent call first):
  File "E:\GitHub\cpython\lib\ctypes\util.py", line 64 in find_library
  File "E:\GitHub\cpython\lib\uuid.py", line 473 in 
  File "", line 222 in _call_with_frames_removed
  File "", line 656 in exec_module
  File "", line 673 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "E:\GitHub\cpython\lib\test\test_os.py", line 29 in 
  File "", line 222 in _call_with_frames_removed
  File "", line 656 in exec_module
  File "", line 673 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "", line 1 in 
  File "E:\GitHub\cpython\lib\test\test___all__.py", line 23 in check_all
  File "E:\GitHub\cpython\lib\test\test___all__.py", line 105 in test_all
  File "E:\GitHub\cpython\lib\unittest\case.py", line 600 in run
  File "E:\GitHub\cpython\lib\unittest\case.py", line 648 in __call__
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 122 in run
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 84 in __call__
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 122 in run
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 84 in __call__
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 122 in run
  File "E:\GitHub\cpython\lib\unittest\suite.py", line 84 in __call__
  File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1679 in run
  File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1780 in _run_suite
  File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1814 in 
run_unittest
  File "E:\GitHub\cpython\lib\test\libregrtest\runtest.py", line 161 in 
test_runner
  File "E:\GitHub\cpython\lib\test\libregrtest\runtest.py", line 162 in 
runtest_inner
  File "E:\GitHub\cpython\lib\test\libregrtest\runtest.py", line 126 in runtest
  File "E:\GitHub\cpython\lib\test\libregrtest\main.py", line 295 in 
run_tests_sequential
  File "E:\GitHub\cpython\lib\test\libregrtest\main.py", line 356 in run_tests
  File "E:\GitHub\cpython\lib\test\libregrtest\main.py", line 392 in main
  File "E:\GitHub\cpython\lib\test\libregrtest\main.py", line 433 in main
  File "E:\GitHub\cpython\lib\test\libregrtest\main.py", line 455 in 
main_in_temp_cwd
  File "E:\GitHub\cpython\lib\test\__main__.py", line 3 in 
  File "E:\GitHub\cpython\lib\runpy.py", line 85 in _run_code
  File "E:\GitHub\cpython\lib\runpy.py", line 184 in _run_module_as_main

E:\GitHub\cpython\PCbuild\win32>python_d
Python 3.6.0a0 (default, Jan 26 2016, 23:23:12) [MSC v.1900 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import test.test___all__
>>> import unittest
>>> unittest.main(test.test___all__)

<...>

test.test_openpty
test.test_operator
test.test_optparse
test.test_ordered_dict
test.test_os
Assertion failed: compact->wstr_length == 0, file ..\Objects\unicodeobject.c, 
line 427

E:\GitHub\cpython\PCbuild\win32>python_d
Python 3.6.0a0 (default, Jan 26 2016, 23:23:12) [MSC v.1900 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import test.test_os
Assertion failed: compact->wstr_length == 0, file ..\Objects\unicodeobject.c, 
line 427

Call stack (from importing 'test.test_os'):

ucrtbased.dll!0f7d81f0()Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for 
ucrtbased.dll] 
[External Code] 
>   python36_d.dll!_PyUnicode_CheckConsistency(_object * op, int 
> check_content) Line 427C
python36_d.dll!resize_compact(_object * unicode, int length) Line 920   
C
python36_d.dll!unicode_resize(_object * * p_unicode, int length) Line 
1844  C
python36_d.dll!PyUnicode_Append(_object * * p_left, _object * right) 
Line 11301 C
python36_d.dll!unicode_concatenate(_object * v, _object * w, _frame * 
f, unsigned char * next_ins

[issue26217] Fatal error when importing ``test.test_os`` in debug mode on Windows

2016-01-27 Thread Emanuel Barry

Emanuel Barry added the comment:

This fixed it, thanks!

--
stage:  -> patch review

___
Python tracker 

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



[issue26217] Fatal error when importing ``test.test_os`` in debug mode on Windows

2016-01-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8de6f19afc86 by Victor Stinner in branch '3.5':
Fix resize_compact()
https://hg.python.org/cpython/rev/8de6f19afc86

--
nosy: +python-dev

___
Python tracker 

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



[issue26217] Fatal error when importing ``test.test_os`` in debug mode on Windows

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

Hum, it looks like resize_compact() clears wstr, but don't reset wstr_length to 
0. Attached patch should fix that.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file41728/wstr_len.patch

___
Python tracker 

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



[issue26218] Set PrependPath default to true

2016-01-27 Thread Wallison Resende Santos

New submission from Wallison Resende Santos:

Please, set the PrependPath configuration to true. It's a good option for 
console developers on windows.

--
components: Installation
messages: 259028
nosy: Wallison Resende Santos
priority: normal
severity: normal
status: open
title: Set PrependPath default to true
type: behavior
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



[issue26217] Fatal error when importing ``test.test_os`` in debug mode on Windows

2016-01-27 Thread Emanuel Barry

Changes by Emanuel Barry :


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



[issue26218] Set PrependPath default to true

2016-01-27 Thread Bruno Salvino

Bruno Salvino added the comment:

Please, set the PrependPath configuration to true.

--
nosy: +Bruno Salvino

___
Python tracker 

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



[issue25868] test_eintr.test_sigwaitinfo() hangs on "AMD64 FreeBSD CURRENT 3.x" buildbot

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

> This would also be avoided by blocking SIGUSR1.

Sorry, I'm lost on this old and complex issue. Can you please propose a patch?

If it doesn't break test_eintr on Linux and FreeBSD, we can just push
it and take a look sometimes at FreeBSD buildbots ;-)

--

___
Python tracker 

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



[issue26182] Deprecation warnings for the future async and await keywords

2016-01-27 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue20120] Percent-signs (%) in .pypirc should not be interpolated

2016-01-27 Thread R. David Murray

R. David Murray added the comment:

So fixing distutils to use RawConfigParser?  How likely is that to break 
currently working python3-only code?  I'm imagining from what you wrote that 
your answer is "very close to zero', but I'd like explicit confirmation :)

--

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-01-27 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions:  -Python 3.4

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-01-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Ouch.  Moving the idleConf import was a blunder.  It disabled printing in 
2.7.11, 3.4.4, and 3.5.1.  When I revert, I will also augment the htest to test 
the printing and save-as functions.  Still have to remember to run it though.

This sort of functional test is not the main intended use of htests.  When 
refactoring for this issue, automated tests should be added, with mocks used to 
avoid consequential actions that cannot be part of a buildbot test.  For 
print_window, '''pipe = os.popen(command, "r")''' 
(https://hg.python.org/cpython/file/tip/Lib/idlelib/IOBinding.py#l463) should 
be replaced by '''pipe = runcommand(command)''' and 'def runcommand(command): 
return os.pipe(command, 'r')''' (with subprocess used instead?) added at module 
level.  Then runcommand can be replaced by a mock when testing, and the value 
of the passed command checked.

--
nosy:  -python-dev

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-01-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 34ca24fa1b4a by Terry Jan Reedy in branch '2.7':
Issue #25507: revert incorrect movement of idleConf import in a37ea1d56e98.
https://hg.python.org/cpython/rev/34ca24fa1b4a

New changeset 86105a109830 by Terry Jan Reedy in branch '3.5':
Issue #25507: revert incorrect movement of idleConf import in c548ad75160c.
https://hg.python.org/cpython/rev/86105a109830

--
nosy: +python-dev

___
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-01-27 Thread Yury Selivanov

Changes by Yury Selivanov :


--
assignee: yselivanov
components: Interpreter Core
nosy: yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: implement per-opcode cache in ceval
type: performance
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



[issue26220] Unicode HOWTO references a question mark that isn't in snippet

2016-01-27 Thread Quentin Pradet

New submission from Quentin Pradet:

>From https://docs.python.org/3.6/howto/unicode.html#the-string-type:

> The following examples show the differences::
>
> >>> b'\x80abc'.decode("utf-8", "strict")  #doctest: +NORMALIZE_WHITESPACE
> Traceback (most recent call last):
> ...
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:
>   invalid start byte
> >>> b'\x80abc'.decode("utf-8", "replace")
> '\ufffdabc'
> >>> b'\x80abc'.decode("utf-8", "backslashreplace")
> '\\x80abc'
> >>> b'\x80abc'.decode("utf-8", "ignore")
> 'abc'
>
> (In this code example, the Unicode replacement character has been replaced by
> a question mark because it may not be displayed on some systems.)

I think the whole sentence after the snippet can be removed because this is 
exactly what Python 3.2+ outputs. It looks like the commit which added this 
sentence dates from Python 3.1: 
https://github.com/python/cpython/commit/34d4c82af56ebc1b65514a118f0ec7feeb8e172f,
 but another commit around Python 3.3 removed it: 
https://github.com/python/cpython/commit/63172c46706ae9b2a3bc80d639504a57fff4e716.

--
assignee: docs@python
components: Documentation
messages: 259034
nosy: Quentin.Pradet, docs@python
priority: normal
severity: normal
status: open
title: Unicode HOWTO references a question mark that isn't in snippet
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25675] doc for BaseEventLoop.run_in_executor() says its a coroutine, but it is not

2016-01-27 Thread Ian Kelly

Ian Kelly added the comment:

The asyncio docs also have this note, so this is technically not a bug:

Note: In this documentation, some methods are documented as coroutines, even if 
they are plain Python functions returning a Future. This is intentional to have 
a freedom of tweaking the implementation of these functions in the future. If 
such a function is needed to be used in a callback-style code, wrap its result 
with ensure_future().

Since the intention seems to be to document something that can be awaited 
without specifying the implementation, I think that these functions should be 
documented as returning awaitables. However GvR in python-ideas said:

IMO [the docs] should be very clear about the distinction between functions 
that return Futures and functions that return coroutines (of either kind). I 
think it's fine if they are fuzzy about whether the latter return a PEP 492 
style coroutine (i.e. defined with async def) or a pre-PEP-492 coroutine 
(marked with @asyncio.coroutine), since those are almost entirely 
interchangeable, and the plan is to eventually make everything a PEP 492 
coroutine.

Source: http://thread.gmane.org/gmane.comp.python.ideas/38045/focus=38046

--
nosy: +ikelly

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Ian Kelly

New submission from Ian Kelly:

I was playing around with this class for adapting regular iterators to async 
iterators using BaseEventLoop.run_in_executor:


import asyncio

class AsyncIteratorWrapper:

def __init__(self, iterable, loop=None, executor=None):
self._iterator = iter(iterable)
self._loop = loop or asyncio.get_event_loop()
self._executor = executor

async def __aiter__(self):
return self

async def __anext__(self):
try:
return await self._loop.run_in_executor(
self._executor, next, self._iterator)
except StopIteration:
raise StopAsyncIteration


Unfortunately this fails because when next raises StopIteration, 
run_in_executor swallows the exception and just returns None back to the 
coroutine, resulting in an infinite iterator of Nones.

--
components: asyncio
messages: 259036
nosy: gvanrossum, haypo, ikelly, yselivanov
priority: normal
severity: normal
status: open
title: asynco run_in_executor swallows StopIteration
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



[issue26222] Missing code in linux_distribution python 2.7.11

2016-01-27 Thread Rasmus Rynning Rasmussen

New submission from Rasmus Rynning Rasmussen:

During the transition from python 2.7.10 to 2.7.11 some code seems to have been 
lost. platform.linux_distribution() is not able to recognise Debian based 
distributions in python 2.7.11.

The following code was present in platform.py, python 2.7.10, but seems to be 
missing in 2.7.11

# check for the LSB /etc/lsb-release file first, needed so
# that the distribution doesn't get identified as Debian.
try:
with open("/etc/lsb-release", "rU") as etclsbrel:
for line in etclsbrel:
m = _distributor_id_file_re.search(line)
if m:
_u_distname = m.group(1).strip()
m = _release_file_re.search(line)
if m:
_u_version = m.group(1).strip()
m = _codename_file_re.search(line)
if m:
_u_id = m.group(1).strip()
if _u_distname and _u_version:
return (_u_distname, _u_version, _u_id)
except (EnvironmentError, UnboundLocalError):
pass

--
components: Build
messages: 259037
nosy: Rasmus Rynning Rasmussen
priority: normal
severity: normal
status: open
title: Missing code in linux_distribution python 2.7.11
type: performance
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



[issue10401] Globals / builtins cache

2016-01-27 Thread INADA Naoki

Changes by INADA Naoki :


--
nosy: +naoki

___
Python tracker 

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



[issue26182] Deprecation warnings for the future async and await keywords

2016-01-27 Thread Brett Cannon

Brett Cannon added the comment:

If someone wants to try and fix this, I would look at how the warning for the 
'with' statement was handled (it will either be in the compiler while 
generating bytecode or somewhere in the parser, but I'm fairly certain it's the 
compiler).

--
nosy: +brett.cannon

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-01-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Problem was reported here 
https://stackoverflow.com/questions/35021370/i-cant-print-from-python-idle-in-windows-10

--

___
Python tracker 

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



[issue26215] Make GC_Head a compile-time option

2016-01-27 Thread Brett Cannon

Changes by Brett Cannon :


--
title: remove gc from CPython -> Make GC_Head a compile-time option

___
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-01-27 Thread Brett Cannon

New submission from Brett Cannon:

I assume there's going to be a patch or more of a description of what your idea 
is? :)

--
nosy: +brett.cannon

___
Python tracker 

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



[issue26183] 2.7.11 won't clean install on Windows 10 x64

2016-01-27 Thread Tom Parker

Tom Parker added the comment:

FYI, I ran into this same issue, I believe this was caused by my selecting 
Python tools when installing Visual Studio 2015 Community edition. But I 
removed it and the issued didn't go away.

Then I deleted some empty python registry keys and voila the installer worked.

--
nosy: +tomparker

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Guido van Rossum

Guido van Rossum added the comment:

What are you trying to do here? Can you post a simple example of an iterator 
that you would like to use with this? Without that it just raises my hackles -- 
it seems totally wrong to run an iterator in another thread. (Or is the 
iterator really a coroutine/future?)

--

___
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-01-27 Thread Yury Selivanov

Yury Selivanov added the comment:

Yeah, I needed a URL of the issue for my email to python-dev ;)

Here's a link to the email, that explains a lot about this patch: 
https://mail.python.org/pipermail/python-dev/2016-January/142945.html

The patch is also attached (opcache1.patch).

--
keywords: +patch
Added file: http://bugs.python.org/file41729/opcache1.patch

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy:  -haypo

___
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-01-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The expected behavior should be "insert normally as if the deque were unbounded 
and then pop-off the rightmost element to restore the maxlen invariant".

The applied fix does that for non-negative indices but gives the wrong result 
for negative indicies:

  >>> from collections import deque
  >>> d = deque('abcde', maxlen=5)
  >>> d.insert(-1, 'f')
  >>> list(d)
  ['a', 'b', 'c', 'f', 'd']
  >>> s = list('abcde')
  >>> s.insert(-1, 'f'); del s[-1]
  >>> s
  ['a', 'b', 'c', 'd', 'f']

I think the behavior can be made explainable and also be useful for common 
cases, but there is likely no getting around odd looking results with negative 
index insertions into bounded deques already at their maximum size.

--

___
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-01-27 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy: +haypo, ncoghlan

___
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-01-27 Thread Yury Selivanov

Changes by Yury Selivanov :


--
dependencies: +PEP 509: Add ma_version to PyDictObject

___
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-01-27 Thread Yury Selivanov

Changes by Yury Selivanov :


--
dependencies: +Speedup method calls 1.2x

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Eric V. Smith

Eric V. Smith added the comment:

Agreed. And, since any API change would just be a 3.6+ change, this would 
increase the difficulty of moving between 2.7 and 3.x. Which is not something 
we want.

--

___
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-01-27 Thread Yury Selivanov

Yury Selivanov added the comment:

> If you run hg.python.org/benchmarks on Linux it has a flag to measure memory.

Great.  I'll re-run the benchmarks.  BTW, the latest results are here: 
https://gist.github.com/1st1/aed69d63a2ff4de4c7be

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Serge Stroobandt

Serge Stroobandt added the comment:

@rhettinger
I completely agree with not creating a backward incompatibility at this point 
in time.

The real issue is that decimal.to_eng_string() was written to a (unfortunately 
chosen) proprietary specification which does not entirely correspond to the 
engineering notation.

A quick web search shows that a lot of people are in search of a *true* 
engineering notation implementation. In the phylosophy of "batteries included" 
it is a pity this useful and very common notation is currently missing in 
Python.

I would therefore suggest adding a decimal.to_true_eng_string() with the true 
engineering notation.

Hence, this bug could be reclassified as asuggestion for enhancement.

--

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Ian Kelly

Ian Kelly added the comment:

The idea is that the wrapped iterator is something potentially blocking, like a 
database cursor that doesn't natively support asyncio. Usage would be something 
like this:


async def get_data():
cursor.execute('select * from stuff')
async for row in AsyncIteratorWrapper(cursor):
process(row)


Investigating this further, I think the problem is actually in await, not 
run_in_executor:

>>> async def test():
... fut = asyncio.Future()
... fut.set_exception(StopIteration())
... print(await fut)
... 
>>> loop.run_until_complete(test())
None

--

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Guido van Rossum

Guido van Rossum added the comment:

StopIteration has a special meaning. Don't use set_exception() with it.

You probably need a more roundabout way to do this.

Instead of submitting each __next__() call to the executor separately, you 
should submit something to the executor that pulls the items from the iterator 
and sticks them into a queue; then on the asyncio side you pull them out of the 
queue.

You can use an asyncio.Queue as the queue, and use loop.call_soon_threadsafe() 
to put things into that queue from the tread.

--

___
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-01-27 Thread Tim Peters

Tim Peters added the comment:

I'd raise an exception when trying to insert into a bounded deque that's 
already full.  There's simply no way to guess what was _intended_; it's dead 
easy for the user to implement what they _do_ intend (first make room by 
deleting the specific item they no longer want); and I can't think of a use 
case compelling enough to justify whatever arbitrary non-exceptional behavior 
may be implemented instead.

WRT the behavior you settled on, sure, it's explainable.  That doesn't imply 
it's useful, though ;-)  I'd rather have an exception.  It's plain bizarre that 
after

d.insert(i, x)

one can't even rely on

assert any(y is x for y in d)

succeeding.  Implementing behavior that allows that invariant to fail is 
_really_ user-unfriendly ;-)

In contrast, what .append() and .appendleft() do for a full bounded deque are 
compelling (and don't violate the weak invariant above).

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Serge Stroobandt

New submission from Serge Stroobandt:

In https://docs.python.org/2/library/string.html#formatstrings the proprietary 
(IBM) specifcation "Decimal Arithmetic Specification" 
http://www.gobosoft.com/eiffel/gobo/math/decimal/daconvs.html is incorrectly 
being heralded as "the" specifiaction for engineering notation.

However, upon reading this IBM specifation carefully, one will note that the 
specifaction itself actually admits not applying the engineering notation in 
the case of infinite numbers.

An emphasized version of the exact quote accompanied with a discussion can be 
found here: http://stackoverflow.com/a/17974598/2192488

Correct behaviour for decimal.to_eng_string() would be to equally employ 
engineering notation in the case of infinite numbers.

I suggest renaming the current behaviour to decimal.to_ibm_string().

References:
http://www.augustatech.edu/math/molik/notation.pdf
https://en.wikipedia.org/wiki/Engineering_notation
https://en.wikipedia.org/wiki/General_Conference_on_Weights_and_Measures
http://www.bipm.org/en/CGPM/db/11/11/

PS: I am a MSc in Electronic Engineering.

--
components: Extension Modules
files: engineering_notation.pdf
messages: 259047
nosy: Keith.Brafford, eric.smith, ezio.melotti, serge.stroobandt
priority: normal
severity: normal
status: open
title: decimal.to_eng_string() does not implement engineering notation in all 
cases.
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file41730/engineering_notation.pdf

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-27 Thread David Heffernan

David Heffernan added the comment:

Thanks for following up Steve, and thanks for changing resolution to dupe. 

As for 3.5 and embedding the docs are much the same as 2.7 in that the example 
code at https://docs.python.org/3/extending/embedding.html doesn't explicitly 
set Python home. 

Anyway, I'm very happy with how this report has been dealt with. Thank you all.

--

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Ian Kelly

Ian Kelly added the comment:

Fair enough. I think there should be some documentation though to the effect 
that coroutines aren't robust to passing StopIteration across coroutine 
boundaries. It's particularly surprising with PEP-492 coroutines, since those 
aren't even iterators and intuitively should ignore StopIteration like normal 
functions do.

As it happens, this variation (moving the try-except into the executor thread) 
does turn out to work but is probably best avoided for the same reason. I don't 
think it's obviously bad code though:


class AsyncIteratorWrapper:

def __init__(self, iterable, loop=None, executor=None):
self._iterator = iter(iterable)
self._loop = loop or asyncio.get_event_loop()
self._executor = executor

async def __aiter__(self):
return self

async def __anext__(self):
def _next(iterator):
try:
return next(iterator)
except StopIteration:
raise StopAsyncIteration
return await self._loop.run_in_executor(
self._executor, _next, self._iterator)

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread SilentGhost

Changes by SilentGhost :


--
versions: +Python 3.6 -Python 2.7

___
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-01-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What if implement the bahavior described by Raymond for index -len(d) <= i < 
len(d), but raise an exception if the index is out of this range?

The result of deque('abc', maxlen=3).insert(i, 'X') would be:

-4: error
-3: ['X', 'a', 'b']
-2: ['a', 'X', 'b']
-1: ['a', 'b', 'X']
 0: ['X', 'a', 'b']
 1: ['a', 'X', 'b']
 2: ['a', 'b', 'X']
 3: error

--

___
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-01-27 Thread Yury Selivanov

Yury Selivanov added the comment:

BTW, there are a couple of unit-tests that fail.  Both can be easily fixed.

To really move this thing forward, we need to profile the memory usage.  First, 
it would be interesting to see how much additional memory is consumed if we 
optimize every code object.  That will give us an idea of the overhead, and if 
it is significant, we can experiment with various heuristics to minimize it.

--

___
Python tracker 

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



[issue26183] 2.7.11 won't clean install on Windows 10 x64

2016-01-27 Thread Tom Parker

Tom Parker added the comment:

Ah OK :) I had done a W10 reset to wipe my PC before reinstalling VS so I 
could't imagine where else the python registry keys could have come from.

My install sequence was:

SQL Server 2012 Developer
Visual Studio 2015 Community Edition
Office 365
Inkscape - maybe??
Then Python 2.7.11

--

___
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-01-27 Thread Brett Cannon

Brett Cannon added the comment:

If you run hg.python.org/benchmarks on Linux it has a flag to measure memory.

--

___
Python tracker 

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



[issue26215] Make GC_Head a compile-time option

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

Could you please try to elaborate a little bit the issue?

> I permanently use gc.disable() but CPython create object with GC_Head.
it's use big memory.

You propose to remove GC_Head for everywhere? Or do you want a configure option?

What do you mean by "big memory"? Do you have an estimation of the "overhead" 
on an application?

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Serge Stroobandt

Serge Stroobandt added the comment:

An emphasized version of the exact quote is here now:
http://stackoverflow.com/a/35045233/2192488

--

___
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-01-27 Thread Tim Peters

Tim Peters added the comment:

My opinion doesn't change:  I'd rather see an exception.  I see no use case for 
inserting "into the middle" of a full bounded queue.  If I had one, it would 
remain trivial to force the specific behavior I intended.

--

___
Python tracker 

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



[issue26221] asynco run_in_executor swallows StopIteration

2016-01-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Can you suggest a sentence to insert into the docs and a place where
to insert it? (As you can imagine I'm pretty blind for such issues
myself.)

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The decimal module strives to exactly follow the spec even when our 
sensibilities suggest otherwise. Perhaps, we can add a note to the current docs 
describing the situation.  The API itself is a settled issue, that ship sailed 
a very long time ago (the problem with a standard library is that it becomes 
standard that people rely on and is hard to change after the fact without 
causing issues for users).

--
assignee:  -> rhettinger
nosy: +facundobatista, mark.dickinson, rhettinger, skrah, tim.peters

___
Python tracker 

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



[issue26224] Add "version added" for documentation of asyncio.timeout for documentation of python 3.4, 3.5, 3.6

2016-01-27 Thread Udi Oron

New submission from Udi Oron:

It seems like `asyncio.timeout` is going to be added in 3.4.5, 3.5.2 and 3.6.

The current live documentation of python 3.4 and python 3.5.1 does not include 
a comment regarding it is not yet available in the current released versions of 
python.

The documentation should include a `.. versionadded:: 3.4.5`, `.. 
versionadded:: 3.5.2` or `.. versionadded:: 3.6` according to the branch.

--
assignee: docs@python
components: Documentation, asyncio
files: asyncio-timeout.patch
keywords: patch
messages: 259071
nosy: Udi Oron, docs@python, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Add "version added" for documentation of asyncio.timeout for 
documentation of python 3.4, 3.5, 3.6
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41731/asyncio-timeout.patch

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-01-27 Thread Stefan Krah

Stefan Krah added the comment:

The spec was the only reasonable choice at the time decimal.py was
written.  Incidentally, it is basically IEEE-754-2008 with arbitrary
precision extensions; this isn't surprising since Mike Cowlishaw was
on the IEEE committee and wrote the spec at the same time.

There are very few decNumber-specific remainders in the spec -- this
may be one of those (though I did not bother to look up if the IEEE
standard specifies formatting at all).

--

___
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-01-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

My only aversion to raising an exception is that it goes against the original 
intent of maxlen as giving an automatic-pop-to-make-room behavior.

Rather that introduce a discontinuity, I like the "smoothness" of letting 
d.insert(len(d), obj) follow the insert-normally-then-pop-from-the-right rule 
as opposed to having a special case.

--

___
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-01-27 Thread Josh Rosenberg

Josh Rosenberg added the comment:

I agree with Tim that arbitrarily deciding that insert should behave more like 
appendleft is surprising. This really feels like guessing at what the user 
wants, silently doing something that really isn't predictable.

Any of the following seem nicer (not exactly arguing for any but #1):

1. Raising an exception for full deque
2. Making insert pop left when full (and possibly make insertleft that will pop 
right; the name isn't perfect, but it would make the symmetry between "no 
suffix pops left and 'left' suffix pops right" line up with other deque methods)
3. Adding an optional argument to say which end should be popped (defaulting to 
"raise an exception", probably no good though, since it would break Sequence 
rules.

--
nosy: +josh.r

___
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-01-27 Thread STINNER Victor

STINNER Victor added the comment:

If I understand correctly, this change requires to wait until the PEP 509 is 
accepted, right? Well, I'm not really suprised, since global cache is mentioned 
as an use case of the PEP 509, and other global cache patches are mentioned in 
Prior Art.

--

___
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-01-27 Thread Yury Selivanov

Yury Selivanov added the comment:

Yes, this patch depends on PEP 509.

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-27 Thread Steve Dower

Steve Dower added the comment:

That's true, though if you use the embeddable distribution of Python 3.5 you 
automatically get the equivalent behavior because of a new option (the 
"applocal" option in pyvenv.cfg, which is enabled in that distro by default).

--

___
Python tracker 

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



[issue26183] 2.7.11 won't clean install on Windows 10 x64

2016-01-27 Thread Steve Dower

Steve Dower added the comment:

VS 2015 won't cause this (I also work on that product as my day job, so I know 
exactly what it does and doesn't do), but the registry corruption probably did.

The pip support that's in the 2.7 installer is not the most robust code, and it 
can easily run into issues when your install is broken that make it fail. 
Repairing your prior install before uninstalling it is the easiest way to fix 
this in practically every case.

--

___
Python tracker 

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



[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Andrew Barnert

New submission from Andrew Barnert:

In #24129, the wording describing class local bindings in 4.2.2 "Resolution of 
names" was changed for Python 3.4, 3.5, and 3.6. The new version is a lot 
clearer for classes--but now it's misleading for `exec`/`eval`.

---

> Class definition blocks and arguments to exec() and eval() are
> special in the context of name resolution. A class definition is...

... and then proceeds to explain how class lookup works, without ever 
mentioning `exec` and `eval`. This implies that they work the same way as 
classes, but of course that's not true:

i = 'global'
def f():
i = 'nonlocal'
class C:
print(i)
i = 'local'
print(i)
f()

That prints `global`, then `local`. But with `exec`:

i = 'global'
def f():
i = 'nonlocal'
exec("print(i)\ni = 'local'\nprint(i)\n")
f()

That prints `nonlocal` then `local`.

I think just putting a paragraph break between the first sentence and the rest 
of the paragraph might be sufficient to avoid the confusion here. Or just 
removing any mention of `eval` and `exec`. If not, this probably needs a new 
one-liner paragraph saying something like "Arguments to `exec()` and `eval()` 
are also special, as described later."

---

Meanwhile, if you keep reading, you'll eventually find that `exec` is described 
in a later section, 4.2.4 "Interaction with dynamic features", but that's 
_also_ misleading:

> The eval() and exec() functions do not have access to the full
> environment for resolving names. Names may be resolved in the
> local and global namespaces of the caller. Free variables are not
> resolved in the nearest enclosing namespace, but in the global
> namespace.

If that were true, the `exec` example would have printed `global`, right?

I'm pretty sure that what's going on here is that `exec` implicitly calls 
`locals()` (or, rather, the C-API equivalent), which constructs a locals dict 
on demand, which, only if you're inside a function block, includes not just the 
currently-bound fast locals, but _also_ the cell_contents of the 
currently-bound free variables. So, as far as `exec` is concerned, `i` is not 
an unbound local, or a free variable, but a local, which is bound to the 
`'nonlocal'` cell value of `i` at the time `exec` was called.

Which means the following actually _does_ print `global`:

i = 'global'
def f():
exec("print(i)\ni = 'local'\nprint(i)\n")
i = 'nonlocal'
f()

I have no idea how to make this clear. Maybe the simplest is to not try to give 
a full explanation here, and instead punt to the `locals()` function 
definition? Maybe something like this:

> The `eval()` and `exec()` functions do not have access to the full 
> environment for resolving names, but rather to the approximation of that 
> environment as constructed by the `locals()` function. Free variables that 
> are not captured as locals are not resolved in the nearest enclosing 
> namespace, but in the global...

... and from there, the same as the current paragraph.

--
assignee: docs@python
components: Documentation
messages: 259073
nosy: abarnert, docs@python
priority: normal
severity: normal
status: open
title: New misleading wording in execution model documenation

___
Python tracker 

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



[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Andrew Barnert

Changes by Andrew Barnert :


--
type:  -> enhancement

___
Python tracker 

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



[issue26098] PEP 510: Specialize functions with guards

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

FIXME: sys.getsizecode(func) doesn't include specialized code and guards.

--

___
Python tracker 

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



[issue26226] Various test suite failures on Windows

2016-01-27 Thread Emanuel Barry

Changes by Emanuel Barry :


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



[issue26226] Various test suite failures on Windows

2016-01-27 Thread STINNER Victor

STINNER Victor added the comment:

For the test_httpservers failure, can you please try the following commands on 
your PC?

>>> socket.gethostname()
'selma'
>>> socket.gethostbyaddr(socket.gethostname())
('selma', [], ['2a01:e34:ec8d:4c70:3ea9:f4ff:fe65:c0c', 
'fe80::3ea9:f4ff:fe65:c0c'])

--
nosy: +haypo

___
Python tracker 

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



[issue26227] Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname

2016-01-27 Thread STINNER Victor

New submission from STINNER Victor:

On Windows, socket.gethostbyaddr() must decode the hostname from the ANSI code 
page, not from UTF-8. See for example this issue:
https://bugs.python.org/issue26226#msg259077

Attached patch changes the socket module to decode hostnames from the ANSI code 
page on Windows.

See also issues #9377, #16652 and #5004.

--
components: Unicode, Windows
messages: 259078
nosy: ebarry, ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname
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



[issue26227] Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname

2016-01-27 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
Added file: http://bugs.python.org/file41734/gethostbyaddr_encoding.patch

___
Python tracker 

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



[issue17394] Add slicing support to collections.deque

2016-01-27 Thread Josh Rosenberg

Josh Rosenberg added the comment:

It seems odd to have a slice of a deque return a list. Are there any other 
examples of non-buffer protocol objects behaving like this in the standard 
library/built-ins? Only examples I can come up with are mmap objects and ctypes 
arrays (which are making raw binary data available in Python); it seems rather 
surprising that a Python level type like deque would slice to produce a list.

--
nosy: +josh.r

___
Python tracker 

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



  1   2   >