[issue28333] input() with Unicode prompt produces mojibake on Windows

2016-10-07 Thread Eryk Sun

Eryk Sun added the comment:

I'm sure Steve already has this covered, but FWIW here's a patch to call 
WriteConsoleW. Here's the result with the patch applied:

>>> sys.ps1 = '»»» '
»»» input("αβψδ: ")
αβψδ: spam
'spam'

and with interactive stdin and stdout/stderr redirected to a file:

>set PYTHONIOENCODING=utf-8
>amd64\python_d.exe >out.txt 2>&1
input("αβψδ: ")
spam
^Z

>chcp 65001
Active code page: 65001

>type out.txt
Python 3.6.0b1+ (default, Oct  7 2016, 23:47:58)
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> αβψδ: 'spam'
>>>

If it can't write the prompt for some reason (e.g. out of memory, decoding 
fails, WriteConsole fails), it doesn't fall back on fprintf to write the 
prompt. Should it? 

This should also get a test that calls ReadConsoleOutputCharacter to verify 
that the correct prompt is written.

--
keywords: +patch
Added file: http://bugs.python.org/file45008/issue_28333_01.patch

___
Python tracker 

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



[issue28388] Update documentation for typing module

2016-10-07 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi:

Here is the patch with updates according to recent changes in typing module and 
PEP 484:

- most things are not classes now
- outcome of parameterizing generics is cached
- Union does not unify everything with Any
- few minor fixes

This patch also fixes http://bugs.python.org/issue27588

The attached patch is generated for 3.5

--
assignee: docs@python
components: Documentation
files: doc-typing-patch.diff
keywords: patch
messages: 278283
nosy: docs@python, gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Update documentation for typing module
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file45007/doc-typing-patch.diff

___
Python tracker 

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



[issue28374] SyntaxError: invalid token in python2.7/test/test_grammar.py

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The absence of a space is intentional. See #21642.  Fix applied 2014-06-07.  
Hence Berker's guesses.

def test_float_exponent_tokenization(self):
# See issue 21642.
self.assertEqual(1 if 1else 0, 1)
self.assertEqual(1 if 0else 0, 0)
self.assertRaises(SyntaxError, eval, "0 if 1Else 0")

On Windows, test passes for 2.7.12 both installed and locally compiled. 

This said, it is possible that there is a compilation problem on some system, 
especially one that does not match a buildbot.  We can re-open if this is the 
case.

--
nosy: +terry.reedy
status: pending -> closed

___
Python tracker 

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



[issue28333] input() with Unicode prompt produces mojibake on Windows

2016-10-07 Thread Eryk Sun

Eryk Sun added the comment:

When I pointed this issue out in code reviews, I assumed you would add the 
relatively simple fix to decode the prompt and call WriteConsoleW. The 
long-term fix in issue 17620 has to be worked out with cross-platform support, 
and ISTM that it can wait for 3.7.

Off topic: I just noticed that you're not calling PyOS_InputHook in the new 
PyOS_StdioReadline code. Tkinter registers this function pointer to call its 
EventHook. Do you want a separate issue for this, or is there a reason its was 
omitted?

--
nosy: +eryksun

___
Python tracker 

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



[issue28339] "TypeError: Parameterized generics cannot be used with class or instance checks" in test_functools after importing typing module

2016-10-07 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Since the quick fix is now applied, I think it should not be a release blocker 
any more.

--

___
Python tracker 

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



[issue28100] Refactor error messages in symtable.c

2016-10-07 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


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



[issue28367] Add more standard baud rate constants to "termios"

2016-10-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
stage:  -> patch review
versions: +Python 3.7

___
Python tracker 

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



[issue28352] winfo_pathname(..) | window id "xyz" doesn't exist in this application. | Python 3.4.4

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

At least give a minimal but complete example that works in 3.4.1 but fails in 
3.4.4.  What you put in the title in not valid syntax.

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue28340] TextIOWrapper.tell extremely slow

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I suggest that you try backporting the patch to 2.7 and and/or ask on #4 
whether there was a positive reason not to do so (and mention that you opened 
this issue to do so).

--
nosy: +terry.reedy

___
Python tracker 

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



[issue28333] input() with Unicode prompt produces mojibake on Windows

2016-10-07 Thread Steve Dower

Steve Dower added the comment:

