[issue28997] test_readline.test_nonascii fails on Android

2016-12-17 Thread Martin Panter

Martin Panter added the comment:

This is a breakdown of running the test script on my Linux setup (UTF-8 locale):

^A^B^B^B^B^B^B^B\t\tx\t\r\n
Input echoed back (before Readline disables echo)
[\xc3\xafnserted]
Inserted by pre_input_hook()
|t\xc3\xab[after]
Inserted by the Ctrl+A macro
\x08\x08\x08\x08\x08\x08\x08
Response to moving the cursor left of [after]
text \'t\\xeb\'\r\n
Encoded completer(text=...) parameter for testing
line \'[\\xefnserted]|t\\xeb[after]\'\r\n
get_line_buffer() result for testing
indexes 11 13\r\n
get_begidx(), get_endidx()
\x07
Rings terminal bell due to multiple possible completions
text . . . line . . . indexes . . .\r\n
From second round of completer() calls due to second Tab input
substitution \'t\\xeb\'\r\n
matches [\'t\\xebnt\', \'t\\xebxt\']\r\n
display() parameters
x[after]\x08\x08\x08\x08\x08\x08\x08
Response to inserting “x”
t[after]\x08\x08\x08\x08\x08\x08\x08
Completion of "t\xEBxt"
\r\n
Response to inputting Return
result \'[\\xefnserted]|t\\xebxt[after]\'\r\n
input() function call return value
history \'[\\xefnserted]|t\\xebxt[after]\'\r\n
Line as retrieved from history

The problem is that the Ctrl+A macro seems to have only inserted the two ASCII 
characters "|t" and has stopped at the non-ASCII character "\xEB". Everthing 
else relies on the macro working properly to get the right cursor positioning 
and completion text.

Xavier: If you run the following code in an interactive Python session, what 
does pressing $ print out?

import readline
readline.parse_and_bind('Control-a: "|t\xEB[after]"')
readline.parse_and_bind('"$": dump-macros')

For me, it prints this: (includes “te” with an umlaut)

\C-a outputs |të[after]

What locale encoding does Python use for you? The parse_and_bind() call should 
be encoding "\xEB" with PyUnicode_EncodeLocale(), and passing the resulting 
string to Readline. Then Readline is supposed to insert the string when we 
invoke the macro. Somewhere the string is getting truncated.

--
nosy: +martin.panter

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

For folks not following the Fedora BZ issue directly, I've also attached the 
latest draft downstream patch here, which gives the following behaviour:

==

$ ./python -c "import sys; print(sys.getfilesystemencoding())"
utf-8

$ LANG=C.UTF-8 ./python -c "import sys; print(sys.getfilesystemencoding())"
utf-8

$ LANG=C ./python -c "import sys; print(sys.getfilesystemencoding())"
Python detected LC_CTYPE=C, forcing LC_ALL & LANG to C.UTF-8 (set 
PYTHONALLOWCLOCALE to disable this behaviour).
utf-8

$ PYTHONALLOWCLOCALE=1 LANG=C ./python -c "import sys; 
print(sys.getfilesystemencoding())"
Python detected LC_CTYPE=C, but PYTHONALLOWCLOCALE is set. Some libraries, 
applications, and operating system interfaces may not work correctly.
Py_Initialize detected LC_CTYPE=C, which limits Unicode compatibility. Some 
libraries and operating system interfaces may not work correctly. Use 
`PYTHONALLOWCLOCALE=1 LC_CTYPE=C python3` to configure a similar environment 
when running Python directly.
ascii
==

(The double warning in the last example is likely to go away by skipping the 
CLI level warning in that case)

The Python tests checking for the expected behaviour are signficantly longer 
than the C level changes needed to implement it :)

--

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-17 Thread Nick Coghlan

Changes by Nick Coghlan :


Added file: 
http://bugs.python.org/file45951/fedora-cpython-PYTHONALLOWCLOCALE.diff

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, the parallel with base64 decoding and embedding encoded data in multi-line 
string literals is indeed a compelling one - I'd missed that.

Given that rationale, +1 from me.

Perhaps it would make sense to call that out directly in the documentation? 
Something like a second example saying:


Ignoring all ASCII whitespace provides compatibility with common hexdump 
formats (like the output of ``xxd``), allowing such data to easily be read from 
a file or included directly in source code as a multiline string literal::

>>> bytes.fromhex("""
... F0F1F2F3F4
... FAFBFCFDFE
""")
b'\xf0\xf1\xf2\xf4\xfa\xfb\xfc\xfd'



And then a versionchanged note for 3.7 to say that this was switched from 
filtering out specifically space to filtering out any ASCII whitespace.

My other question would be whether or not a separate issue should be filed to 
update the bytes-to-bytes "hex" codec to be consistent with this change - at 
the moment, it doesn't allow whitespace *at all* (not even ASCII spaces), while 
the base64 decoder is consistent with base64.b64decode and allows it.

--

___
Python tracker 

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



