[issue29201] Python 3.6 not working within VS 2015

2017-01-07 Thread Steve Dower

Steve Dower added the comment:

This is a bug in Visual Studio, not Python.

There is an RC release of the Python support with a fix for this bug is 
available at https://github.com/Microsoft/PTVS on the releases page, and an 
actual update will appear in notifications within a couple of weeks. VS 2017 is 
not affected by the bug and supports Python 3.6 well.

--
resolution:  -> third party
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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Jiajun Huang

Jiajun Huang added the comment:

thanks for reply :)

2017年1月8日星期日,Roundup Robot  写道:

>
> Roundup Robot added the comment:
>
> New changeset 2e7e91785306 by Raymond Hettinger in branch 'default':
> Issue #29200: Fix test to use self.assertEqual instead of py.test style
> tests
> https://hg.python.org/cpython/rev/2e7e91785306
>
> --
>
> ___
> Python tracker >
> 
> ___
>

--

___
Python tracker 

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



[issue9182] document “--” as a way to distinguish option w/ narg='+' from positional argument in argparse

2017-01-07 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue28815] test_socket fails if /proc/modules is existent but not readable

2017-01-07 Thread Martin Panter

Changes by Martin Panter :


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



[issue29195] Get rid of supporting outdated wrong keyword arguments in re methods

2017-01-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It's too bad that "pattern" lost out to the less informative "string".

+1 for finishing the work and applying this patch.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29081] time.strptime() return wrong result

2017-01-07 Thread Jeff Knupp

Jeff Knupp added the comment:

I believe this is working as intended. Remember, the '%w' directive instructs 
strptime to consider 0 to be Sunday, while tm_wday considers 0 Monday. In 2016, 
the %W directive means that the first week (week #1) starts on Monday, January 
4th. If you go 52 weeks forward from the 4th, you get to Monday, December 26th. 
By asking for day 0 (%w=0), you want the *Sunday* of the 52nd week *from the 
first Monday of the year*. Since Monday is day 0 of that week, you want the 
Sunday that is 6 days from the 26th, or Jan 1, 2017.

One can certainly argue that tm_yday is documented to return an integer between 
[0,366] and thus we should never see 367, but it's the correct value given your 
input. The only other choice would be to raise an exception, which definitely 
shouldn't happen since the values you entered clearly match the format string 
spec.

Perhaps the docs should be updated, but when you consider that %W goes from 
[0,53], tm_yday can go well past 366 and still represent a semantically valid 
value.

--
nosy: +jeffknupp

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e7e91785306 by Raymond Hettinger in branch 'default':
Issue #29200: Fix test to use self.assertEqual instead of py.test style tests
https://hg.python.org/cpython/rev/2e7e91785306

--

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

To honor your report, I've added a test for this functionality.

--

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 52d3cbcf546f by Raymond Hettinger in branch 'default':
Issue #29200: Add test for lru cache only calling __hash__ once
https://hg.python.org/cpython/rev/52d3cbcf546f

--
nosy: +python-dev

___
Python tracker 

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



[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2017-01-07 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2017-01-07 Thread Nick Coghlan

Nick Coghlan added the comment:

The complexity you're hitting here is the main reason I'm a fan of creating a 
dedicated library for dealing with these problems, rather than trying to handle 
them directly on the builtins.

Given a bufferlib module, for example, you could have a higher level API like:

def snapshot(source, *, result_type=bytes):
...

That handled any source object that supported the buffer protocol, and any 
target type that accepted a memoryview instance as input to the constructor.

# Default bytes snapshot
data = snapshot(original)

# Mutable snapshot without copying and promptly releasing the view
data = snapshot(original, result_type=bytearray)

The start/stop/step or length+offset question could be handled at that level by 
allowing both, but also offering lower level APIs with less argument processing 
overhead:

def snapshot_slice(source, start, stop, step=1, *, result_type=bytes):
...

def snapshot_at(source, *, offset=0, count=None, result_type=bytes):
...

--

___
Python tracker 

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



[issue29201] Python 3.6 not working within VS 2015

2017-01-07 Thread Edward Laier

New submission from Edward Laier:

I installed Python 3.6 on my Microsoft server 2016 , running VS 2015 Community. 
I tried the path to Python Environment, then auto-detect, VS crashes and then 
when it restarts it will have the "+ Custom" grayed out. Where I then have to 
remove the key to ungray it as mentioned here  
[link](https://stackoverflow.com/questions/40430831/vs-2015-python-environments-greyed-out)
 
Trying to put in all the variables for the environment doesn't work as 3.6 
isn't even an option in the version drop-box for VS. The only option I see for 
now until this is fixed is removing 3.6 and installing 3.5

--
components: Windows
messages: 284957
nosy: Edward Laier, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python 3.6 not working within VS 2015
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2017-01-07 Thread INADA Naoki

INADA Naoki added the comment:

You're right!  How difficult working with memoryview!

> The memoryview constructor could take start, stop, and step keyword-only 
> arguments to avoid having to immediately slice a new view.

Maybe, memoryview.to_bytes() is better place to add such options.

memoryview(x) can accept multi dimensional arrays, and itemsize can be >=1.
It's too complex when working with byte sequence.

--

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2017-01-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Reviewing Inada-san's latest version of the patch, we seem to be in a somewhat 
hybrid state where:

1. The restriction to only being used with seekable() streams if there is 
currently unread data in the read buffer is in place

2. We don't actually call seek() anywhere to set the stream back to the 
beginning of the file. Instead, we try to shuffle data out of the old decoder 
and into the new one.

I'm starting to wonder if the best option here might be to attempt to make the 
API work for arbitrary codecs and non-seekable streams, and then simply accept 
that it may take a few maintenance releases before that's actually true. If we 
decide to go down that path, then I'd suggest the follow stress test:

- make a longish test string out of repeated copies of "ℙƴ☂ℌøἤ"
- pick a few pairs of multibyte non-universal/universal encodings for use with 
surrogateescape and strict as their respective error handlers (e.g. ascii/utf8, 
ascii/utf16le, ascii/utf32, ascii/shift_jis, ascii/iso2022_jp, ascii/gb18030, 
gbk/gb18030)
- for each pair, make the test data by encoding from str to bytes with the 
relevant universal encoding
- switch the encoding multiple times on the same stream at different points

Optionally:

- extract "codecs._switch_decoder" and "codecs._switch_encoder" helper 
functions to make this all a bit easier to test and debug (with a Python 
version in the codecs module and the C version accessible via the _codecs 
modules)

That way, confidence in the reliability of the feature (including across Python 
implementations) can be based on the strength of the test cases covering it.

--

___
Python tracker 

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2017-01-07 Thread Eryk Sun

Eryk Sun added the comment:

Isn't the proposed workaround also relying on CPython reference counting to 
immediately deallocate the sliced view? It fails if I keep a reference to the 
sliced view:

byteslike = bytearray(b'abc')

with memoryview(byteslike) as m1:
m2 = m1[1:]
bs = bytes(m2)
 
>>> byteslike += b'd'
Traceback (most recent call last):
  File "", line 1, in 
BufferError: Existing exports of data: object cannot be re-sized

It seems to me that it should be written as follows:

with memoryview(byteslike) as m1:
with m1[1:] as m2:
bs = bytes(m2)

>>> byteslike += b'd'
>>> byteslike
bytearray(b'abcd')

The memoryview constructor could take start, stop, and step keyword-only 
arguments to avoid having to immediately slice a new view.

--
nosy: +eryksun

___
Python tracker 

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



[issue28815] test_socket fails if /proc/modules is existent but not readable

2017-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a417e160b34 by Martin Panter in branch '3.5':
Issue #28815: Use new exception subclasses
https://hg.python.org/cpython/rev/5a417e160b34

New changeset 401e70317976 by Martin Panter in branch '3.6':
Issue #28815: Merge test tweak from 3.5
https://hg.python.org/cpython/rev/401e70317976

New changeset 82fb37281954 by Martin Panter in branch 'default':
Issue #28815: Merge test tweak from 3.6
https://hg.python.org/cpython/rev/82fb37281954

--

___
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

2017-01-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Uploaded one last version of the patch implementing the previous PEP 538 
design. This refactors the test cases so they systematically cover 4 cases that 
we expect to be reported as "the C locale":

- LC_ALL, LC_CTYPE, and LANG all empty
- one of them set to "C", others empty
- one of them set to "POSIX", others empty
- one of them set to an unknown locale, others empty

The next version of the patch will update it to match the latest draft of the 
PEP (PYTHONCOERCECLOCALE, different message wording, etc)

--
Added file: 
http://bugs.python.org/file46205/pep538_coerce_legacy_c_locale_v3.diff

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry, but I think you've missed the point of _HashedSeq.  The hash() is called 
no more than once per instance, not once per instance creation.

>>> from functools import _HashedSeq
>>> from unittest.mock import Mock
>>> test_tup = 1, 2, 3, "hello", "world"
>>> hash_func = Mock(return_value=999)
>>> hs = _HashedSeq(test_tup, hash=hash_func)
>>> hash(hs)
999
>>> hash(hs)
999
>>> hash(hs)
999
>>> hash_func.call_count
1

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



[issue15216] Support setting the encoding on a text stream after creation

2017-01-07 Thread INADA Naoki

INADA Naoki added the comment:

Updated the patch for default branch.

--
versions: +Python 3.7 -Python 3.6
Added file: http://bugs.python.org/file46204/set_encoding-7.patch

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Jiajun Huang

New submission from Jiajun Huang:

the class definition:

class _HashedSeq(list):
""" This class guarantees that hash() will be called no more than once
per element.  This is important because the lru_cache() will hash
the key multiple times on a cache miss.

"""

__slots__ = 'hashvalue'

def __init__(self, tup, hash=hash):
self[:] = tup
self.hashvalue = hash(tup)

def __hash__(self):
return self.hashvalue

and I've test for it:

In [1]: from functools import _HashedSeq

In [2]: from unittest.mock import Mock

In [3]: test_tup = 1, 2, 3, "hello", "world"

In [4]: hash_func = Mock()

In [5]: _HashedSeq(test_tup, hash=hash_func)
Out[5]: [1, 2, 3, 'hello', 'world']

In [6]: _HashedSeq(test_tup, hash=hash_func)
Out[6]: [1, 2, 3, 'hello', 'world']

In [7]: _HashedSeq(test_tup, hash=hash_func)
Out[7]: [1, 2, 3, 'hello', 'world']

In [8]: hash_func.call_count
Out[8]: 3

the hash function had been called 3 times rather than 1.

--
components: Library (Lib)
messages: 284949
nosy: Jiajun Huang
priority: normal
severity: normal
status: open
title: is it a bug in `functools._HashedSeq`
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



[issue29199] test_regrtest fails if PCBuild directory doesn't exist

2017-01-07 Thread ppperry

Changes by ppperry :


--
type:  -> behavior

___
Python tracker 

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



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

Other tests are skipped if libc_name is None, so your assertion is inconsistent.

FTR there are reports open about problems with bootstrap files like asdl_c.py, 
e.g. Issue 28143 proposing to port that file to Python 3, and Issue 23404 about 
the future of “make touch”.

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue29198] AsyncGenerator is missing from typing

2017-01-07 Thread Jelle Zijlstra

Changes by Jelle Zijlstra :


Added file: http://bugs.python.org/file46203/asyncgenerator2.patch

___
Python tracker 

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



[issue29199] test_regrtest fails if PCBuild directory doesn't exist

2017-01-07 Thread ppperry

Changes by ppperry :


--
components: +Tests

___
Python tracker 

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



[issue29199] test_regrtest fails if PCBuild directory doesn't exist

2017-01-07 Thread ppperry

New submission from ppperry:

==
ERROR: test_pcbuild_rt (test.test_regrtest.ProgramsTestCase)
--
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 
564, in test_pcbuild_rt
self.run_batch(script, *rt_args, *self.regrtest_args, *self.tests)
  File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 
539, in run_batch
proc = self.run_command(args)
  File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 
436, in run_command
**kw)
  File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in 
__init__
restore_signals, start_new_session)
  File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in 
_execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

--
messages: 284947
nosy: ppperry
priority: normal
severity: normal
status: open
title: test_regrtest fails if PCBuild directory doesn't exist
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



[issue29180] skip tests that raise PermissionError in test_os (non-root user on Android)

2017-01-07 Thread Berker Peksag

Berker Peksag added the comment:

Are you planning to use test.support.os_link() to fix other tests in near 
future? If test_os is the only user of the helper, I'd say let's keep it in 
Lib/test/test_os.py for now. test.support is already big enough and it would be 
better not to put every snippet in it :)

If there are other tests that can benefit from using it, the patch looks good 
to me.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue21242] Generalize configure check for working Python executable

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

It is still not clear what change you were proposing. Perhaps factor out the 
common code for ADSLGEN and OPCODEHGEN? If so, that has been done as part of 
Issue 26662 in 3.5+.

--
nosy: +martin.panter
superseder:  -> configure/Makefile doesn't check if "python" command works, 
needed to build Objects/typeslots.inc

___
Python tracker 

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



[issue28701] Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString

2017-01-07 Thread Stefan Krah

Stefan Krah added the comment:

For the record: This is all that happened in decimal if a) you
pass a legacy string and b) force _PyUnicode_Ready() to throw
a MemoryError:

>>> from decimal import *
>>> import _testcapi
>>> context = Context()
>>> traps = _testcapi.unicode_legacy_string('traps')
>>> getattr(context, traps)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError



Both a) and b) are not trivial to accomplish at all and the result
is completely benign.

--
nosy: +skrah

___
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

2017-01-07 Thread Sworddragon

Sworddragon added the comment:

> $ cat badfilename.py 
> badfn = "こんにちは".encode('euc-jp').decode('utf-8', 'surrogateescape')
> print("bad filename:", badfn)
>
> $ PYTHONIOENCODING=utf-8:backslashreplace python3 badfilename.py 
> bad filename: \udca4\udcb3\udca4\udcf3\udca4ˤ\udcc1\udca4\udccf
>
> $ PYTHONIOENCODING=utf-8:surrogateescape python3 badfilename.py 
> bad filename: �ˤ���

The first example is still readable (but effectively for an user not so much) 
while the second example appears to be not readable anymore at all. But the 
second example is actually technically still readable and there is no data 
loss, isn't it? As in this case it would probably not speak against 
surrogateescape for sys.stderr in UTF-8 non-strict mode. Otherwise 
backslashescape might be indeed the better choice.


I have thought about this a bit more and in case we go PEP 538 with keeping 
strict errors more or less the old way there might be another solution that 
could improve the overall issue: print() could get an option to allow changing 
the error handler on demand (with 'strict' still being the default).

Most things that I do output with print() are deterministic or optional and not 
important application data. Being able to print this information without caring 
for de-/encoding errors would mitigate this issue. In case application data is 
being printed where data loss is not desired exceptions can still be thrown.

--

___
Python tracker 

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



[issue29070] Integration tests for pty.spawn on Linux and all other platforms

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

I would prefer to commit Chris’s fix for BSDs (Issue 26228) with a regression 
test. I can explain in the commit message who contributed to which part, or do 
two separate commits if you prefer. But the point is to add the test with the 
fix. I’m not going to commit the test on its own, because we know it will fail.

Even in Lib/test/test_pty.py, it looks like the two patches will collide. I was 
hoping you could combine the patches, or supply a set of patches that are 
tested and compatible. I don’t have OS X or BSD so I have to rely on you and 
the buildbots to confirm that a patch doesn’t break any tests.

I haven’t looked too closely regarding the slow tests, but another option is 
use the “cpu” resource to mark the test as being slow.

I realized that PtyWhiteBoxIntegrationTermiosTest is a reasonable test for the 
termios module, so it is beneficial. Though it may have been simpler to write 
it using pty.openpty(), avoiding an extra thread that just copies data between 
other threads.