This may force issue17620 into 3.6 - we really ought to be getting and using 
sys.stdin and sys.stderr in PyOS_StdioReadline() rather than going directly to 
the raw streams.

The problem here is that we're still using fprintf to output the prompt, even 
though we know (assume) the input is utf-8.

I haven't looked closely at how safely we can use Python objects from this 
code, except to see that it's not obviously safe, but we should really figure 
out how to deal in Python str rather than C char* for the default readline 
implementation (and then only fall back on the GNU protocol when someone asks 
for it).

The faster fix here would be to decode the prompt from utf-8 to utf-16-le in 
PyOS_StdioReadline and then write it using a wide-char output function.

--
keywords: +3.5regression
stage:  -> needs patch
versions: +Python 3.7

___
Python tracker 

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



[issue28334] netrc does not work if $HOME is not set

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

On Windows, HOME is both split into two variables and replaced by USERPROFILE.
C:\Users\Terry>set HOME
HOMEDRIVE=C:
HOMEPATH=\Users\Terry

C:\Users\Terry>set USERPROFILE
USERPROFILE=C:\Users\Terry

So if it make sense to run this on Windows*, I would call it a bug.
* I am guessing that Windows' FTP clients do not use .netrc.

The doc says "the file .netrc in the user’s home directory will be read." 
without qualification by "if $HOME is set".  I don't remember how 
os.path.expanduser might otherwise find the home directory on unix and don't 
know what unix users might reasonbly expect.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue28333] input() with Unicode prompt produces mojibake on Windows

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is a regression from 3.5.2, where input("α") displays "α".

--

___
Python tracker 

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



[issue28326] multiprocessing.Process depends on sys.stdout being open

2016-10-07 Thread Tiago Antao

Tiago Antao added the comment:

This is the first patch that I am submitting. More than willing to do any 
changes deemed necessary...

--

___
Python tracker 

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



[issue28333] input() with Unicode prompt produces mojibake on Windows

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Same output with cp437.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue28331] "CPython implementation detail:" removed when content translated

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I abbreviated title to make most of it visible in listings.

--
nosy: +terry.reedy
title: "CPython implementation detail:" is removed when contents is translated 
-> "CPython implementation detail:" removed when content translated

___
Python tracker 

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



[issue28326] multiprocessing.Process depends on sys.stdout being open

2016-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Patch looks plausible to me.  The flush calls definitely need to be guarded.

--
nosy: +terry.reedy
stage:  -> patch review
type:  -> behavior

___
Python tracker 

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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-07 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch to demonstrate what I meant in msg226047.

Example from the REPL:

>>> __import__('encodings', fromlist=[u'aliases'])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Item in ``from list'' must be str, not unicode

--
Added file: http://bugs.python.org/file45006/issue21720.diff

___
Python tracker 

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



[issue28317] Improve support of FORMAT_VALUE in dis

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue25783] test_traceback.test_walk_stack() fails when run directly (without regrtest)

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.5, Python 3.7

___
Python tracker 

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



[issue25783] test_traceback.test_walk_stack() fails when run directly (without regrtest)

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8d150de9edba by Serhiy Storchaka in branch '3.5':
Issue #25783: Fixed test_traceback when run directly (without regrtest).
https://hg.python.org/cpython/rev/8d150de9edba

New changeset 4646b64139c9 by Serhiy Storchaka in branch '3.6':
Issue #25783: Fixed test_traceback when run directly (without regrtest).
https://hg.python.org/cpython/rev/4646b64139c9

New changeset 696851f38c93 by Serhiy Storchaka in branch 'default':
Issue #25783: Fixed test_traceback when run directly (without regrtest).
https://hg.python.org/cpython/rev/696851f38c93

--
nosy: +python-dev

___
Python tracker 

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



[issue24098] Multiple use after frees in obj2ast_* methods

2016-10-07 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



[issue25783] test_traceback.test_walk_stack() fails when run directly (without regrtest)

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue28257] Regression for star argument parameter error messages

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue28257] Regression for star argument parameter error messages

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 35676cd72352 by Serhiy Storchaka in branch '3.5':
Issue #28257: Improved error message when pass a non-mapping as a var-keyword
https://hg.python.org/cpython/rev/35676cd72352

--

___
Python tracker 

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