[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2016-12-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

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



[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2016-12-17 Thread Ryan Brindley

Ryan Brindley added the comment:

I've updated the PR to also include raising a ValueError for timeout values < 0.

This behavior mimics that of queue.Queue (noting here again that queue.Queue 
handles timeout = 0).

--

___
Python tracker 

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



[issue28987] Remove typo in whats new entry on Descriptor Protocol Enhancements

2016-12-17 Thread Martin Panter

Martin Panter added the comment:

Thanks Jim

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



[issue28987] Remove typo in whats new entry on Descriptor Protocol Enhancements

2016-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a46a20a1f286 by Martin Panter in branch '3.6':
Issue #28987: Typos, grammar, spelling in documentation
https://hg.python.org/cpython/rev/a46a20a1f286

New changeset 28cf4ffcfbf3 by Martin Panter in branch 'default':
Issue #28987: Merge doc and comment fixes from 3.6
https://hg.python.org/cpython/rev/28cf4ffcfbf3

--
nosy: +python-dev

___
Python tracker 

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



[issue22343] Install bash activate script on Windows when using venv

2016-12-17 Thread Evan

Evan added the comment:

+1, I'm also using Windows with Git Bash and venv is unusable for me without 
Brandon's workaround.

--
nosy: +evan_

___
Python tracker 

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



[issue28972] Document all "python -m" utilities

2016-12-17 Thread Miki Tebeka

Miki Tebeka added the comment:

Thanks Guido, however I think my blog is not the right place - it's dog ugly 
and read by about 7 people on a good day :) 

I think that adding this to the official docs will add to the "batteries 
included" motto. I'll try to find a time and come up with a patch to the docs, 
however if this goes through we should place a note somewhere in the 
development docs about updating this section as well if someone adds a 
__main__.py or main function.

--

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Martin Panter

Martin Panter added the comment:

The first offending message I found is number 183465:

>>> s.group("comp.lang.python")
('211 4329 179178 183507 comp.lang.python', 4329, 179178, 183507, 
'comp.lang.python')
>>> s._putcmd("OVER 183465")
>>> s._getresp()
'224 Overview information for 183465 follows'
>>> line = s.file.readline()
>>> len(line)
2702
>>> [number, subject, from_header, date, message_id, references, bytes, lines, 
>>> extra] = line.split(b"\t", 8)
>>> message_id
b''
>>> len(references)
2483
>>> len(references.split())
36

Assuming the References value is the only large field in an OVER response line, 
I would guess that a reasonable limit per line might be

200 bytes/message-id * 200 messages/thread = 40,000 bytes per OVER line

I agree with closing the session whenever the client’s protocol state is 
broken, but only for a different, tangential reason. See Issue 22350. Even if 
you raised an explicit exception when using a closed session, like in 
nntplib_maxbytes.patch, won’t that still cause the subsequent tests to fail? I 
think the best solution is to stop sharing one connection across multiple 
tests: Issue 19756.

--

___
Python tracker 

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



[issue29003] sqlite3: can't run VACUUM on Python 3.6

2016-12-17 Thread Ned Deily

Changes by Ned Deily :


--
keywords: +3.6regression
nosy: +berker.peksag, ghaering

___
Python tracker 

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



[issue27584] New addition of vSockets to the python socket module

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

Oh, I see, the ac changes are there, I was looking at the patch delta instead 
of the complete patch.

--

___
Python tracker 

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



[issue27584] New addition of vSockets to the python socket module

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

The second patch seems to be missing the configure changes.  Also, the tests 
have some over-long lines (we limit line lengths to 79 characters).  I realize 
there are other long lines in that file, but no need to add more :)

There is trailing whitespace on a number of lines in your patch.

Since this is new, we may not want to accept it until the support hits 
upstream.  Specifically, it will be difficult to get a review if the reviewer 
has to build a custom kernel to test the code :)  You do say that the VMCI is 
upstream, but I don't know what that means.  Which upstream?

Note: I'm not familiar with the socket C code, so I haven't reviewed the C code 
changes.  The tests look fine to me.

For the docs, the proposal doesn't seem to follow the format of the existing 
docs.  I would expect only the first paragraph located where you have it.  The 
remaining constants should be in the 'module contents'/'constants' section, I 
think.  Yes, that means each one gets a '.. versionadded' label.  Presumably 
also an 'availablility' label with whatever the minimum kernel version 
is...another reason we may need to wait.

--

___
Python tracker 

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-12-17 Thread Ma Lin

Ma Lin added the comment:

#29003 created

--

___
Python tracker 

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



[issue29003] sqlite3: can't run VACUUM on Python 3.6

2016-12-17 Thread Ma Lin

New submission from Ma Lin:

I'm using Python 3.6.0 RC2.
When I try to run VACUUM command, an exception raised:

conn.execute('begin')  # <- remove this line get the same result
conn.execute('VACUUM')

sqlite3.OperationalError: cannot VACUUM from within a transaction

On Python 3.5, everything is fine.
Attached file cant_vacuum.py is the full example code.

--
related issue: #10740 sqlite3 module breaks transactions and potentially 
corrupts data

R. David Murray said in #10740 about this issue:
It is an unexpected change in behavior and is therefore probably a bug.  It 
will work if you set isolation_level=None.  Because of that I don't think it is 
a release critical bug, though one could wish we'd discovered it earlier.

--
components: Library (Lib)
files: cannot_vacuum.py
messages: 283532
nosy: Ma Lin
priority: normal
severity: normal
status: open
title: sqlite3: can't run VACUUM on Python 3.6
type: behavior
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45950/cannot_vacuum.py

___
Python tracker 

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



[issue28407] Improve coverage of email.utils.make_msgid()

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

Thanks Dillon.

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

___
Python tracker 

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



[issue28407] Improve coverage of email.utils.make_msgid()

