[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

2016-01-19 Thread Michael Foord

Michael Foord added the comment:

In inspect checking that __code__ is a code object, or that co_flags is an int, 
would be better than special casing mock. 

However, the patch to mock looks reasonable to me. It copies the whole code 
object from the original function to the mock object. The patch needs a test 
(I'd like to see a test for the Mock(func) case and the create_autospec(func) 
case.)

--

___
Python tracker 

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



[issue16620] Avoid using private function glob.glob1() in msi module and tools

2016-01-19 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue1927] raw_input behavior incorrect if readline not enabled

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unix shell builtin command "read" outputs prompt to stderr. In bash that uses 
readline and in dash that doesn't use readline. Looks as this is standard 
behavior.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26013] Pickle protocol 2.0 not loading in python 3.5

2016-01-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker 

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



[issue1927] raw_input behavior incorrect if readline not enabled

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

The way I see it, input() is mainly geared for prompting to stdout, and it is 
just one aspect that strangely uses stderr:

* Documentation says stdout
* Stdout is checked if it is a terminal and not redirected
* Gnu Readline is configured for stdout
* The fallback for non-terminals uses stdout

Arguments for using stderr:

* Consistency with Unix shell
* Consistency with the Python interactive interpreter prompt

Maybe it is more ideal to use stderr (I have no idea). But I think that would 
be a more drastic change.

--

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 2:

* allow "-" character in the argument of the -o command line option
* add an unit test on invalid type for code transformer
* fix a crash in sys.set_code_transformers(): replace Py_DECREF() with 
Py_XDECREF()

--
Added file: http://bugs.python.org/file41655/transformers-2.patch

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 2:

* allow "-" character in the argument of the -o command line option
* add an unit test on invalid type for code transformer
* fix a crash in sys.set_code_transformers(): replace Py_DECREF() with 
Py_XDECREF()

--
Added file: http://bugs.python.org/file41656/transformers-2.patch

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


--
Removed message: http://bugs.python.org/msg258579

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file41655/transformers-2.patch

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

(oops, i posted the same message with patch twice)

--

___
Python tracker 

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



[issue26150] SequenceMatcher's algorithm is not correct

2016-01-19 Thread Владислав Александрович

New submission from Владислав Александрович:

For strings 'aa', 'aabaaa' SequenceMatcher's algorithm finds only common 
substring 'aaa', while well-known classic LCS algorithm: 
http://www.geeksforgeeks.org/printing-longest-common-subsequence/ finds 'aa' 
and 'aaa'.

Is it the price for "best case time is linear", as mentioned in difflib's 
documentation? Are there any other reasons not to implement classic LCS 
algorith (e.g. memory limits?)? If no, maybe it will be usefull to create 
subclass StrictSequenceMatcher?

--
messages: 258582
nosy: Владислав Александрович
priority: normal
severity: normal
status: open
title: SequenceMatcher's algorithm is not correct
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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Johnny Wezel

New submission from Johnny Wezel:

str(b'xxx') returns "b'xxx'" instead of 'xxx'

--
components: Interpreter Core, Unicode
messages: 258583
nosy: ezio.melotti, haypo, jwezel
priority: normal
severity: normal
status: open
title: str(bytes) does __repr__() instead of __str__()
type: behavior
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



[issue26152] A non-breaking space in a source

2016-01-19 Thread Adam Bartoš

New submission from Adam Bartoš:

Consider the following code:
>>> 1, 2
  File "", line 1
1, 2
   ^
SyntaxError: invalid character in identifier

The error is due to the fact, that the space before "2" is actually a 
non-breaking space. The error message and the position of the caret is 
misleading.

The tokenize module gives an ERRORTOKEN at the position of the space, so 
shouldn't the massage be more like "invalid syntax" with the correct position 
or even something more appropriate?

--
components: Interpreter Core, Unicode
messages: 258584
nosy: Drekin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: A non-breaking space in a source
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



[issue16620] Avoid using private function glob.glob1() in msi module and tools

2016-01-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 652a50208e89 by Serhiy Storchaka in branch '3.5':
Issue #16620: Fixed AttributeError in msilib.Directory.glob().
https://hg.python.org/cpython/rev/652a50208e89

New changeset 158ae15f5809 by Serhiy Storchaka in branch '2.7':
Issue #16620: Fixed AttributeError in msilib.Directory.glob().
https://hg.python.org/cpython/rev/158ae15f5809

New changeset 84a50f14a266 by Serhiy Storchaka in branch 'default':
Issue #16620: Fixed AttributeError in msilib.Directory.glob().
https://hg.python.org/cpython/rev/84a50f14a266