[issue18287] PyType_Ready() should sanity-check the tp_name field

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c459b0f2b75 by Serhiy Storchaka in branch '3.5':
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
https://hg.python.org/cpython/rev/5c459b0f2b75

New changeset ba76dd106e66 by Serhiy Storchaka in branch '2.7':
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
https://hg.python.org/cpython/rev/ba76dd106e66

New changeset 0b726193ec3c by Serhiy Storchaka in branch '3.6':
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
https://hg.python.org/cpython/rev/0b726193ec3c

New changeset a60d0e80cc1d by Serhiy Storchaka in branch 'default':
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
https://hg.python.org/cpython/rev/a60d0e80cc1d

--
nosy: +python-dev

___
Python tracker 

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



[issue18287] PyType_Ready() should sanity-check the tp_name field

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Niklas for your report and 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



[issue28387] double free in io.TextIOWrapper

2016-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +IO
nosy: +benjamin.peterson, serhiy.storchaka, stutzbach
priority: normal -> high
stage:  -> patch review

___
Python tracker 

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



[issue26293] Embedded zipfile fields dependent on absolute position

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report and testing.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7

___
Python tracker 

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



[issue26293] Embedded zipfile fields dependent on absolute position

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9a99a88301ef by Serhiy Storchaka in branch '2.7':
Issue #26293: Fixed writing ZIP files that starts not from the start of the
https://hg.python.org/cpython/rev/9a99a88301ef

--

___
Python tracker 

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



[issue28387] double free in io.TextIOWrapper

2016-10-07 Thread Sebastian Cufre

Changes by Sebastian Cufre :


--
keywords: +patch
Added file: http://bugs.python.org/file45005/textio.c.patch

___
Python tracker 

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



[issue28387] double free in io.TextIOWrapper

2016-10-07 Thread Sebastian Cufre

New submission from Sebastian Cufre:

We have found that you can produce a crash when an instance of 
_io.TextIOWrapper is being deallocated while there's another thread invoking 
the garbage collector. I've attached a simple script that should reproduce the 
issue (textiowrapper_crash.py)

Looking at the code of the _io module, we found that on the dealloc method of 
the TextIOWrapper class, it first tries to invoke the close method, then 
releases its internal members, after that removes itself from the garbage 
collector tracking and finally frees deallocates the remaining stuff. What 
happens, is that while releasing it's internal members, it might end up calling 
code that releases the interpreter lock (because its doing an operating system 
call), letting other threads execute. If for example the thread that comes in, 
invokes the garbage collector, on debug will raise an assert on gcmodule.c on 
line 351, where I understand it is complaining that it is tracking an object 
with refcount 0. In a release build, I suppose this goes on and will end up 
releasing the object (given it has a refcount of 0), and when the interrupted 
dealloc thread continues will end up freeing again itself which at some point 
produces a crash.

Attached is a proposed fix for the issue in textio.c.patch, where the it the 
call to _PyObject_GC_UNTRACK is now done right after the call to the close 
method and before release its internal members.

As a reference we have been able to reproduce this with Python 2.7.12 on 
Windows (i386)

--
components: Extension Modules
files: textiowrapper_crash.py
messages: 278263
nosy: scufre
priority: normal
severity: normal
status: open
title: double free in io.TextIOWrapper
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file45004/textiowrapper_crash.py

___
Python tracker 

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



[issue26293] Embedded zipfile fields dependent on absolute position

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 005704f5634f by Serhiy Storchaka in branch '3.5':
Issue #26293: Fixed writing ZIP files that starts not from the start of the
https://hg.python.org/cpython/rev/005704f5634f

New changeset b06e75ae1981 by Serhiy Storchaka in branch '3.6':
Issue #26293: Fixed writing ZIP files that starts not from the start of the
https://hg.python.org/cpython/rev/b06e75ae1981

New changeset 64a19fe3a16a by Serhiy Storchaka in branch 'default':
Issue #26293: Fixed writing ZIP files that starts not from the start of the
https://hg.python.org/cpython/rev/64a19fe3a16a

--
nosy: +python-dev

___
Python tracker 

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



[issue24098] Multiple use after frees in obj2ast_* methods

2016-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 47d5bf5a846f by Serhiy Storchaka in branch '2.7':
Issue #24098: Fixed possible crash when AST is changed in process of
https://hg.python.org/cpython/rev/47d5bf5a846f