2016-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8687b3554b1f by R David Murray in branch '3.5':
#28407 Improve test coverage of make_msgid.
https://hg.python.org/cpython/rev/8687b3554b1f

New changeset 87671b1f7ff4 by R David Murray in branch '3.6':
Merge #28407 Improve test coverage of make_msgid.
https://hg.python.org/cpython/rev/87671b1f7ff4

New changeset c016ab381894 by R David Murray in branch 'default':
Merge #28407 Improve test coverage of make_msgid.
https://hg.python.org/cpython/rev/c016ab381894

--
nosy: +python-dev

___
Python tracker 

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

It is an unexpected change in behavior and is therefore probably a bug.  It 
will work if you set isolation_level=None.  Because of that I don't think it is 
a release critical bug, though one could wish we'd discovered it earlier.  
Please open a new issue for this.

--
assignee: ghaering -> 
nosy: +ned.deily

___
Python tracker 

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-12-17 Thread Ma Lin

Ma Lin added the comment:

I'm using Python 3.6.0 RC2, I don't know if it's a bug.

When I try to run VACUUM command, an exception raised:

conn.execute('begin')  # <- remove this line get the same result
conn.execute('VACUUM')

sqlite3.OperationalError: cannot VACUUM from within a transaction

~~~
On Python 3.5, everything is fine.
Attached file cant_vacuum.py is the full example code.

--
nosy: +Ma Lin
Added file: http://bugs.python.org/file45949/cant_vacuum.py

___
Python tracker 

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



[issue29002] typing.AnyStr doc is unclear about python2 unicode support

2016-12-17 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Unless of course you mean pip installing typing for Py2 and then using ``# 
type``  comments to provide the types. 

Even in that case, I don't really think the documentation for Python 3.5 should 
be mentioning types in 2.7, that'd get confusing.

--

___
Python tracker 

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



[issue29002] typing.AnyStr doc is unclear about python2 unicode support

2016-12-17 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

The ``typing`` module doesn't exist in Python 2.7. 

All code samples provided in the docs *work* since no type-checking is 
performed by Python. That is, no enforcing of the types provided is made, 
that's for 3rd party packages to supply.

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-12-17 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Just an update. We missed the last 2.7.13 release train. Sorry for that. 
It's worth to fix this bug still ASAP. It's intricately related to some other 
bugs like (issue25458, issue26960). I got to this and realized the dependency 
and other bugs. All those will be cleaned up and fixed together.

--

___
Python tracker 

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



[issue29002] typing.AnyStr doc is unclear about python2 unicode support

2016-12-17 Thread Alex Jurkiewicz

New submission from Alex Jurkiewicz:

The typing.AnyStr documentation:

https://docs.python.org/3/library/typing.html#typing.AnyStr

It gives some examples using u-strings (u'foo') but doesn't make explicit some 
subtleties about behaviour with Python 2. Specifically, with Python 2 all the 
given examples work, and even this works:

concat("foo", u"bar")

Which seems contrary to the goal of AnyStr being "used for functions that may 
accept any kind of string without allowing different kinds of strings to mix".

I think the documentation should call out that for Python 2, AnyStr doesn't 
distinguish between str & unicode, and mention that in python 2, b'str' is 
equivalent to 'str' (I know this is mentioned elsewhere, but it seems useful to 
repeat it here).

--
assignee: docs@python
components: Documentation
messages: 283524
nosy: aj, docs@python
priority: normal
severity: normal
status: open
title: typing.AnyStr doc is unclear about python2 unicode support
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, 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