--

___
Python tracker 

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



[issue29167] Race condition in enum.py:_decompose()

2017-01-07 Thread Ethan Furman

Ethan Furman added the comment:

Thanks.  I'll go through and audit all my dictionary iterations.

--
nosy: +barry, eli.bendersky

___
Python tracker 

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



[issue29177] skip tests of test_logging when bind() raises PermissionError (non-root user on Android)

2017-01-07 Thread Vinay Sajip

Vinay Sajip added the comment:

Thanks for the improvements to my patch. The 03-version 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



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

2017-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

I agree that it would just be confusing if the Python 3 docs were to explain 
Python 2 specific things.  Maybe this should be explained in the mypy docs (or 
maybe it's really a mypy bug).  Can you open an issue there?

--
nosy: +gvanrossum
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue29198] AsyncGenerator is missing from typing

2017-01-07 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue29181] skip tests that raise PermissionError in test_tarfile (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> Why os.link() is failed? If hard links are not supported on Android, 
> shouldn't os.link be not implemented?

Android has a restrictive security model based on SELinux [1].

With the Android adb shell on the emulator at API level 24:

$ >foo
$ ln foo bar
ln: cannot create hard link from 'foo' to 'bar': Permission denied
$ su
# ln foo bar
# ls -li foo bar
15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 bar
15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 foo

Here is the Android commit message that does not grant hard link capabilities 
by default:
https://android.googlesource.com/platform/external/sepolicy/+/85ce2c7

[1] https://source.android.com/security/selinux/

--

___
Python tracker 

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



[issue29198] AsyncGenerator is missing from typing

2017-01-07 Thread Jelle Zijlstra

New submission from Jelle Zijlstra:

PEP 525 async generators weren't added to typing.py, probably by oversight.

I sent pull requests to typing and typeshed on GitHub to add an AsyncGenerator 
class and stub:
- https://github.com/python/typing/pull/346
- https://github.com/python/typeshed/pull/815

However, typing docs are not in GitHub, so I'm attaching a doc patch here.

--
components: Library (Lib)
files: asyncgenerator.patch
keywords: patch
messages: 284937
nosy: Jelle Zijlstra, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: AsyncGenerator is missing from typing
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46202/asyncgenerator.patch

___
Python tracker 

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



[issue29184] skip tests of test_socketserver when bind() raises PermissionError (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Patch attached.

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

___
Python tracker 

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



[issue29181] skip tests that raise PermissionError in test_tarfile (non-root user on Android)

2017-01-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why os.link() is failed? If hard links are not supported on Android, shouldn't 
os.link be not implemented? tarfile try to make a copy of the referenced file 
instead of a link if a link can't be created.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29174] 'NoneType' object is not callable in subprocess.py

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

The code in test.py is not realistic. It spawns children only to terminate them 
straight away, and you could easily reap each child after calling terminate(). 
You might have more influence with a realistic use case.

Victor has committed a fix for the “exception ignored” problem, so assuming it 
works, in the next release of Python it should be gone. You should still see a 
ResourceWarning if warnings are enabled, but I don’t think -Wignore would be 
necessary to suppress them; such warnings are disabled by default.

--

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

The user can access pipes and close them directly, or keep their own reference. 
I don’t think detach() should touch pipes, and __exit__() should probably 
continue to close them. Maybe call the method detach_pid() if that makes it 
clearer that pipes are unaffected.

For the Windows process handle, I suggest detach() should close it. I believe 
this would make Windows work like Unix when you set SIGCHLD to automatically 
reap children.

--

___
Python tracker 

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



[issue29180] skip tests that raise PermissionError in test_os (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Patch attached.

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

___
Python tracker 

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



[issue29181] skip tests that raise PermissionError in test_tarfile (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Patch attached.

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

___
Python tracker 

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



[issue29188] Backport random.c from Python 3.5 to Python 2.7

2017-01-07 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue23242] asyncio: Process must close the transport when the process exit

2017-01-07 Thread Alex Grönholm

Alex Grönholm added the comment:

Are you sure this has been fixed? The attached script reproduces the bug 100% 
reliably on my laptop.

--
Added file: http://bugs.python.org/file46198/read_subprocess.py

___
Python tracker 

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



[issue23242] asyncio: Process must close the transport when the process exit

2017-01-07 Thread Alex Grönholm

Changes by Alex Grönholm :


--
nosy: +alex.gronholm
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



[issue29188] Backport random.c from Python 3.5 to Python 2.7

2017-01-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I would prefer to use the "same code" (or almost) on all maintained
> versions of Python: 2.7, 3.5, 3.6 and 3.7. It should ease the
> maintenance for bugfixes and enhancements.

This is VERY far from our historical policy for backports.  Python 2.7 is 
supposed to be getting more stable over time (that is one of its chief 
virtues).  We don't want to risk the kind of mini-catastrophe that got 
published in 3.6 (issue29085).  

If you want to push for this, there needs to be a thorough discussion on 
python-dev (there are tons of possible backports that could be made if the 
rationale was "I would prefer to use the same code on all maintained versions").

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue29167] Race condition in enum.py:_decompose()

2017-01-07 Thread Simon Percivall

Simon Percivall added the comment:

Run this a couple of times (it fails for me the first time, but it's a race, so 
YMMV):

```
import enum
from concurrent.futures import ThreadPoolExecutor


class MyEnum(enum.IntFlag):
one = 1


with ThreadPoolExecutor() as executor:
print(list(executor.map(MyEnum.one.__or__, range(1000
```

An easy fix would be:

```
diff --git a/Lib/enum.py b/Lib/enum.py
index e79b0382eb..eca56ec3a7 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -846,7 +846,7 @@ def _decompose(flag, value):
 # check for named flags and powers-of-two flags
 flags_to_check = [
 (m, v)
-for v, m in flag._value2member_map_.items()
+for v, m in list(flag._value2member_map_.items())
 if m.name is not None or _power_of_two(v)
 ]
 members = []
```

--

___
Python tracker 

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



[issue29050] xml.etree.ElementTree in Python 3.6 is incompatible with defusedxml

2017-01-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-07 Thread Brett Cannon

Brett Cannon added the comment:

The error actually makes sense when you think about the fact that the module is 
being passed in by filename. That means Python has no clue what values to put 
in for the spec because Python literally exec()'s the file contents and stuffs 
it into a new module name __main__. There's no fancy attempt to construct a 
proper module from scratch like if you had used -m which does fill in the spec. 
And since importlib.reload() relies entirely on the module's spec to handle 
reloads it simply can't handle the `__spec__ == None` case that this is 
triggering.

IOW use `python3 -m reloader` and it will probably work. Closing this as "not a 
bug".

--
nosy: +brett.cannon
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



[issue29197] Remove os.path.splitunc()

2017-01-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch removes os.path.splitunc(). It is Windows specific and has been 
deprecated in 3.1. It is superseded by splitdrive() in 3.x and in 2.7 since 
2.7.8 (see issue21672).

--
components: Library (Lib)
files: remove_os_path_splitunc.patch
keywords: patch
messages: 284926
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Remove os.path.splitunc()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46197/remove_os_path_splitunc.patch

___
Python tracker 

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



[issue29196] Remove old-deprecated plistlib features

2017-01-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Seems many features of plistlib was deprecated from the start. The plistlib 
module was added in 2.6 and its code already contained deprecated features:

* The _InternalDict class is a dict subclass with implemented 
__getattr__/__setattr__/__delattr__ methods, but all these methods have been 
deprecated. Since deprecated methods shouldn't be used and they are not 
implemented in builting dict, _InternalDict can be replaced by builting dict.

* The Dict class has been deprecated. It doesn't used in the module. A user 
should use builting dict instead.

* The Plist class has been deprecated. It doesn't used in the module. A user 
should use module level functions instead of Plist methods.

It seems to me that all these classes can be removed. This doesn't break 
compatibility, since they were deprecated in 2.6. They are even not documented 
in 2.7.

--
components: Library (Lib)
files: plistlib_remove_deprecated_classes.patch
keywords: patch
messages: 284925
nosy: ronaldoussoren, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Remove old-deprecated plistlib features
type: enhancement
versions: Python 3.7
Added file: 
http://bugs.python.org/file46196/plistlib_remove_deprecated_classes.patch

___
Python tracker 

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



[issue29021] Custom functions in sqlite receive None on invalid UTF-8

2017-01-07 Thread Aviv Palivoda

Aviv Palivoda added the comment:

After looking more into the _pysqlite_set_result function fail in Ingo example 
I think this is the expected behavior. The PyUnicode_AsUTF8 fails but this is 
expected as the value is an invalid UTF-8.

--

___
Python tracker 

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



[issue29006] 2.7.13 _sqlite more prone to "database table is locked"

2017-01-07 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
nosy: +palaviv

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Stefan Krah

Stefan Krah added the comment:

I'm generally a little concerned about the way "bugs" are presented here 
recently:

In #28701 you write:

'Correctness. Since no caller checks the error of 
PyUnicode_CompareWithASCIIString(), it is incorrectly interpreted as "less 
then".'

This is just not true. When testing for equality "-1" is "not equal"
and an exception would follow anyway.

I'm also not happy with broad coccinelle patches that I see months later.

I'm not sure if you realize that other people's reputation is at
stake here. You label something as a bug (good for you), everyone
who reads your reports and commits think that a bug has been found,
which is not the case.

--

___
Python tracker 

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



[issue27603] Migrate IDLE context menu items to shell extension

2017-01-07 Thread Shane Smith

Shane Smith added the comment:

Would it be possible to allow the user to select whether they'd prefer a nested 
or flat context menu at install?  I believe it went to nested as a result of 
issue23546.

Unless there are a large number of installations (arbitrarily... perhaps 4 or 
more), the nested menu is a pain for a user like me who wants to open .py files 
in IDLE more than any other action.  (If I may quote the fifth line of The Zen 
of Python... "Flat is better than nested.")  With a little research, it was a 
fairly easy registry hack to de-nest the context menu.

Still, a lot of people don't like to mess around in the registry, and user 
choice is usually a good thing.  Thoughts?

--
nosy: +Shane Smith

___
Python tracker 

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



[issue29185] test_distutils fails on Android API level 24

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Patch attached.

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

___
Python tracker 

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



[issue29191] liblzma is missing from pcbuild.sln

2017-01-07 Thread Steve Dower

Steve Dower added the comment:

LGTM. Though as you say, it's probably easiest for one of us to go through each 
branch and use VS to get it right. I think both of those projects were added 
from other operating systems, so updating the sln wouldn't be so easy.

I'll get to it at some point unless someone else does. The merging necessary is 
going to make using patch files difficult.

--

___
Python tracker 

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



[issue29177] skip tests of test_logging when bind() raises PermissionError (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

issue-29177-02.diff is a modified version of the previous patch that uses 
support.unlink() instead of os.remove() to handle the failure occuring for a 
non-existent file
when the test is skipped because of Permission denied. With this patch 
test_logging is ok, and test_lib2to3 runs fine after test_logging.

issue-29177-03.patch adds the following modifications to the previous patches:
  * Catch only OSError: it is better not to catch programming errors as they 
may go unnoticed when the test is skipped.
  * Report the OSError in the skip message.
  * Reduce the scope of the try clause to just the code that uses system calls.
  * The cleanup done in setUp() by the previous patch in the except clause does 
not seem to be needed as the tearDown() method is invoked when the test is 
skipped.

--
Added file: http://bugs.python.org/file46193/issue-29177-02.diff

___
Python tracker 

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



[issue29177] skip tests of test_logging when bind() raises PermissionError (non-root user on Android)

2017-01-07 Thread Xavier de Gaye

Changes by Xavier de Gaye :


Added file: http://bugs.python.org/file46194/issue-29177-03.patch

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Stefan Krah

Stefan Krah added the comment:

To expand a little, you use the terminology "possible bugs". All I can
see is a double exception if PyUnicode_Compare() returns -1.

I think I did it on purpose because this function is speed sensitive and
no user will change a valid rounding mode *constant* to a string that
is not ready.

So getting a double exception after deliberately sabotaging the module
seems pretty benign to me. :)


Consider the decimal part rejected.

--

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In worst case ignoring an error can cause a mystical error later during 
executing an unrelated code or a crash in debug build. In both cases it is hard 
to find the location of the bug.

--
nosy: +haypo

___
Python tracker 

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



[issue14102] argparse: add ability to create a man page

2017-01-07 Thread Matt

Changes by Matt :


--
nosy: +matthewjohn

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Stefan Krah

Stefan Krah added the comment:

Also, if anyone changes the rounding-mode constants it is really their problem.

--

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Stefan Krah

Stefan Krah added the comment:

Quite honestly I prefer to do nothing. What is the worst that can happen?
A SystemError?

Not-ready unicode strings are an application bug.

--

___
Python tracker 

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2017-01-07 Thread INADA Naoki

INADA Naoki added the comment:

> I'm -1 if the intention is about easiness and efficiency. 

Do you +1 when adding it to stdlib (say "bufferlib")?

> Creating a memoryview is not cheap enough in such a case.

Actually speaking, it's 5 calls + 2 temporary memoriview.

1. creating memoryview.
2. call __enter__.
3. slicing memoryview
4. create bytes from it
5. call __exit__

It can be bottleneck very easily, when writing protocol parser like HTTP parser.

> About easiness to use, when a user considering such low level details, it's 
> reasonable to know memoryview and it needs to be released.

closing memoryview is not strict requirements in some cases.
When memoryview is created from immutable, relying to GC is safe.
That's why closing memoryview is easily forgotten.

> But if this API is added to simplify bytes(), I think it makes sense but it's 
> not only about adding a frombuffer().

Yes. See msg284813.
There are PEP 467 already to make bytes() simple.

But if PEP 467 is accepted, bytes() constructor is simple enough.
Adding `offset` and `length` keyword-only argument to bytes() make sense.

--

___
Python tracker 

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



[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-07 Thread R. David Murray

R. David Murray added the comment:

I don't think reloading __main__ is something we have any desire to support, 
but there may be something in this error sequence worth thinking about 
anyway...the error message isn't very clear as to what went wrong, even with 
the traceback.

What is your use case for reloading __main__?

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



[issue29174] 'NoneType' object is not callable in subprocess.py

2017-01-07 Thread ita1024

ita1024 added the comment:

> For this specific issue, the ResourceWarning is correct. I don't
understand the use case of explicitly turning this warning off on this
specific example?

No, on this specific example the child processes do terminate properly as the 
parent process terminate. There is no extra resource consumption so the warning 
is incorrect and annoying.

> If your output is flooded by ResourceWarning warnings, it's easy to
configure Python to ignore them. Example, simplest option: python3
-Wignore script.py. But you are only going to hide a real issue in
your code. ResourceWarning exists to help you to reduce your resource
consumption.

At the moment the outputs are flooded with "exception ignored" messages that 
show how well this was thought out. Asking users to add -Wignore options for 
perfectly legitimate applications also shows how much consideration is being 
given to user experience, but we should not be surprised because that is how 
Python3 is being developed?

Please remove this mess until a proper design is made and documented (3.7).

--

___
Python tracker 

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



[issue29195] Get rid of supporting outdated wrong keyword arguments in re methods

2017-01-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Many re methods accepted the string parameter as a keyword argument by wrong 
name. This was fixed in issue20283. Wrong keyword names were still accepted, 
but a deprecation warning was emitted if use them. Proposed patch finishes the 
deprecation period (started since 3.4) and removes the support of wrong names.

Python 2.7.7, 3.3.6, 3.4-3.6:

>>> import re
>>> re.compile('.').match(pattern='a')
__main__:1: DeprecationWarning: The 'pattern' keyword parameter name is 
deprecated.  Use 'string' instead.
<_sre.SRE_Match object; span=(0, 1), match='a'>
>>> re.compile('.').match(string='a')
<_sre.SRE_Match object; span=(0, 1), match='a'>

Python 3.7:

>>> re.compile('.').match(pattern='a')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Required argument 'string' (pos 1) not found

--
components: Extension Modules
files: re_wrong_string_argument_name.patch
keywords: patch
messages: 284911
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Get rid of supporting outdated wrong keyword arguments in re methods
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46192/re_wrong_string_argument_name.patch

___
Python tracker 

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



[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-07 Thread John Lehmann

New submission from John Lehmann:

Modules that have been loaded as an argument to the command line cannot be 
reloaded using importlib.reload.

For example with the attached file:

  $ python reloader.py
  Traceback (most recent call last):
File "reloader.py", line 31, in 
  reload_module("__main__")
File "reloader.py", line 28, in reload_module
  importlib.reload(module)
File 
"/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 
166, in reload
  _bootstrap._exec(spec, module)
File "", line 607, in _exec
  AttributeError: 'NoneType' object has no attribute 'name'

--
components: Library (Lib)
files: reloader.py
messages: 284910
nosy: j1o1h1n
priority: normal
severity: normal
status: open
title: importlib reload fails for module supplied as argument to command line
versions: Python 3.5
Added file: http://bugs.python.org/file46191/reloader.py

___
Python tracker 

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2017-01-07 Thread Xiang Zhang

Xiang Zhang added the comment:

I'm -1 if the intention is about easiness and efficiency. 

I think a new API is usually added due to functional defect not performance 
defect. We get a way here though the performance seems not ideal, according to 
INADA's mail. I think we should first check if memoryview gets an optimization 
chance to fit more in such a case. Creating a memoryview is not cheap enough in 
such a case.

About easiness to use, when a user considering such low level details, it's 
reasonable to know memoryview and it needs to be released.

But if this API is added to simplify bytes(), I think it makes sense but it's 
not only about adding a frombuffer().

--
nosy: +xiang.zhang

___
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

2017-01-07 Thread Nick Coghlan

Nick Coghlan added the comment:

While the attached PEP 538 patches include their own tests, the uploaded 
pep538-check-click.sh script is the one I've been using to check that the 
changes have the desired effect of letting click "just work", even when the 
nominal locale is cleared, explicitly set to C, or explicitly set to POSIX.

--
Added file: http://bugs.python.org/file46190/pep538-check-click.sh

___
Python tracker 

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



[issue29193] Remove support of format_string as keyword argument in string.Formatter().format()

2017-01-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Passing a format string as a keyword argument to string.Formatter.format() was 
deprecated in 3.5 (issue23671). Proposed patch finishes the deprecation period 
and converts a warning to an error.

Python 3.5-3.6:

>>> string.Formatter().format(format_string='foo: {foo}', foo=123)
__main__:1: DeprecationWarning: Passing 'format_string' as keyword argument is 
deprecated
'foo: 123'

Python 3.7:

>>> string.Formatter().format(format_string='foo: {foo}', foo=123)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/string.py", line 179, in format
"argument: 'format_string'") from None
TypeError: format() missing 1 required positional argument: 'format_string'

--
components: Library (Lib)
files: string_formatter_positional_only.patch
keywords: patch
messages: 284907
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Remove support of format_string as keyword argument in 
string.Formatter().format()
type: enhancement
versions: Python 3.7
Added file: 
http://bugs.python.org/file46189/string_formatter_positional_only.patch

___
Python tracker 

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



[issue29133] Minor inaccuracy in shlex.shlex punctuation_chars example

2017-01-07 Thread Vinay Sajip

Vinay Sajip added the comment:

I'm fine with removing the loop, as there are only ever going to be the two 
cases - so Berker's suggestion would seem to cover both doctest and unittest 
cases.

--

___
Python tracker 

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



[issue29192] Remove deprecated features from http.cookies

2017-01-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Some behavior of http.cookies was deprecated in 3.5. Following patch finishes 
the deprecation period and removes the code for handling deprecated features. 
Former warnings become errors.

--
components: Library (Lib)
files: cookies_finish_deprecation.patch
keywords: patch
messages: 284905
nosy: demian.brecht, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Remove deprecated features from http.cookies
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46188/cookies_finish_deprecation.patch

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Xiang Zhang

Xiang Zhang added the comment:

Paste my point here:

I prefer checking the result PyUnicode_Compare to see it's a success or failure.
getrandom doesn't use any lower level unicode operations so it doesn't get a
responsibility to ready the unicode.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2017-01-07 Thread Eryk Sun

Eryk Sun added the comment:

> Python already has a multiprocessing module which is able to pass 
> handles (maybe also FD? I don't know) to child processes on 
> Windows.

Popen doesn't implement the undocumented CRT protocol that's used to smuggle 
the file-descriptor mapping in the STARTUPINFO cbReserved2 and lpReserved2 
fields. This is a feature of the CRT's spawn and exec functions. For example:

fdr, fdw = os.pipe()
os.set_inheritable(fdw, True)
os.spawnl(os.P_WAIT, os.environ['ComSpec'], 'cmd /c "echo spam >&%d"' % fdw)

>>> os.read(fdr, 10)
b'spam \r\n'

We don't have to worry about implementing fd inheritance so long as os.spawn* 
uses the CRT. Someone that needs this functionality can simply be instructed to 
use os.spawn.

> I dislike adding a lpAttributeList attribute: it's too close to 
> the exact implementation of Windows may change in the future.

If you're going to worry about lpAttributeList, why stop there? 
Aren't dwFlags, wShowWindow, hStdInput, hStdOutput, and hStdError also too 
close to the exact implementation? My thoughts when suggesting this were 
actually to make this as close to the underlying API as possible, and 
extensible to support other attributes if there's a demand for it. 

Passing a list of handles is atypical usage, and since Python and subprocess 
use file descriptors instead of Windows handles, I prefer isolating this in a 
Windows structure such as STARTUPINFO, rather than adding even more confusion 
to Popen's constructor.

> Since the only known use case today is to pass handles

In the review of the first patch, I listed 3 additional attributes that might 
be useful to add in 3.7: IDEAL_PROCESSOR, GROUP_AFFINITY, and PREFERRED_NODE 
(simplified by the fact that 3.7 no longer supports Vista). Currently the way 
to set the latter two is to use the built-in `start` command of the cmd shell.

> I propose to focus on this use case: add a new pass_handles parameter
> to Popen, similar to pass_fds.

This is a messy situation. Python 3's file I/O is built on the CRT's POSIX 
layer. If it had been implemented directly on the Windows API using handles, 
then pass_fds would obviously use handles. That's the current situation with 
socket module because Winsock makes no attempt to hide AFD handles behind POSIX 
file descriptors. 

Popen's constructor accepts file descriptors -- not Windows handles -- for its 
stdin, stdout, and stderr arguments, and the parameter to control inheritance 
is named "close_fds". It seems out of place to add a "pass_handles" parameter.

--

___
Python tracker 

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



[issue29191] liblzma is missing from pcbuild.sln

2017-01-07 Thread Segev Finer

New submission from Segev Finer:

liblzma is missing from pcbuild.sln. This causes the build of _lzma to fail 
when building the solution and not using build.bat.

Attached is a patch that fixes this for the default branch. Note that it also 
includes some missing project configurations for the _asyncio module which 
Visual Studio will add every single time you open the solution.

A similar patch is simple enough to create for older versions/branches. Just 
Add->Existing Project liblzma.vcxproj and make sure to revert any lines in the 
sln which Visual Studio added that you don't want to commit. (Like 
VisualStudioVersion = ...)

--
components: Windows
files: add-liblzma-to-pcbuild-sln.patch
keywords: patch
messages: 284902
nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: liblzma is missing from pcbuild.sln
type: compile error
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46187/add-liblzma-to-pcbuild-sln.patch

___
Python tracker 

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



[issue29118] Randit

2017-01-07 Thread Spacemage 33

Spacemage 33 added the comment:

Thank you very much.

Now it works fine!

2016-12-31 5:42 GMT+01:00 Terry J. Reedy :

>
> Terry J. Reedy added the comment:
>
> This issue has nothing to do with IDLE.  There is also no bug here.
> Python's random module has a randint function that works fine.  Either you
> or the book have misspelled 'randint' as 'randit' or the book is using its
> own random module and not the stdlib version.  Please post on python-list
> if you think you have found a bug.
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
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

2017-01-07 Thread Nick Coghlan

Nick Coghlan added the comment:

I just pushed an update to PEP 538 based on PEP 540 and the feedback in the 
linux-sig discussion: 
https://github.com/python/peps/commit/221099d8765125bbd798e869846b005bcca84b47

I'll be starting a thread for that on python-ideas shortly, but in the context 
of the discussion here:

* There are good reasons to go back to strict error handling by default on the 
standard streams when we're using UTF-8 as the default encoding rather than 
ASCII: 
https://www.python.org/dev/peps/pep-0538/#using-strict-error-handling-by-default
* The right overall answer might actually be to create a hybrid merger of the 
two PEPs, rather than seeing them as strictly competitors: 
https://www.python.org/dev/peps/pep-0538/#relationship-with-other-peps

--

___
Python tracker 

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



[issue29190] Avoid possible errors in comparing strings

2017-01-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

An alternative patch checks the result of PyUnicode_Compare() (as Xiang 
suggested) instead of checking the value before calling PyUnicode_Compare(). 
Stephan, what way do you prefer?

--
nosy: +facundobatista, mark.dickinson, rhettinger, skrah
Added file: http://bugs.python.org/file46186/unicode_compare_2.patch

___
Python tracker 

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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2017-01-07 Thread Segev Finer

Segev Finer added the comment:

I removed previous_handle_list in _execute_child since I noticed subprocess 
already clobbers the other attributes in startupinfo anyhow.

I figured there will be some discussion about how to pass the handle list, so 
here's my two cents:

* subprocess already exposes a bit of Windows specific flags like creationflags 
and STARTUPINFO.

* Windows doesn't really break it's API in backwards incompatible ways often 
(Heck it barely breaks it ever, which is why we have so many Ex functions and 
reserved parameters :P).

* The _winapi module tries to expose WinAPI functions as is. So I implemented 
this as an internal attribute on STARTUPINFO, in the first version, since I 
wasn't sure we want this exposed to users, but I still wanted to try and mimic 
the original WinAPI functions internally. The lpAttributeList is a change 
requested by eryksun that brings it even closer to WinAPI and exposes it for 
further extension with additional attributes.

--
Added file: 
http://bugs.python.org/file46185/windows-subprocess-close-fds-v3.patch

___
Python tracker 

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