New changeset f575710b5f56 by Serhiy Storchaka in branch '3.5':
Issue #24098: Fixed possible crash when AST is changed in process of
https://hg.python.org/cpython/rev/f575710b5f56

New changeset 7528154cadaa by Serhiy Storchaka in branch '3.6':
Issue #24098: Fixed possible crash when AST is changed in process of
https://hg.python.org/cpython/rev/7528154cadaa

New changeset def217aaad2f by Serhiy Storchaka in branch 'default':
Issue #24098: Fixed possible crash when AST is changed in process of
https://hg.python.org/cpython/rev/def217aaad2f

--
nosy: +python-dev

___
Python tracker 

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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-07 Thread Марк Коренберг

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

Yes, that message will be sufficient. Perfectly.

--

___
Python tracker 

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



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +christian.heimes
type:  -> behavior

___
Python tracker 

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



[issue28378] urllib2 does not handle cookies with `,`

2016-10-07 Thread SilentGhost

SilentGhost added the comment:

Could you please post an example of what you're being sent from the server and 
how your code handles / fails to deal with it.

--
nosy: +SilentGhost
stage:  -> test needed
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



[issue28386] Improve documentation about tzinfo.dst(None)

2016-10-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

None is passed to tzinfo.dst() when it is called from time.dst() method.  This 
is documented in the relevant section: 
.

I am not sure whether if it is worth repeating in the abstract tzinfo class 
documentation, but if we do, the same should be done for the utcoffset() and 
tzname() methods which also get None when called from namesake time methods.

While we are at it, we should also do something about "If utcoffset() does not 
return None, dst() should not return None either." mandate in the 
tzinfo.utcoffset() documentation. See 
.  
This mandate is violated by the datetime.timezone class.

--

___
Python tracker 

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



[issue28386] Improve documentation about tzinfo.dst(None)

2016-10-07 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +belopolsky

___
Python tracker 

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



[issue28377] struct.unpack of Bool

2016-10-07 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> struct.unpack('?', '\x02') returns (False,) on Mac OSX

___
Python tracker 

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



[issue24452] Make webbrowser support Chrome on Mac OS X

2016-10-07 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The patch looks good to me. 

(The test coverage for chrome browser can be improved. But that seems a like a 
different change than the current one).

--
assignee:  -> orsenthil
nosy: +orsenthil
versions: +Python 3.7 -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



[issue28386] Improve documentation about tzinfo.dst(None)

2016-10-07 Thread Daniel Moisset

New submission from Daniel Moisset:

The datetime module documentation[1] describes the tzinfo.dst method with a 
single "dt" argument without being too explicit about possible values for it. 
The implication is that dt should be a datetime object, but the implementation 
of time.dst() [2] actually calls tz.dst(None) (where tz is an instance of some 
tzinfo subclass), so this should clarify that None is an allowed value.

Also, some of the examples given below in the same document (like 
LocalTimezone, GMT1, GMT2) actually have a related bug (it doesn't handle a 
None value correctly). So running

>>> ... # copy the example from the documentation
>>> t = time(tzinfo=LocalTimeZone())
>>> t.dst()

crashes with an AttributeError: 'NoneType' object has no attribute 'year'. This 
kind of bugs have propagated to some other projects already [2]. Some of the 
other examples (like USTimeZone) seem to be OK

What I think would be desirable here is:
 * A clarification on 
https://docs.python.org/3.5/library/datetime.html#datetime.tzinfo.dst 
indicating that dt is either a datetime or a None, in which situations it can 
be None, and what is the method supposed to return in this case.
 * Fixes in the code examples that reflect this

I would offer a patch, but I'm not quite sure of what the desired behaviour is 
so I wouldn't know what to document :)

[1] https://docs.python.org/3.5/library/datetime.html
[2] 
https://github.com/python/cpython/blob/master/Modules/_datetimemodule.c#L3623
[3] https://github.com/django/django/blob/1.10.2/django/utils/timezone.py#L111

--
assignee: docs@python
components: Documentation
messages: 278256
nosy: Daniel Moisset, docs@python
priority: normal
severity: normal
status: open
title: Improve documentation about tzinfo.dst(None)

___
Python tracker 

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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-07 Thread Berker Peksag

Berker Peksag added the comment:

I think we can classify this one as a usability bug and improve the exception 
message.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue28383] __hash__ documentation recommends naive XOR to combine but this is suboptimal