[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2016-12-17 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Updated patch as proposed by Serhiy.

--
Added file: http://bugs.python.org/file45948/syntax-error-order-v2.patch

___
Python tracker 

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



[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2016-12-17 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

I don't think this is a bug, but detecting first a SyntaxError that appears 
textually first might be seen as an improvement. I would say such behaviour 
seems more intuitive. A possible downside could be a (probably very minor) 
slow-down of compilation.

I don't have any strong opinion here.

--

___
Python tracker 

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



[issue28407] Improve coverage of email.utils.make_msgid()

2016-12-17 Thread Dillon Brock

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



[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-17 Thread Steve Dower

Steve Dower added the comment:

I've committed to 3.6.1 and 3.7, but I'm not convinced that the problem is 
worth the risk of changing the behaviour in 2.7.14 and 3.5.3.

Considering we kept forgetting to commit this for so long and largely got away 
with it, I assume there aren't hundreds of people being bitten by this on a 
daily basis. There are also other ways to work around the problems that have 
occurred (editing and resaving the values in Registry Editor should suffice, 
and the attached nullcheck scripts can help find the problematic values).

So while 2.7 and 3.5 will continue to not trim REG_SZ values at the first 
embedded null, I think that's best for preserving the ability of users to 
upgrade easily between microversions (particularly for 2.7).

--

___
Python tracker 

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



[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8cee4862fb34 by Steve Dower in branch '3.6':
Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun)
https://hg.python.org/cpython/rev/8cee4862fb34

New changeset 3014854e68e4 by Steve Dower in branch 'default':
Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun)
https://hg.python.org/cpython/rev/3014854e68e4

--
nosy: +python-dev

___
Python tracker 

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



[issue28747] Expose SSL_CTX_set_cert_verify_callback

2016-12-17 Thread Ned Deily

Ned Deily added the comment:

>From a release manager perspective, I'm OK in principle with adding it to 
>3.6.1 as long as the ssl experts are OK with it.

--
nosy: +alex, dstufft, janssen

___
Python tracker 

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



[issue28747] Expose SSL_CTX_set_cert_verify_callback

2016-12-17 Thread Steve Dower

Steve Dower added the comment:

The current _3.patch builds on default without warning and the tests pass 
(_2.patch is the one Ned tried).

Any objections to committing this into 3.7?

What about 3.6.1? As an additive and easy to detect API, I think it's suitable, 
and I will certainly use it (right now my library's setup.py depends on having 
each libeay.lib from each original CPython build handy to get some of the 
functions out of it - these files are about 50MB each, so it's a little 
painful).

If it helps, I'm happy to add a warning to the docs that setting the callback 
may cause a loss of security if the callback does not properly validate the 
certificate (or some wording to that effect). Personally I think that's fairly 
well implied though, as there isn't any other obvious use for the callback.

--

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-12-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
Added file: 
http://bugs.python.org/file45947/faster_keyword_args_parse_alt2.patch

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Just for the history, there are two alternative patches. They unpack keyword 
arguments to linear array. I expected this approach can add more optimization, 
but actually the benefit is too small or negative.

--
Added file: http://bugs.python.org/file45946/faster_keyword_args_parse_alt.patch

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-17 Thread Jan Niklas Hasse

Jan Niklas Hasse added the comment:

> Usually, when a new option is added to Python, we add a command line option 
> (-X utf8) but also an environment variable: I propose PYTHONUTF8=1.
>
> Use your favorite method to define the env var "system wide" in your docker 
> containers.

This doesn't help me, as I already set LANG to C.utf-8.

I'm rather thing about new people trying out Python in Docker who don't know 
about this.

Furthermore I think that UTF-8 is the future and the use of ASCII should be 
discouraged.

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks David.

--
assignee: docs@python -> 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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 96d728c14267 by Serhiy Storchaka in branch '3.5':
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
https://hg.python.org/cpython/rev/96d728c14267

New changeset 29c9c414c310 by Serhiy Storchaka in branch '3.6':
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
https://hg.python.org/cpython/rev/29c9c414c310

New changeset 4e55e011dd80 by Serhiy Storchaka in branch 'default':
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
https://hg.python.org/cpython/rev/4e55e011dd80

--
nosy: +python-dev

___
Python tracker 

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



[issue9770] curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09)

2016-12-17 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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On 32-bit platform the size of empty bytes object is 17 bytes not counting 
padding and GC links. Plus 4 bytes for a pointer in a list. On 64 bit platform 
numbers are about twice larger. Therefore add at least 20-40 bytes per line.

Is not 100 MiB too large for a list in memory? For files we could use larger 
limit, but the problem is that file can be io.BytesIO().

--

___
Python tracker 

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



[issue29001] logging.handlers.RotatingFileHandler rotation broken under gunicorn

2016-12-17 Thread Bruce Edge

New submission from Bruce Edge:

I've been seeing some funny behavior in log files form a 
logging.handlers.RotatingFileHandler.

Here's my handler config snippet, in a "log.cfg":

[handlers]
keys=log_file

[formatters]
keys=access

[formatter_access]
format=%(asctime)s - %(name)s(%(funcName)s:%(lineno)s)[%(process)d] - 
%(levelname)s: %(message)s
datefmt=%Y-%m-%d %H:%M:%S
class=logging.Formatter

[handler_log_file]
class=logging.handlers.RotatingFileHandler
formatter=access
args=('/var/log/ml-api/access.log', 'a', 1000, 16, 'utf8')

Specified using:

 /usr/local/bin/gunicorn --worker-class=gevent --bind unix:ml-api.sock -m 007 
--workers=8 --log-config=log.cfg --log-level=DEBUG app

I ran this script to show the progression of log file creation:

while true ; do ls -lrt && sleep 10; done

Initially there's one incrementing log file, fine:

-rw-r--r-- 1 ubuntu www-data 9765042 Dec 16 17:50 access.log
total 9572
-rw-r--r-- 1 ubuntu www-data 9796828 Dec 16 17:50 access.log
total 9656
-rw-r--r-- 1 ubuntu www-data 9881053 Dec 16 17:50 access.log
total 9708
-rw-r--r-- 1 ubuntu www-data 9936776 Dec 16 17:50 access.log
total 9756
-rw-r--r-- 1 ubuntu www-data 9984782 Dec 16 17:50 access.log
total 9816

But as soon as it gets rotated, I immediately get 8 log files:

-rw-r--r-- 1 ubuntu www-data 911 Dec 16 17:50 access.log.7
-rw-r--r-- 1 ubuntu www-data2578 Dec 16 17:50 access.log.5
-rw-r--r-- 1 ubuntu www-data2578 Dec 16 17:50 access.log.3
-rw-r--r-- 1 ubuntu www-data6871 Dec 16 17:50 access.log.2
-rw-r--r-- 1 ubuntu www-data5122 Dec 16 17:50 access.log.1
-rw-r--r-- 1 ubuntu www-data   11165 Dec 16 17:50 access.log.4
-rw-r--r-- 1 ubuntu www-data1718 Dec 16 17:50 access.log
-rw-r--r-- 1 ubuntu www-data2905 Dec 16 17:50 access.log.6
total 9864
-rw-r--r-- 1 ubuntu www-data 911 Dec 16 17:50 access.log.7
-rw-r--r-- 1 ubuntu www-data8921 Dec 16 17:50 access.log.6
-rw-r--r-- 1 ubuntu www-data   15460 Dec 16 17:50 access.log
-rw-r--r-- 1 ubuntu www-data   10313 Dec 16 17:51 access.log.2
-rw-r--r-- 1 ubuntu www-data7699 Dec 16 17:51 access.log.3
-rw-r--r-- 1 ubuntu www-data   21471 Dec 16 17:51 access.log.4
-rw-r--r-- 1 ubuntu www-data6874 Dec 16 17:51 access.log.5
-rw-r--r-- 1 ubuntu www-data   11989 Dec 16 17:51 access.log.1
total 9892
-rw-r--r-- 1 ubuntu www-data 911 Dec 16 17:50 access.log.7
-rw-r--r-- 1 ubuntu www-data7699 Dec 16 17:51 access.log.3
-rw-r--r-- 1 ubuntu www-data   12849 Dec 16 17:51 access.log.1
-rw-r--r-- 1 ubuntu www-data   14936 Dec 16 17:51 access.log.6
-rw-r--r-- 1 ubuntu www-data   30068 Dec 16 17:51 access.log.4
-rw-r--r-- 1 ubuntu www-data   19755 Dec 16 17:51 access.log
-rw-r--r-- 1 ubuntu www-data   11170 Dec 16 17:51 access.log.5
-rw-r--r-- 1 ubuntu www-data   15466 Dec 16 17:51 access.log.2
total 9932

Is this a consequence of the gunicorn --workers=8?

Does logging.handlers.RotatingFileHandler not work with gunicorn workers?

I tried --worker-class=gevent as well with the same result.

--
components: Extension Modules
messages: 283511
nosy: Bruce Edge
priority: normal
severity: normal
status: open
title: logging.handlers.RotatingFileHandler rotation broken under gunicorn
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> If sender sends a lot of empty lines and file is not None, LF or CRLF is 
> stripped from lines

Oh, I missed that. Maybe give a weight of 4 to 8 bytes or even more to a line, 
this value being added to the bytes count whether the line is empty or not.
Do you have another suggestion ?

--

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

I responded to your last review Serhiy, but the psf mail system reports a 
delivery failure, so you may have missed the notification as well as the other 
reviewers.

--

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If sender sends a lot of empty lines and file is not None, LF or CRLF is 
stripped from lines, and len(line) is 0. Every empty line increases the size of 
the lines list by 4 or 8 bytes. Since count is not changed, the loop is not 
bounded. Every LF byte sent by malicious sender increases memory consumption by 
4 or 8 bytes.

--

___
Python tracker 

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



[issue28949] Stdlib modules disappear from file system

2016-12-17 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Throughout the week, I've not experienced this issue again. Perhaps the 
reinstall of Dropbox corrected some transient condition. Or perhaps my system 
was in some environment where it was particularly sensitive on Monday but has 
since returned to the status quo. In any case, I'm going to close this issue 
until such a time that it occurs again.

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



[issue13051] Infinite recursion in curses.textpad.Textbox

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I can reproduce the second bug too.

Here is updated patch. The main difference is that it preserves maxx and maxy 
attributes and support them up to date.

--
Added file: http://bugs.python.org/file45945/textpad-recursion-fix2.patch

___
Python tracker 

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



[issue28816] Document if zipimport can respect import hooks to load custom files from zip.

2016-12-17 Thread Brett Cannon

Brett Cannon added the comment:

The cutoff for 3.6.0 has passed, but documentation patches can still go in for 
3.6.1 (and 3.5.3).

--

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-17 Thread Robert Xiao

Robert Xiao added the comment:

I see your point, Nick. Can I offer a counterpoint?

Most of the string parsers operate only on relatively short inputs, like 
numbers. Numbers in particular are rarely written with inner spaces, so it 
makes sense not to ignore internal whitespaces.

On the other hand, hexadecimal data can be very long, and is often formatted 
with spaces and newlines. For example, the default output of `xxd -p`, a format 
quite suitable for copy-paste, looks like this:

cffaedfe0701038002001500d80885802100
190048005f5f504147455a45524f
0100
190018035f5f54455854
01909d01

It would be desirable to write something like

blob = bytes.fromhex('''
cffaedfe0701038002001500d80885802100
190048005f5f504147455a45524f
0100
190018035f5f54455854
01909d01
''')

and not have to worry about sticking in some whitespace remover, like this:

blob = bytes.fromhex(''.join('''
cffaedfe0701038002001500d80885802100
190048005f5f504147455a45524f
0100
190018035f5f54455854
01909d01
'''.split()))

or removing the newlines in the source code, which impacts readability. 

Similar kinds of whitespaced output (sometimes with spaces between octets, 
words or dwords, sometimes with tabs between 8-16 byte groups, sometimes with 
newlines between groups, etc.) can be found in the wild and from the "hex" 
clipboard output from various applications.

We can already have newlines and other whitespace with base64, which is in 
principle quite similar:

blob = base64.b64decode('''
z/rt/gcAAAEDAACAAgAAABUAAADYCAAAhYAhAAAZSF9fUEFHRVpFUk8A
AAABAAAZGAMAAF9fVEVYVAAA
AQCQnQEAkJ0BAAcFCQBfX3Rl
eHQAX19URVhUAAALAAABRCF5AQAACwAACAAA
''')

so I think it makes sense to support other whitespaces in fromhex. I'm happy to 
reconsider if there's a strong argument against adding this convenience.

--

___
Python tracker 

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



[issue28951] re.flags not documented in Module Contents as promised.

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

(Please delete the message you are replying to when responding to bug tracker 
emails.)

I think a section heading would be good (three subheads under module contents: 
functions, flags, and exceptions).  I'm less in favor of alphabetical entries 
for synonyms.  We'll see what others think.

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

OK, that makes sense.  Patch looks good to me.

--

___
Python tracker 

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



[issue14364] Argparse incorrectly handles '--' as argument to option

2016-12-17 Thread paul j3

paul j3 added the comment:

I've copied 'dbldash.patch' over from http://bugs.python.org/issue13922.  I 
mistakenly added it to a closed issue.

The patch is old, and should be revised.  It is also missing tests for this 
'--opt=--' case, even though it solves it.   

I also reference this patch in http://bugs.python.org/issue9571, which tries to 
refine dbldash handling for PARSER, REMAINDER nargs.

I'm raising the priority on this because the issue has a come up a couple of 
times on Stackoverflow:

http://stackoverflow.com/questions/40685320/python-argparse-with-as-the-value

--
keywords: +needs review
priority: normal -> high
versions: +Python 3.6, Python 3.7 -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file45944/dbldash.patch

___
Python tracker 

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



[issue28996] wcscoll is broken on Android and test_locale fails

2016-12-17 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

I'm afraid that the sentence "wcscoll/wcsxfrm have known bugs" is misleading 
for people who are not quite familiar with Android. The actual cause is that 
BioniC's setlocale() behaves differently than other platforms. Most 
implementations returns NULL if en_US.UTF-8 is not available, but BioniC 
returns C.UTF-8. I guess it's better to add some comments for the real cause on 
Android.

--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes this inconsistency.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file45943/bytes-format-oct-alt-zero.patch

___
Python tracker 

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



[issue28972] Document all "python -m" utilities

2016-12-17 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm neutral on this idea.  I would much rather focus on making sure that the 
various modules (such as pdb or tarfile) which have useful command-line 
functionality document that clearly and uniformly, but as part of each module's 
library docs.

I don't think that a list of all modules that have such behavior really belongs 
in the stdlib docs, but if someone wants to add it and keep it up to date I 
won't object.  Just understand that whatever is documented must preserve some 
sort of backwards compatibility.  And don't repeat the same information in two 
places.

Maybe the blog post that started this is actually enough?  Or if something more 
official is needed, perhaps a how-to document?

--

___
Python tracker 

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



[issue28996] wcscoll is broken on Android and test_locale fails

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Here is a patch that skips test_strcoll_with_diacritic and 
test_strxfrm_with_diacritic.

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

___
Python tracker 

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



[issue28996] wcscoll is broken on Android and test_locale fails

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Both strcoll() and strxfrm() are broken (character 'à' unicode code point is 
'e0'):

>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
'C.UTF-8'
>>> locale.strcoll('\u00e0', 'b')
1
>>> locale.strxfrm('\u00e0') < locale.strxfrm('b')
False

The correct results are -1 and True.

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

On 17 December 2016 at 20:15, Marc-Andre Lemburg 
wrote:

> Another use case to consider is embedding the Python
> interpreter in another application. In such situations,
> the C locale will usually already be set by the main
> application and it may conflict with the LANG or other
> locale env var settings, since the user may have chosen
> to use a different locale in the context of the application.
>

Aye, that's the origin of the split proposal to only emit a warning in the
shared library (since CPython might only be a piece of a larger
application), but implement actual locale coercion (by overriding LANG and
LC_ALL in the process environment) in the command line app's main()
function (as in that case we know CPython *is* the application).

The hard part of writing the PEP isn't really going to be explaining the
proposal itself (I expect it to be around a 20 line patch to the C code) -
it's going to be explaining why all the other possibilities we've
considered over the years don't work, and why we (as in the Fedora Python
SIG) think this one actually stands a chance of working properly :)