New changeset f2586c381b0b by Serhiy Storchaka in branch 'default':
Issue #16620: Got rid of using undocumented function glob.glob1().
https://hg.python.org/cpython/rev/f2586c381b0b

--
nosy: +python-dev

___
Python tracker 

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



[issue16620] Avoid using private function glob.glob1() in msi module and tools

2016-01-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread Min RK

Changes by Min RK :


Added file: http://bugs.python.org/file41657/a.py

___
Python tracker 

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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread Min RK

New submission from Min RK:

PyImport_GetModuleDict: no module dictionary! can be raised during interpreter 
shutdown if a `__del__` method results in a warning. This only happens on 
Python 3.5.

The prompting case is IPython 4.0.2 and traitlets 4.1.0. An IPython 
ExtensionManager calls `self.shell.on_trait_change` during its `__del__` to 
unregister a listener. That `on_trait_change` method is deprecated, and tries 
to display a DeprecationWarning. The call to `warnings.warn results in:

Fatal Python error: PyImport_GetModuleDict: no module dictionary!

There appear to be races involved, because the crash happens with inconsistent 
frequency, sometimes quite rarely.

I've tried to put together a simple minimal test case, but I cannot reproduce 
the crash outside of IPython. I can, however, reproduce inconsistent behavior 
where a UserWarning displayed during `__del__` sometimes fails with

ImportError: import of 'linecache' halted; None in sys.modules

and sometimes the exact same code succeeds, showing the error:

~/dev/tmp/del-warn/a.py:9: DeprecationWarning: I don't cleanup anymore
  self.b.cleanup()

and sometimes it shows the warning but not the frame

~/dev/tmp/del-warn/a.py:9: DeprecationWarning: I don't cleanup anymore

--
components: Interpreter Core
messages: 258586
nosy: minrk
priority: normal
severity: normal
status: open
title: PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a 
warning
type: crash
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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread Min RK

Changes by Min RK :


Added file: http://bugs.python.org/file41659/main.py

___
Python tracker 

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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread Min RK

Changes by Min RK :


Added file: http://bugs.python.org/file41658/b.py

___
Python tracker 

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



[issue26154] Add private _PyThreadState_FastGet() to get the current thread state

2016-01-19 Thread STINNER Victor

New submission from STINNER Victor:

The issue #25150 modified pystate.h to hide _PyThreadState_Current. Sadly, this 
change broke the vmprof project:
https://mail.python.org/pipermail/python-dev/2016-January/142767.html

Attached patches adds a new private _PyThreadState_FastGet() function to get 
the current thread state but don't call Py_FatalError() if it is NULL.

The patch also uses replace direct access to _PyThreadState_Current with 
_PyThreadState_FastGet(), except inside ceval.c and pystate.c.

Calling Py_FatalError() to handle errors is not really a great API... Bad 
that's a different story, I don't want to break anything here.

I want to add the private function to Python 3.5.2 because I consider that the 
removal of the _PyThreadState_Current symbol is a regression introduced in 
Python 3.5.1.

We have no rule for the Python private API, it can change *anytime*.

--
files: pythreadstate_fastget.patch
keywords: patch
messages: 258587
nosy: haypo, larry
priority: normal
severity: normal
status: open
title: Add private _PyThreadState_FastGet() to get the current thread state
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41660/pythreadstate_fastget.patch

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

Yes. It's a feature, not a bug. You muse decode manually bytes to get type: 
b'xxx'.decode('ascii') or str(b'xxx'.decode('ascii')).

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

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Johnny Wezel

Johnny Wezel added the comment:

Bad feature, as it is a violation of POLA.

--

___
Python tracker 

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



[issue25935] OrderedDict prevents garbage collection if a circulary referenced class is used as key

2016-01-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 627575e9a7aa by Serhiy Storchaka in branch '3.5':
Issue #25935: Garbage collector now breaks reference loops with OrderedDict.
https://hg.python.org/cpython/rev/627575e9a7aa

New changeset 5f0a08cfc4f6 by Serhiy Storchaka in branch 'default':
Issue #25935: Garbage collector now breaks reference loops with OrderedDict.
https://hg.python.org/cpython/rev/5f0a08cfc4f6

--
nosy: +python-dev

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

STINNER Victor added the comment:

Patch version 3:

* guards are now tracked by the garbage collector. That's a very important 
requirements to not change the Python semantics at exit, when a guard keeps a 
strong reference to the global namespace:

https://mail.python.org/pipermail/python-dev/2016-January/142792.html

* add more tests: call specialize() with invalid types, set __code__

--
Added file: http://bugs.python.org/file41661/specialize-3.patch

___
Python tracker 

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



[issue26148] String literals are not interned if in a tuple

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


--
type:  -> performance

___
Python tracker 

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



[issue26148] String literals are not interned if in a tuple

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue25935] OrderedDict prevents garbage collection if a circulary referenced class is used as key

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In some cases (as in committed test) garbage collector was not able to collect 
a loop with OrderedDict at all.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue26150] SequenceMatcher's algorithm is not correct

2016-01-19 Thread SilentGhost

Changes by SilentGhost :


--
components: +Library (Lib)
nosy: +rhettinger
stage:  -> test needed

___
Python tracker 

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



[issue25949] Lazy creation of __dict__ in OrderedDict

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch have no visible effect, except lesser memory consumption. The latter 
is hard to measure in tests. Additional tests just ensure that the patch 
doesn't break existing behavior.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue26148] String literals are not interned if in a tuple

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

FYI fatoptimizer has a more efficient algorithm to merge constants:
http://fatoptimizer.readthedocs.org/en/latest/optimizations.html#comparison-with-the-peephole-optimizer

It looks like it interns strings which are part of tuples. To be honest, I 
don't understand how it works, but it works :-)

--

___
Python tracker 

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



[issue26133] asyncio: ugly error related signal handler at exit if the loop is not closed explicitly

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


--
title: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a 
callable object in > -> asyncio: 
ugly error related signal handler at exit if the loop is not closed explicitly

___
Python tracker 

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



[issue26133] asyncio: ugly error related to signal handlers at exit if the loop is not closed explicitly

2016-01-19 Thread STINNER Victor

Changes by STINNER Victor :


--
title: asyncio: ugly error related signal handler at exit if the loop is not 
closed explicitly -> asyncio: ugly error related to signal handlers at exit if 
the loop is not closed explicitly

___
Python tracker 

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



[issue26155] 3.5.1 installer issue on Win 7 32 bit

2016-01-19 Thread TarotRedhand

New submission from TarotRedhand:

This is not in the Python Core but in the installer for version 3.5.1 on 
windows 32 bit. It occurs with the custom install option. I gave a verified new 
location for python to be installed to but it installed in MyDocuments anyway.

--
components: Installation
messages: 258595
nosy: TarotRedhand
priority: normal
severity: normal
status: open
title: 3.5.1 installer issue on Win 7 32 bit
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



[issue26155] 3.5.1 installer issue on Win 7 32 bit

2016-01-19 Thread SilentGhost

Changes by SilentGhost :


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



[issue26156] Bad name into power operator syntax

2016-01-19 Thread Chema Cortés

New submission from Chema Cortés:

The documentation erroneously changes "primary" for "away" in the power 
operator syntax:

https://docs.python.org/3.6/reference/expressions.html#the-power-operator
https://docs.python.org/3.5/reference/expressions.html#the-power-operator

--
assignee: docs@python
components: Documentation
messages: 258596
nosy: Chema Cortés, docs@python
priority: normal
severity: normal
status: open
title: Bad name into power operator syntax
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



[issue26156] Bad name into power operator syntax

2016-01-19 Thread Yury Selivanov

Yury Selivanov added the comment:

The docs are correct. See the definition of the "await" expression: 
https://docs.python.org/3.6/reference/expressions.html#await-expression

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



[issue26154] Add private _PyThreadState_FastGet() to get the current thread state

2016-01-19 Thread Nathaniel Smith

Nathaniel Smith added the comment:

Name should be _PyThreadState_UncheckedGet

--
nosy: +njs

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Frank Millman

New submission from Frank Millman:

18.5.1.15. Server

close()

"The sockets that represent existing incoming client connections are leaved 
open."

I think this should say 'are left open'.

--
assignee: docs@python
components: Documentation
messages: 258599
nosy: docs@python, frankmillman
priority: normal
severity: normal
status: open
title: Typo in asyncio documentation
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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

New submission from Fornax:

io.IOBase.truncate() documentation says:
"Resize the stream to the given size in bytes (or the current position if size 
is not specified). The current stream position isn’t changed. This resizing can 
extend or reduce the current file size. In case of extension, the contents of 
the new file area depend on the platform (on most systems, additional bytes are 
zero-filled). The new file size is returned."

However:
>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.readline()
'ABCDE\n'
>>> f.tell()
6   # As expected, current position is 6 after the readline
>>> f.truncate()
32  # ?!

Verified that the document does not get truncated to 6 bytes as expected. 
Adding an explicit f.seek(6) before the truncate causes it to work properly 
(truncate to 6). It also works as expected using a StringIO rather than a file, 
or in Python 2 (used 2.7.9).

Tested in 3.4.3/Windows, 3.4.1/Linux, 3.5.1/Linux.

--
components: IO
messages: 258600
nosy: fornax
priority: normal
severity: normal
status: open
title: File truncate() not defaulting to current position as documented
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue5626] misleading comment in socket.gethostname() documentation

2016-01-19 Thread Berker Peksag

Berker Peksag added the comment:

I agree with Chris and Ned. I will apply issue5626_v1.diff today.

--
stage:  -> commit review
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 2.6, Python 3.0, Python 3.1

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Carlo Beccarini

Carlo Beccarini added the comment:

Absolutely.

--
nosy: +Paradisee

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Eryk Sun

Eryk Sun added the comment:

> Bad feature, as it is a violation of POLA.

I would be astonished if the default __str__ conversion returned a Latin-1 
decoding, which won't fail, or used the locale encoding or UTF-8, which could 
fail. The more explicit call x.decode() uses UTF-8 as the default encoding.

--
nosy: +eryksun

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Johnny Wezel

Johnny Wezel added the comment:

Who's talking about latin-1 in Python3? Of course str() needs to return 
decode('utf-8').

--

___
Python tracker 

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



[issue26144] test_pkg test_4 and/or test_7 sometimes fail

2016-01-19 Thread Rose Ames

Rose Ames added the comment:

Reproduced.  In four runs, one errored in test_4, one failed in test_7, and the 
other two did both.

--
nosy: +superluser

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Carlo Beccarini

Changes by Carlo Beccarini :


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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Walter Dörwald

Walter Dörwald added the comment:

> Who's talking about latin-1 in Python3? Of course str() needs to return 
> decode('utf-8').

So that would mean that:

   print(b"\xff")

will always fail!

--
nosy: +doerwalter

___
Python tracker 

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



[issue26159] Unsafe to BaseEventLoop.set_debug(False) when PYTHONASYNCIODEBUG=1

2016-01-19 Thread Bradley McLean

New submission from Bradley McLean:

Leads to spurious RuntimeWarning: coroutine  was never awaited messages, when 
@asyncio.coroutine methods call async def methods.  Likely because decorators 
ran before set_debug set False, and are assuming it won't change.

--
components: asyncio
messages: 258607
nosy: Bradley McLean, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Unsafe to BaseEventLoop.set_debug(False) when PYTHONASYNCIODEBUG=1
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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Johnny Wezel

Johnny Wezel added the comment:

The other question is why one would want to run such a statement. This is 
almost certainly a bug in which case an error one would be better off with an 
exception.

--

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Carlo Beccarini

Changes by Carlo Beccarini :


--
keywords: +patch
Added file: http://bugs.python.org/file41662/patch.diff

___
Python tracker 

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



[issue26144] test_pkg test_4 and/or test_7 sometimes fail

2016-01-19 Thread Rose Ames

Rose Ames added the comment:

redirecting stdout seems to reliably suppress both failures:

$ ./python -m test -w test_pkg >foo
$ cat foo
[1/1] test_pkg
1 test OK.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Stephen Paul Chappell

Changes by Stephen Paul Chappell :


--
nosy: +Zero

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Walter Dörwald

Walter Dörwald added the comment:

But this leads to uninspectable objects.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is because the file is buffered.

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.readline()
'ABCDE\n'
>>> f.tell()
6
>>> f.buffer.tell()
32
>>> f.buffer.raw.tell()
32

The documentation needs a clarification.

--
assignee:  -> docs@python
components: +Documentation
nosy: +benjamin.peterson, docs@python, haypo, pitrou, serhiy.storchaka, 
steve.dower, stutzbach
versions: +Python 2.7, 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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

Fornax added the comment:

To clarify... the intended behavior is for truncate to default to the current 
position of the buffer, rather than the current position as reported directly 
from the stream by tell?

That seems... surprising.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Eryk Sun

Eryk Sun added the comment:

Serhiy, why doesn't truncate do a seek(0, SEEK_CUR) to synchronize the buffer's 
file pointer before calling its truncate method? This also affects writing in 
"+" modes when the two file pointers are out of sync.

--
nosy: +eryksun

___
Python tracker 

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



[issue24324] Remove -Wunreachable-code flag

2016-01-19 Thread Jake Garver

Changes by Jake Garver :


Added file: http://bugs.python.org/file41663/Python351-no-unreachable-check.diff

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is not always possible. Consider following example:

>>> open('temp.txt', 'wb').write(b'+BDAEMQQyBDMENA-')
16
>>> f = open('temp.txt', 'r+', encoding='utf-7')
>>> f.read(2)
'аб'

What should be the result of truncating?

I think it would be better to not implement truncate() for text files at all.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

Fornax added the comment:

Heh... building on Serhiy's example:

>>> f.tell()
680564735109527527154978616360239628288

I'm way out of my depth here. The results seem surprising, but I lack the 
experience to be able to say what they "should" look like. So I guess if it's 
working as intended and just needs clarification in the documentation, so be it.

Thanks for pointing out what's actually causing the behavior.

--

___
Python tracker 

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



[issue26152] A non-breaking space in a source

2016-01-19 Thread Andrew Barnert

Andrew Barnert added the comment:

Ultimately, this is because the tokenizer works byte by byte instead of 
character by character, as far as possible. Since any byte >= 128 must be part 
of some non-ASCII character, and the only legal use for non-ASCII characters 
outside of quotes and comments is as part of an identifier, the tokenizer 
assumes (see the macros at the top of tokenizer.c, and the top of the again 
block in tok_get) that any byte >= 128 is part of an identifier, and then 
checks the whole string with PyUnicode_IsIdentifier at the end.

This actually gives a better error for more visible glyphs, especially ones 
that look letter-like but aren't in XID_Continue, but it is kind of weird for a 
few, like non-break space.

If this needs to be fixed, I think the simplest thing is to special-case 
things: if the first non-valid-identifier character is in category Z, set an 
error about invalid whitespace instead of invalid identifier character. (This 
would probably require adding a PyUnicode_CheckIdentifier that, instead of just 
returning 0 for failure as PyUnicode_IsIdentifier, returns -n for 
non-identifier character with code point n.)

--
nosy: +abarnert

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

Fornax added the comment:

After taking a little time to let this sink in, I'm going to play Devil's 
Advocate just a little more.

It sounds like you're basically saying that any read-write text-based modes 
(e.g. r+, w+) should be used at your own peril. While I understand your UTF-7 
counterexample, and it's a fair point, is it out of line to expect that for 
encodings that operate on full bytes, file positioning should work a bit more 
intuitively? (Which is to say, a write/truncate after a read should take place 
in the position immediately following the end of the read.)

--

___
Python tracker 

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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2016-01-19 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
nosy: +mbussonn

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

Fornax added the comment:

Another surprising result:

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.write('test')
4
>>> f.close()
>>> open('temp.txt').read()
'testE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n'

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.write('test')
4
>>> f.read(1)
'A'
>>> f.close()
>>> open('temp.txt').read()
'ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\ntest'

The position of the write in the file depends on whether or not there is a 
subsequent read.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be. Looking at the code, both Python and C implementations of TextIOWrapper 
look incorrect.

Python implementation:

def truncate(self, pos=None):
self.flush()
if pos is None:
pos = self.tell()
return self.buffer.truncate(pos)

If pos is not specified, self.tell() is used as truncating position for 
underlying binary file. But self.tell() is not an offset in bytes, as seen from 
UTF-7 example. This is complex cookie that includes starting position in binary 
file, a number of bytes that should be read and feed to the decoder, and other 
decoder flags. Needed at least unpack the cookie returned by self.tell(), and 
raise an exception if it doesn't ambiguously point to binary file position.

C implementation is equivalent to:

def truncate(self, pos=None):
self.flush()
return self.buffer.truncate(pos)

It just ignores decoder buffer.

--
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

A warning is already emitted if you enable it with the “-b” flag, which I 
recommend. You can even turn the warning into an error with “-bb”. And you can 
always use repr() or ascii() to inspect for a more robust inspection.

$ python3 -bb
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print(b"\xFF")
Traceback (most recent call last):
  File "", line 1, in 
BytesWarning: str() on a bytes instance
>>> print(repr(b"\xFF"))
b'\xff'

--
nosy: +martin.panter

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 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



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

2016-01-19 Thread STINNER Victor

STINNER Victor added the comment:

First I also wanted to add ast.Literal to literals: list, set, dict, etc. But 
it doesn't work, we loose the item order: set and dict are unordered. An 
optimizer must not change the order in which items are created. At least, not 
by default.

I'm talking about an hypothetical ast.Literal type which would take a Python 
object (list, set, etc.) Current ast.Set contains an ordered list of items, 
ast.Dict uses two ordered lists for keys and values.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

In theory, TextIOWrapper could rewrite the last bit of the file (or the whole 
file) to have the requested number of characters. But I wonder if it is worth 
it; maybe deprecation is better. Do you have a use case for any of these bugs, 
or are you just playing around to see what the methods do?

In Issue 12922, seek() and tell() were (re-)defined for TextIOBase, but the 
situation with truncate() was apparently not considered.

Perhaps the write()–read() bug is related to Issue 12215.

--
nosy: +martin.panter

___
Python tracker 

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



[issue24923] Append system paths in setup.py instead of prepending

2016-01-19 Thread Zachary Ware

Zachary Ware added the comment:

I've been doing some research on this, the below is pretty much a brain-dump.

Related issues: issue232609, issue420565, issue10520.

This looks to me like the ideal solution is to assign a priority to each entry 
and sort by that priority before using it; give system locations low priority, 
/usr/local (sys.prefix) locations slightly higher priority, and user-defined 
paths highest priority.  That may be far more complex than it's worth, though.

It looks like setup.py doesn't actually look at CFLAGS at all, just CPPFLAGS 
and LDFLAGS.

Chris, is the behavior of 3.x any better for you?  There are some differences 
between the 2.7 and 3.x implementations of add_dir_to_list (most obviously, 
relative paths are always kept at the front of the list; see issue10520).

The naive solution looks to me to be to just move the CPPFLAGS/LDFLAGS checking 
further down detect_modules(), past all other calls to add_dir_to_list.  A test 
build with that change seems to work for me, but I'm not familiar enough with 
setup.py and how it works to call it correct.

--
nosy: +zach.ware

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Fornax

Fornax added the comment:

I don't have a specific use case. This spawned from a tangentially-related 
StackOverflow question (http://stackoverflow.com/questions/34858088), where in 
the answers a behavior difference between Python 2 and 3 was noted. I couldn't 
find any documentation to explain it, so I opened a follow-up question 
(http://stackoverflow.com/questions/34879318), and based on some feedback I got 
there, I opened up this issue.

Just to be sure I understand, you're suggesting deprecating truncate on 
text-mode file objects? And the interleaved read-writes are likely related to 
an issue that will be dealt with elsewhere?

--
type: behavior -> 

___
Python tracker 

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



[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Johnny Wezel

Johnny Wezel added the comment:

> But this leads to uninspectable objects.

An inspection would be done with repr() which should not cause a problem.

Besides. the official and correct way of handling an ff character is to emit a 
Unicode replacement code, not to issue an exception. Another flaw in the whole 
story.

--

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Марк Коренберг

Марк Коренберг added the comment:

text files and seek() offset: issue25849

--
nosy: +mmarkk

___
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-19 Thread Zachary Ware

Zachary Ware added the comment:

I'm a bit concerned that the flags are being added unconditionally to CFLAGS 
and LDFLAGS (when configured --with-lto), which means extensions are forced 
into it as well.  I think it would be better to use CFLAGS_NODIST and to add 
LDFLAGS_NODIST.  Unfortunately, 2.7 doesn't have even CFLAGS_NODIST; I suspect 
it may be time to backport that.

--
nosy: +zach.ware

___
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-19 Thread Antti Haapala

Antti Haapala added the comment:

Nice work, my issue21385 is also related. Basically, transforming non-Python 
code into Python meant that all line number information, which otherwise would 
have been useful for debugging, had to be discarded, or debug builds of Python 
would dump cores.

So, bye "assert(d_lineno >= 0);", you won't be missed.

--
nosy: +ztane

___
Python tracker 

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



[issue17781] optimize compilation options

2016-01-19 Thread Zachary Ware

Zachary Ware added the comment:

PGO is available as `make profile-opt`, LTO has a patch in issue25702.  Are 
there any other interesting options worth investigating?

--
nosy: +zach.ware
status: open -> pending

___
Python tracker 

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



[issue15809] 2.7 IDLE console uses incorrect encoding.

2016-01-19 Thread fireattack

fireattack added the comment:

Any update on this?

--

___
Python tracker 

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



[issue15809] 2.7 IDLE console uses incorrect encoding.

2016-01-19 Thread R. David Murray

Changes by R. David Murray :


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



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

2016-01-19 Thread Zachary Ware

Zachary Ware added the comment:

I've looked into this a bit, and tests won't pass with MSVC /fp:strict, so it 
would need to be ICC specific.  UNIX ICC builds do unconditionally use 
-fp-model strict now, though, so I think Windows ICC builds should as well.

--

___
Python tracker 

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



[issue17781] optimize compilation options

2016-01-19 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +r.david.murray
status: pending -> open

___
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-19 Thread R. David Murray

Changes by R. David Murray :


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



[issue24923] Append system paths in setup.py instead of prepending

2016-01-19 Thread R. David Murray

Changes by R. David Murray :


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



[issue17781] optimize compilation options

2016-01-19 Thread R. David Murray

Changes by R. David Murray :


--
status: open -> pending

___
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-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Unfortunately, 2.7 doesn't have even CFLAGS_NODIST; I suspect it may be time 
> to backport that.

I don't think now is a good time to introduce instability in the 2.7 branch.

--

___
Python tracker 

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



[issue15809] 2.7 IDLE console uses incorrect encoding.

2016-01-19 Thread Ned Deily

Changes by Ned Deily :


--
nosy:  -ned.deily

___
Python tracker 

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



[issue26154] Add private _PyThreadState_FastGet() to get the current thread state

2016-01-19 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Overall +1 to this private API.  I like the UncheckedGet name better than 
FastGet but don't really care what the name is so long as it keeps this 
property: It must be non-blocking and safe to call from a signal handler.  
Returning NULL in the event the value could not be obtained in such a manner is 
fine (unlikely to happen from the looks of the 3.5 code).

They are private and this fixes the regression in 3.5.1.  people (ab)using 
these private APIs should be fine writing conditional compilation code to deal 
with that.

We've got a similar patch on our CPython 2.7 interpreter at work (more 
complicated as it must do a non-blocking lock acquire in the old 2.7 code).

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Eryk Sun

Eryk Sun added the comment:

FYI, you can parse the cookie using struct or ctypes. For example:

class Cookie(ctypes.Structure):
_fields_ = (('start_pos', ctypes.c_longlong),
('dec_flags', ctypes.c_int),
('bytes_to_feed', ctypes.c_int),
('chars_to_skip', ctypes.c_int),
('need_eof',  ctypes.c_byte))

In the simple case only the buffer start_pos is non-zero, and the result of 
tell() is just the 64-bit file pointer. In Serhiy's UTF-7 example it needs to 
also convey the bytes_to_feed and chars_to_skip values:

>>> f.tell()
680564735109527527154978616360239628288
>>> cookie_bytes = f.tell().to_bytes(ctypes.sizeof(Cookie), sys.byteorder)
>>> state = Cookie.from_buffer_copy(cookie_bytes)
>>> state.start_pos
0
>>> state.dec_flags
0
>>> state.bytes_to_feed
16
>>> state.chars_to_skip
2
>>> state.need_eof
0

So a seek(0, SEEK_CUR) in this case has to seek the buffer to 0, read and 
decode 16 bytes, and skip 2 characters. 

Isn't this solvable at least for the case of truncating, Martin? It could do a 
tell(), seek to the start_pos, read and decode the bytes_to_feed, re-encode the 
chars_to_skip, seek back to the start_pos, write the encoded characters, and 
then truncate.

>>> f = open('temp.txt', 'w+', encoding='utf-7')
>>> f.write(b'+BDAEMQQyBDMENA-'.decode('utf-7'))
5
>>> _ = f.seek(0); f.read(2)
'аб'
>>> cookie_bytes = f.tell().to_bytes(sizeof(Cookie), byteorder)
>>> state = Cookie.from_buffer_copy(cookie_bytes)
>>> f.buffer.seek(state.start_pos)
0
>>> buf = f.buffer.read(state.bytes_to_feed)
>>> s = buf.decode(f.encoding)[:state.chars_to_skip]
>>> f.buffer.seek(state.start_pos)
0
>>> f.buffer.write(s.encode(f.encoding))
8
>>> f.buffer.truncate()
8
>>> f.close()
>>> open('temp.txt', encoding='utf-7').read()
'аб'

Rewriting the encoded bytes is necessary to properly terminate the UTF-7 
sequence, which makes me doubt whether this simple approach will work for all 
codecs. But something like this is possible, no?

--

___
Python tracker 

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



[issue25863] ISO-2022 seeking forgets state

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

After thinking about Issue 26158, I realize the seek() magic numbers don’t 
store any _encoder_ state, only _decoder_ state. That would explain the first 
bug (write, seek, then read). Though for this codec I suspect the decoder state 
is not recorded either, hence the bug with tell().

Personally I don’t care much for seeking text files. But if someone wanted to 
fix the second bug, that might require fixing the incremental decoder’s 
getstate() implementation.

--

___
Python tracker 

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



[issue12215] TextIOWrapper: issues with interlaced read-write

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

Consider codecs that maintain an internal buffer (UTF-7) or other state 
(ISO-2022). When you call TextIOWrapper.read() and then tell(), the I think the 
returned number is supposed to hold the _decoder_ state, so you can seek back 
and read again. But I don’t think the number holds any _encoder_ state, so 
seek() cannot set up the encoder properly for these more awkward codecs.

I don’t think it is practical to fix this problem using the incremental codec 
API. You would need to construct the encoder’s state from the decoder. There 
are a couple of bugs marked as duplicates of this. What are the real-world use 
cases?

--
nosy: +martin.panter

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Martin Panter

Martin Panter added the comment:

Fornax: Yes, I was suggesting the idea of deprecating truncate() for text 
files! Although a blanket deprecation of all cases may not be realistic. 
Quickly reading the Stack Overflow pages, it seems like there is demand for 
this to work in some cases. Deprecating it in the more awkward situations, such 
as after after reading, and with specific kinds of codecs, might be an option 
though.

Now I think Issue 12215 (read then write) is more closely related to the 
read-then-truncate problem. For the write-then-read bug, it might be a separate 
problem with an easy fix: call flush() before changing to reader mode.

Eryk: If there is no decoder state, and the file data hasn’t changed, maybe it 
is solvable. But I realize now it won’t work in general. We would have to 
construct the encoder state from the decoder state. The same problem as Issue 
12215.

--

___
Python tracker 

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



[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

2016-01-19 Thread Hiroyuki Takagi

Hiroyuki Takagi added the comment:

Thank you for reviewing patch.

I wrote test and updated patch. To pass the test, both this patch and 
issue25599's patch are required.

Changes of the patch:
- copy __code__ not only functions but also methods
- add autospec (create_autospec) suppoort

I have completely missed about autospec, thank you for a mention about it.
For autospec, simply copying original __code__ to funcopy makes error on 
existing tests.
That's why I changed the src of exec, but it seems to be quite ad-hoc. It may 
be better to be improved, but I don't have any good idea, sorry.

On the tests of this patch, I wonder if it's better to use assertIs(.., 
True/False) instead of assertTrue/False, since it was one of the problem in 
issue25599.
To apply this change and pass test, need to change asyncio.iscoroutinefunction 
to return bool. The change would be very easy, just update issue25599's patch 
like `return_value = bool(getattr(func, ...`.

--
Added file: http://bugs.python.org/file41664/mock2.patch

___
Python tracker 

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



[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread random832

random832 added the comment:

In the analogous C operations, ftell (analogous to .tell) actually causes the 
underlying file descriptor's position (analogous to the raw stream's position) 
to be reset to be at the same value that ftell has returned. Which means, yes, 
that you lose the benefits of buffering if you're so foolish as to call ftell 
after every read. But in this case the sequence "read / tell / truncate" would 
be analogous to "fread(f) / ftell(f) / ftruncate(fileno(f))

Though, the fact that fread operates on the FILE * whereas truncate operates on 
a file descriptor serves as a red flag to C programmers... arguably since this 
is not the case with Python, truncate on a buffered stream should implicitly 
include this same "reset underlying position" operation before actually 
performing the truncate.

--
nosy: +random832

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7415a9386048 by Berker Peksag in branch '3.5':
Issue #26157: Fix typos in asyncio-eventloop.rst
https://hg.python.org/cpython/rev/7415a9386048

New changeset 67f562cbd87b by Berker Peksag in branch 'default':
Issue #26157: Fix typos in asyncio-eventloop.rst
https://hg.python.org/cpython/rev/67f562cbd87b

--
nosy: +python-dev

___
Python tracker 

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



[issue26157] Typo in asyncio documentation

2016-01-19 Thread Berker Peksag

Berker Peksag added the comment:

Thanks! I noticed another typo in the same file and fixed it.

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue25702] Link Time Optimizations support for GCC and CLANG

2016-01-19 Thread Zachary Ware

Zachary Ware added the comment:

Unless I'm just missing something, I don't see how introducing CFLAGS_NODIST 
and LDFLAGS_NODIST to 2.7 would introduce instability.  It should be a fairly 
non-invasive change, restricted to configure and the Makefile; both vars should 
usually be empty and thus builds should be entirely unaffected unless options 
like --with-lto are chosen.


On a separate note about the patch: as mentioned in msg251305, it's probably 
better to restrict adding the LTO flags to just the profile-opt targets, even 
with the --with-lto check.

--

___
Python tracker 

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



[issue26155] 3.5.1 installer issue on Win 7 32 bit

2016-01-19 Thread Steve Dower

Steve Dower added the comment:

You should have some log files in your %TEMP% directory, all starting with 
"python". Could you post those here? They'll help us see what happened.

--

___
Python tracker 

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



[issue25925] Coverage support for CPython 2

2016-01-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed7b602a7400 by Zachary Ware in branch '2.7':
Issue #25925: Backport C coverage reporting Makefile targets
https://hg.python.org/cpython/rev/ed7b602a7400

--
nosy: +python-dev

___
Python tracker 

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



[issue25925] Coverage support for CPython 2

2016-01-19 Thread Zachary Ware

Zachary Ware added the comment:

Committed (with a couple minor tweaks), thanks for the patch!

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



[issue10367] "python setup.py sdist upload --show-response" can fail with "UnboundLocalError: local variable 'result' referenced before assignment"

2016-01-19 Thread Berker Peksag

Berker Peksag added the comment:

This has been fixed in issue 12853. The relevant line is here: 
https://hg.python.org/cpython/file/2.7/Lib/distutils/command/upload.py#l179

Closing this one as a duplicate.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> global name 'r' is not defined in upload.py

___
Python tracker 

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



  1   2   >