2016-10-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

This makes sense.  Note that this is the way hashes are implemented for the 
datetime objects: 
.

--
nosy: +belopolsky

___
Python tracker 

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



[issue28315] incorrect "in ?" output in 'divide' example at "Defining Clean-up Actions" in tutorial

2016-10-07 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hi Jaysinh,

I reviewed your changes, they look good to me.
I can't approve it, so it would still be good for a core dev here to take 
another pass.

Thanks :)

--

___
Python tracker 

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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-07 Thread Tim Graham

Tim Graham added the comment:

As far as I can tell, this isn't an issue on Python 3. Can this be closed since 
Python 2 is only receiving bug fixes now?

--
nosy: +Tim.Graham

___
Python tracker 

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



[issue28383] __hash__ documentation recommends naive XOR to combine but this is suboptimal

2016-10-07 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-07 Thread Eric V. Smith

Eric V. Smith added the comment:

Sorry for not responding earlier. It's unlikely I'll have time for this before 
beta 2, although I can probably get to it after that and before beta 3. Don't 
let me stop someone else from improving on the patch.

--

___
Python tracker 

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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-07 Thread Eric V. Smith

Eric V. Smith added the comment:

Yes, I think we should implement this for object.__format__. Marking as easy.

--
components: +Interpreter Core -Library (Lib)
keywords: +easy (C)

___
Python tracker 

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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-07 Thread R. David Murray

R. David Murray added the comment:

Bytes don't support formatting codes, so they are passed through to object, 
which doesn't support any formatting codes, and produces the error message you 
see.  Since all other built in types reject invalid codes with a message that 
mentions their type, I think bytes should too.  This would change the message 
to:

  ValueError: Unknown format code 's' for object of type 'bytes'

Would that have lessened your confusion sufficiently?

--
nosy: +eric.smith, r.david.murray
stage:  -> needs patch
title: Non-informative exception while formatting strings. -> Bytes objects 
should reject all formatting codes with an error message
type:  -> behavior

___
Python tracker 

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



[issue25720] Fix curses module compilation with ncurses6

2016-10-07 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Thanks masamoto! There's another minor issue about this patch: if there's no 
curses.h (ncurses built with --without-curses-h), the detection always fails.

--

___
Python tracker 

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



[issue26906] format(object.__reduce__) fails intermittently

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yet one demonstration of this bug:

$ ./python -IS
>>> import operator
>>> operator.length_hint(iter("abc"))
0
>>> import collections.abc
>>> operator.length_hint(iter("abc"))
3

--

___
Python tracker 

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



[issue27972] Confusing error during cyclic yield

2016-10-07 Thread Guido van Rossum

Guido van Rossum added the comment:

I've meditated on this and I've changed my mind. A task that awaits
itself is so obviously not following the task protocol that it should
be shot on sight. No exceptions. (Only the task itself should ever set
the result or exception, and *only* by returning or raising. So the
only way a task waiting for itself could be unblocked is through
cancellation, and there are better ways to wait forever until
cancelled.)

IOW @1st1 I think it's okay to detect this and raise an exception.

--

___
Python tracker 

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



[issue25720] Fix curses module compilation with ncurses6

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added a comment on Rietveld.

--

___
Python tracker 

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



[issue28385] Non-informative exception while formatting strings.

2016-10-07 Thread Марк Коренберг

New submission from Марк Коренберг:

$ python3 -c "'{0:s}'.format(b'qwe')"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: non-empty format string passed to object.__format__

Spent many hours to detect bug in my code.

--
components: Library (Lib)
messages: 278244
nosy: mmarkk
priority: normal
severity: normal
status: open
title: Non-informative exception while formatting strings.
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue26081] Implement asyncio Future in C to improve performance

2016-10-07 Thread INADA Naoki

INADA Naoki added the comment:

fastfuture3-wip.patch is work in progress implementation of
implementing __repr__ and __del__ in C.
I post it to avoid duplicated works.

Known TODOs:

* Support overriding Future._repr_info()
* Fix __del__ is not called (Research how tp_del, tp_finalize, and 
tp_deallocate works)

I hope I have enough time to finish in next week, but I'm not sure.

--
Added file: http://bugs.python.org/file45003/fastfuture3-wip.patch

___
Python tracker 

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