--

___
Python tracker 

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



[issue28951] re.flags not documented in Module Contents as promised.

2016-12-17 Thread kevin

kevin added the comment:

Oh, and on the alphabetized list, I suggest NOT listing synonyms together,
but just mark some as "synonym for X" and listing them all alphabetically
(according to "en" collation, not "C" so upper- and lower-case sort
together, not separately).

On Sat, Dec 17, 2016 at 6:13 AM, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> Making a 'flags' subheading in module contents would be reasonable.
> Alternatively we could just drop that parenthetical, since the descriptions
> for each flag are themselves cross-linked.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

-- 
Kevin O'Gorman
#define QUESTION ((bb) || (!bb))   /* Shakespeare */

Please consider the environment before printing this email.

--
Added file: http://bugs.python.org/file45941/unnamed

___
Python tracker 

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



[issue28951] re.flags not documented in Module Contents as promised.

2016-12-17 Thread kevin

kevin added the comment:

Well, my original problem is that I wanted to find out what the flags did
and could not find any pointer in the table of contents.  I think they
deserve either really good cross-references, or a heading in the contents.
And a non-confusing alphabetized list, if they're going to be mixed in with
other module contents.

On Sat, Dec 17, 2016 at 6:13 AM, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> Making a 'flags' subheading in module contents would be reasonable.
> Alternatively we could just drop that parenthetical, since the descriptions
> for each flag are themselves cross-linked.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

-- 
Kevin O'Gorman
#define QUESTION ((bb) || (!bb))   /* Shakespeare */

Please consider the environment before printing this email.

--
Added file: http://bugs.python.org/file45940/unnamed

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

My recollection is that fromhex() ignores spaces to account for particularly 
common ways of formatting hex numbers as space separated groups:

"CAFE F00D"
"CAFEF00D CAFEF00D CAFEF00D"
"CA FE F0 0D"
etc

Those show up even in structured hexadecimal data (like hex editor output and 
memory dumps in log files).

That recollection is supported by the example and specification of specifically 
"[0-9a-fA-F ]" in PEP 358 (https://www.python.org/dev/peps/pep-0358/) that 
guided Georg Brandl's initial implementation in 
http://bugs.python.org/issue1669379

Generally speaking, the type level string parsers *aren't* permissive when it 
comes to their whitespace handling - if they allow whitespace at all, it's 
usually only at the beginning or end, where it gets ignored (hence the PEP for 
3.6 to allow underscores in both numeric literals and in the numeric 
constructors).

=
>>> float(" 1.0")
1.0
>>> float("1.0 ")
1.0
>>> float("1 0")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: could not convert string to float: '1 0'
>>> float("1. 0")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: could not convert string to float: '1. 0'
>>> float("1 .0")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: could not convert string to float: '1 .0'
=

The general technique to strip whitespace from *any* input data before handing 
it to a constructor relies on str.translate:

=
>>> import string
>>> _del_whitespace = str.maketrans('', '', string.whitespace)
>>> def clean_whitespace(text):
... return text.translate(_del_whitespace)
... 
>>> clean_whitespace('CA FE\nF0\t0D')
'CAFEF00D'
=

(http://stackoverflow.com/questions/3739909/how-to-strip-all-whitespace-from-string
 also points out `"".join(text.split())` as a clever one liner for a similar 
outcome)

So I'm inclined to advise *against* making any changes here - the apparent 
benefit is more a symptom of the fact that there isn't an immediately obvious 
spelling of "strip all whitespace, including that between other characters, 
from this string" that can be readily applied as an initial filter on the 
incoming data.

(However, I do sometimes wonder if it would make sense to offer a 
"str.stripall()" that defaulted to removing all whitespace, rather than 
treating this purely as a particular use case for str.translate)

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is not documentation issue, but a bug in formatting octals in bytes.

>>> '%#07x' % 123
'0x0007b'
>>> b'%#07x' % 123
b'0x0007b'
>>> '%#07o' % 123
'0o00173'
>>> b'%#07o' % 123
b'000o173'
 ^

--
components: +Interpreter Core -Documentation
nosy: +ethan.furman, serhiy.storchaka
stage:  -> needs patch
type:  -> behavior
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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This patch defines a _MAXBYTES limit of 100 Mb. The limit is checked upon 
reading one line and also upon reading the multi-lines of the response to a 
user command.

--
Added file: http://bugs.python.org/file45939/nntplib_maxbytes.patch

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread woo yoo

woo yoo added the comment:

Make a slight change to my code, which becomes `b'%#07x' % 34`, the weird 
situation appears.

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

The documentation matches the behavior.  In this context "the first digit" is 
the 4.  The leading zeros are the pad fill.  Now, whether this is *useful* 
behavior or not is a separate question :)  And yes, the docs could be clarified 
on this point either way.

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