[issue25720] Fix curses module compilation with ncurses6

2016-10-07 Thread Ismail Donmez

Ismail Donmez added the comment:

@masamoto thank you!

--

___
Python tracker 

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



[issue25720] Fix curses module compilation with ncurses6

2016-10-07 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

I updated the patch that add configuration check for is_pad. the is_pad is 
wrapped into py_is_pad at Modules/_cursesmodule.c:932 by either of three ways.

Case one -- is_pad is found: Define the macro that is simple wrapping.
Case two -- is_pad is not found, however WINDOW has _flags field: Define the 
macro using _flags field.
Case three -- is_pad is not found, and WINDOW doesn't have _flags field: Define 
the macro that is always preprocessed to FALSE.

I succeeded to build curses module on Cygwin (Vista x86) using this patch.
This patch doesn't include that undo fixes for specific platforms.

--
versions: +Python 3.7
Added file: http://bugs.python.org/file45002/curses-is_pad.patch

___
Python tracker 

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



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread Thomas Kluyver

Changes by Thomas Kluyver :


--
nosy: +takluyver

___
Python tracker 

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



[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-07 Thread Xiang Zhang

Xiang Zhang added the comment:

v2 applies Serhiy's suggestions.

--
Added file: http://bugs.python.org/file45001/PyUnicode_CopyCharacters_v2.patch

___
Python tracker 

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



[issue28378] urllib2 does not handle cookies with `,`

2016-10-07 Thread Grzegorz Sikorski

Grzegorz Sikorski added the comment:

It looks urllib2 works with this scenario, but upper level request fails.

--

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And merged in a6eb6acfe04a.

--

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

rangeiter_new() was added in r55167.

--

___
Python tracker 

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



[issue28377] struct.unpack of Bool

2016-10-07 Thread Meador Inge

Meador Inge added the comment:

Looks like a dup to me.

--
nosy: +meador.inge

___
Python tracker 

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



[issue28384] hmac cannot be used with shake algorithms

2016-10-07 Thread Min RK

New submission from Min RK:

HMAC digest methods call inner.digest() with no arguments, but new-in-3.6 shake 
algorithms require a length argument.

possible solutions:

1. add optional length argument to HMAC.[hex]digest, and pass through to inner 
hash object
2. set hmac.digest_size, and use that to pass through to inner hash object if 
inner hash object has digest_size == 0
3. give shake hashers a default value for `length` in digest methods (logically 
32 for shake_256, 16 for shake_128, I think)

test:

import hmac, hashlib

h = hmac.HMAC(b'secret', digestmod=hashlib.shake_256)
h.hexdigest() # raises on self.inner.digest() requires length argument

--
messages: 278235
nosy: minrk
priority: normal
severity: normal
status: open
title: hmac cannot be used with shake algorithms
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Raising a DeprecationWarning in 3.6 doesn't hurt.

--

___
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-10-07 Thread Thomas Levine

Thomas Levine added the comment:

I just upgraded from 3.5.1 to 3.5.2 and found that I couldn't authenticate to 
PyPI anymore. And then I remembered that this had been fixed, so removed the 
extra percent sign, and my uploads worked. Thanks!

--

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file45000/patchedCPython37TestOutput_ver2.txt

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44999/patchedCPython36TestOutput_ver2.txt

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44998/patchedCPython35TestOutput_ver2.txt

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44997/issue28376_CPython37_ver2.diff

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44996/issue28376_CPython36_ver2.diff

___
Python tracker 

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



[issue28376] rangeiter_new fails when creating a range of step 0

2016-10-07 Thread Oren Milman

Oren Milman added the comment:

The diff files for 3.5 and 3.6 are attached (I only added 
@test.support.cpython_only, as you suggested).

The diff file for 3.7 is also attached. It contains:
- removing rangeiter_new
- tests to verify one cannot create instances of range_iterator or 
longrange_iterator (in CPython)
- added 'Iterator.register(longrange_iterator)' in Lib/_collections_abc.py

The output of 'python_d.exe -m test -j3' for each version is also attached 
(they were all successful).

P.S. If we remove the ability to create instances of range_iterator in 3.7, 
shouldn't we raise a DeprecationWarning in rangeiter_new in 3.5 and 3.6?

--
Added file: http://bugs.python.org/file44995/issue28376_CPython35_ver2.diff

___
Python tracker 

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