[issue28951] re.flags not documented in Module Contents as promised.

2016-12-17 Thread R. David Murray

R. David Murray added the comment:

Making a 'flags' subheading in module contents would be reasonable.  
Alternatively we could just drop that parenthetical, since the descriptions for 
each flag are themselves cross-linked.

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread woo yoo

woo yoo added the comment:

The link is 
https://docs.python.org/3.5/library/stdtypes.html#printf-style-bytes-formatting

--

___
Python tracker 

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



[issue29000] Not matched behavior within printf style bytes formatting

2016-12-17 Thread woo yoo

New submission from woo yoo:

Per the documentation,"The alternate form causes a leading octal specifier 
('0o') to be inserted before the first digit", However the actual behavior 
didn't conform to the principle.

Code:
>>>b'%#07o' % 34

Output: b'o42'

--
assignee: docs@python
components: Documentation
messages: 283485
nosy: docs@python, woo yoo
priority: normal
severity: normal
status: open
title: Not matched behavior within printf style bytes formatting
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



[issue9770] curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09)

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Most issues was fixed in issue27079. Except handling negative integers. 
Following patch fixes the latter issue.

--
nosy: +serhiy.storchaka
stage:  -> patch review
versions: +Python 3.6, Python 3.7 -Python 3.4
Added file: http://bugs.python.org/file45938/curses-ascii-negative.patch

___
Python tracker 

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



[issue28999] Use Py_RETURN_NONE and like

2016-12-17 Thread STINNER Victor

STINNER Victor added the comment:

py_return.patch LGTM.

--

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-17 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 17.12.2016 08:56, Nick Coghlan wrote:
> 
> Making an explicit note of this so I remember to mention it in the draft PEP: 
> one of the biggest problems that arises in any attempt at a Python-only 
> solution to overriding the locale is that we can end up disagreeing with 
> C/C++ extensions, and this is *especially* a problem when sharing a process 
> with GUI frameworks like Tcl/Tk, Qt, and GTK (since they tend to read the 
> process-wide settings, rather than querying anything that CPython configures 
> during normal operation).

Another use case to consider is embedding the Python
interpreter in another application. In such situations,
the C locale will usually already be set by the main
application and it may conflict with the LANG or other
locale env var settings, since the user may have chosen
to use a different locale in the context of the application.

--

___
Python tracker 

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



[issue28999] Use Py_RETURN_NONE and like

2016-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Resulting patch is huge. I don't think it can be pushed.

--
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file45937/py_return.patch

___
Python tracker 

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



[issue28999] Use Py_RETURN_NONE and like

2016-12-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In the comment to issue28765 patch Victor suggested to replace 
"Py_INCREF(Py_None); return Py_None;" with "Py_RETURN_NONE;".

Here is a Coccinelle [1] semantic patch that replaces all returns of new 
references to None, True or False with macros Py_RETURN_NONE, Py_RETURN_TRUE or 
Py_RETURN_FALSE correspondingly.

[1] http://coccinelle.lip6.fr/

--
components: Extension Modules, Interpreter Core
files: py_return.cocci
messages: 283480
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use Py_RETURN_NONE and like
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45936/py_return.cocci

___
Python tracker 

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



[issue28998] Unifying Long Integers and Integers in 2.7

2016-12-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue28998] Unifying Long Integers and Integers in 2.7

2016-12-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Since implementing PEP 237 (Unifying Long Integers and Integers) in Python 2.4 
int and long instances became interchangeable. Virtually any function that 
needs an integer, accepts both int and long. But there are few places where 
only int is accepted. Since it is easy unintentionally convert int to long (add 
and subtract large int, or add 0L), this can lead to subtle errors in rare 
circumstances.

Proposed patch makes few places that accepted only int accepting long too. This 
mainly is changing isinstance(x, int) to isinstance(x, (int, long)).

--
components: Extension Modules, Library (Lib)
messages: 283479
nosy: benjamin.peterson, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Unifying Long Integers and Integers in 2.7
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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-17 Thread INADA Naoki

INADA Naoki added the comment:

Before Python 3.6, instance.__dict__.pop(key) didn't trigger this.
But there are many way to trigger this. This bug is live from 3.3.
This script reproduce this issue on Python 3.5.

class C: pass
a = C()
a.a = 1
while True:
a.__dict__.popitem()  # convert split table into combined table.
a.a = 1   # convert combined table into split table again.

--

___
Python tracker 

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



[issue26865] Meta-issue: support of the android platform

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

issue #28996: wcscoll is broken on Android and test_locale fails
issue #28997: test_readline.test_nonascii fails on Android

--
dependencies: +test_readline.test_nonascii fails on Android, wcscoll is broken 
on Android and test_locale fails

___
Python tracker 

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



[issue28997] test_readline.test_nonascii fails on Android

2016-12-17 Thread Xavier de Gaye

New submission from Xavier de Gaye:

test_nonascii has been implemented in issue 16182.

The error message:
==
FAIL: test_nonascii (test.test_readline.TestReadline)
--
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_readline.py", line 
203, in test_nonascii
self.assertIn(b"text 't\\xeb'\r\n", output)
AssertionError: b"text 't\\xeb'\r\n" not found in 
bytearray(b"^A^B^B^B^B^B^B^B\t\tx\t\r\n[\\303\\257nserted]|t\x07\x08\x08\x08\x08\x08\x08\x08\x07\x07xrted]|t\x08\x08\x08\x08\x08\x08\x08\x07\r\nresult
 \'[\\xefnsexrted]|t\'\r\nhistory \'[\\xefnsexrted]|t\'\r\n")

--

--
assignee: xdegaye
components: Tests
messages: 283476
nosy: xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: test_readline.test_nonascii fails on Android
type: behavior
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



[issue28596] on Android _bootlocale on startup relies on too many library modules

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Closing the issue. Thanks for the patch Chi Hsuan Yen.

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



[issue28996] wcscoll is broken on Android and test_locale fails

2016-12-17 Thread Xavier de Gaye

New submission from Xavier de Gaye:

These failures happen now that issue 28596 has been fixed and that 
locale.getpreferredencoding(False) returns 'UTF-8'.

==
FAIL: test_strcoll_with_diacritic (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 
362, in test_strcoll_with_diacritic
self.assertLess(locale.strcoll('à', 'b'), 0)
AssertionError: 1 not less than 0

==
FAIL: test_strxfrm_with_diacritic (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 
365, in test_strxfrm_with_diacritic
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
AssertionError: 'à' not less than 'b'

--

--
assignee: xdegaye
components: Tests
messages: 283474
nosy: xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: wcscoll is broken on Android and test_locale fails
type: behavior
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



[issue26928] _bootlocale imports locale at startup on Android, causing test_site to fail

2016-12-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Closing as invalid, it is useful to have the test failing on platforms that do 
not have CODESET and detect that too many modules are imported on startup. For 
Android, this problem is fixed in issue 28596.

--
resolution:  -> not a bug
stage: commit 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



[issue28596] on Android _bootlocale on startup relies on too many library modules

2016-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1756beed417c by Xavier de Gaye in branch 'default':
Issue #28596: The preferred encoding is UTF-8 on Android.
https://hg.python.org/cpython/rev/1756beed417c

--

___
Python tracker 

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