[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Given that we have contextlib.AbstractContextManager now, perhaps it should 
just set "f.__annotations__['return'] = AbstractContextManager"? (assuming no 
other return annotation is already set)

--

___
Python tracker 

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



[issue30341] Add an explaining comment in _PyTrash_thread_destroy_chain()

2017-05-12 Thread Xiang Zhang

Changes by Xiang Zhang :


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



[issue30341] Add an explaining comment in _PyTrash_thread_destroy_chain()

2017-05-12 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset a66f9c6bb134561a24374f10e8c35417d356ce14 by Xiang Zhang in branch 
'master':
bpo-30341: Improve _PyTrash_thread_destroy_chain() a little bit (#1545)
https://github.com/python/cpython/commit/a66f9c6bb134561a24374f10e8c35417d356ce14


--

___
Python tracker 

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



[issue30310] tkFont.py assumes that all font families are encoded as ascii in Python 2.7

2017-05-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1662

___
Python tracker 

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



[issue30310] tkFont.py assumes that all font families are encoded as ascii in Python 2.7

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since the source of the unicode font family is Tkinter, I think it is better 
not encode it in Python, but pass it as unicode and allow Tkinter to convert a 
unicode to a Tcl value.

--

___
Python tracker 

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



[issue30113] Allow helper functions to wrap sys.setprofile

2017-05-12 Thread Louie Lu

Louie Lu added the comment:

PR-1212 Add an explicit test for dispatch_return's assertion, could @benjaminp, 
@tiran or @giampaolo help to review this? Thanks!

--
nosy: +benjamin.peterson, christian.heimes, giampaolo.rodola

___
Python tracker 

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



[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Nathaniel Smith

New submission from Nathaniel Smith:

sphinxcontrib-trio [1] does a few things; one of them is to enhance sphinx's 
autodoc support by trying to sniff out the types of functions so that it can 
automatically determine that something is, say, a generator, or an async 
classmethod.

This runs into problems when it comes to context managers, for two reasons. One 
reason is pretty obvious: the sniffing logic would like to be able to tell by 
looking at a function that it should be used as a context manager, so that it 
can document it as such, but there's no reliable way to do this. The other 
reason is more subtle: the sniffing code has to walk the .__wrapped__ chain in 
order to detect things like async classmethods, but when it walks the chain for 
a @contextmanager function, it finds the underlying generator, and ends up 
thinking that this function should be documented as returning an iterator, 
which is just wrong. If we can detect context managers, we can know to ignore 
any 

Obviously this is always going to be a heuristic process; there's no 100% 
reliable way to tell what arbitrary wrappers are doing. But the heuristic works 
pretty well... it's just that right now the method of detecting context manager 
functions is pretty disgusting:

https://github.com/python-trio/sphinxcontrib-trio/blob/2d9e65187dc7a08863b68a78bdee4fb051f0b99e/sphinxcontrib_trio/__init__.py#L80-L90
https://github.com/python-trio/sphinxcontrib-trio/blob/2d9e65187dc7a08863b68a78bdee4fb051f0b99e/sphinxcontrib_trio/__init__.py#L241-L246

So it would be really nice if contextlib.contextmanager somehow marked its 
functions because:

- then I could (eventually) use that marker instead of making assumptions about 
contextmanager's internals and messing with code objects

- then we could (immediately) point to how the standard library does it as a 
standard for other projects to follow, instead of using this weird 
sphinxcontrib-trio-specific __returns_contextmanager__ thing that I just made 
up.

I don't really care what the marker is, though I suppose 
__returns_contextmanager__ = True is as good as anything and has the advantage 
of a massive installed base (2 projects).

[1] http://sphinxcontrib-trio.readthedocs.io/

--
components: Library (Lib)
messages: 293592
nosy: ncoghlan, njs, yselivanov
priority: normal
severity: normal
status: open
title: A standard convention for annotating a function as returning an (async) 
context manager?
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



[issue30358] Profile documentation - include sort argument for runctx

2017-05-12 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +1661

___
Python tracker 

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



[issue30358] Profile documentation - include sort argument for runctx

2017-05-12 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
assignee: docs@python
components: Documentation
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Profile documentation - include sort argument for runctx
type: enhancement
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



[issue30291] Allow windows launcher to specify bit lengths with & without minor version

2017-05-12 Thread Steve Dower

Steve Dower added the comment:


New changeset 870f6a11dd3b2d5455f7057ce0d9c2cd31acc2f2 by Steve Dower (Steve 
(Gadget) Barnes) in branch 'master':
bpo-30291 Changes to launcher so as to allow py -3-32, -2.7-64, 3.10, etc.
https://github.com/python/cpython/commit/870f6a11dd3b2d5455f7057ce0d9c2cd31acc2f2


--

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2017-05-12 Thread Chet Nichols III

Chet Nichols III added the comment:

Oh yeah, definitely not trustworthy at all. In my case, I am not processing the 
peer chain to actually verify trust, but I am still interested in inspecting 
the chain.

Dangerous or not, and regardless of what almost all people should *actually* be 
doing, SSL_get_peer_cert_chain exists for a reason, just like 
SSL_get_peer_certificate exists for a reason. If Python includes a standard SSL 
library, it should be transparent in the interface it offers, for the mere 
reason that the library becomes more powerful.

If the overall consensus is that the library should protect most people against 
common pitfalls and security mistakes, then I guess that's the route to 
continue on. However, I would be disappointed that we would be blacklisting  
the exposure of underlying library features based on the mere belief that 
people don't understand them enough!

--

___
Python tracker 

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



[issue30310] tkFont.py assumes that all font families are encoded as ascii in Python 2.7

2017-05-12 Thread Marc Culler

Marc Culler added the comment:

The name of a Tk font family is a byte sequence obtained from the operating 
system.  But, this being Python 2.7, there is no distinction between the str 
type and the bytes type.  The byte sequence is definitely not ascii encoded on 
a Japanese Windows system.  It is a utf8-encoded byte string.  This is why I 
called v.decode('utf8') in my patch.  Note that this bug does not occur with 
Python 3.6.

Terry, I understand that text is better and I hope I never have to resort to an 
image again.  Since I don't speak Japanese myself, even setting up a Japanese 
Windows VM for testing was pretty challenging for me.  I was able to take a 
screenshot without having to translate any Japanese menus, so I took that 
shortcut.  Sorry about that.

This report was indeed triggered by a real "crash" in your sense.  It occurred 
in a GUI application bundled with pyinstaller.  Any unhandled exception in a 
pyinstaller app results in termination of the process and posts a Windows error 
message box saying 'Failed to execute script XXX'.  For the report, however, I 
was isolating the underlying unhandled exception in Font.copy() that had caused 
the real crash of the GUI application.

--

___
Python tracker 

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



[issue30296] Remove unnecessary tuples, lists, sets, and dicts from Lib

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Yes, please do keep any proposed idlelib changes separate.  Also, I don't any 
of these to be backported (it is stylistic and not about bugs).

--

___
Python tracker 

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



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

Another error on AMD64 FreeBSD CURRENT Non-Debug 2.7:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Non-Debug%202.7/builds/92/steps/test/logs/stdio

0:04:23 [171/402/1] test_urllib2net failed
test test_urllib2net failed -- Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/test/test_urllib2net.py",
 line 166, in test_fileno
res = opener.open(req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 429, in open
response = self._open(req, data)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 447, in _open
'_open', req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 407, in _call_chain
result = func(*args)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 1228, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 1201, in do_open
r = h.getresponse(buffering=True)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 1121, in getresponse
response.begin()
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 438, in begin
version, status, reason = self._read_status()
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 394, in _read_status
line = self.fp.readline(_MAXLINE + 1)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/socket.py",
 line 480, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 54] Connection reset by peer

--

___
Python tracker 

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



[issue30357] test_thread.test_save_exception_state_on_error(): Unhandled exception in thread: AMD64 Debian root 2.7

2017-05-12 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20Debian%20root%202.7/builds/154/steps/test/logs/stdio

0:04:59 [312/402/1] test_thread failed
Traceback (most recent call last):
  File 
"/root/buildarea/2.7.angelico-debian-amd64/build/Lib/test/test_thread.py", line 
133, in task
raise SyntaxError
SyntaxError: None
test test_thread failed -- Traceback (most recent call last):
  File 
"/root/buildarea/2.7.angelico-debian-amd64/build/Lib/test/test_thread.py", line 
150, in test_save_exception_state_on_error
self.assertIn("Traceback", stderr.getvalue())
AssertionError: 'Traceback' not found in 'Unhandled exception in thread started 
by \n'

--
components: Tests
messages: 293586
nosy: haypo
priority: normal
severity: normal
status: open
title: test_thread.test_save_exception_state_on_error(): Unhandled exception in 
thread: AMD64 Debian root 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



[issue30356] test_mymanager_context() of test_multiprocessing_spawn: manager._process.exitcode=-15 on x86 Windows7 3.x

2017-05-12 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/601/steps/test/logs/stdio

==
FAIL: test_mymanager_context 
(test.test_multiprocessing_spawn.WithManagerTestMyManager)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py",
 line 2232, in test_mymanager_context
self.assertEqual(manager._process.exitcode, 0)
AssertionError: -15 != 0

--
Ran 277 tests in 667.577s

FAILED (failures=1, skipped=24)
test test_multiprocessing_spawn failed

--
components: Tests, Windows
messages: 293585
nosy: davin, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_mymanager_context() of test_multiprocessing_spawn: 
manager._process.exitcode=-15 on x86 Windows7 3.x
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



[issue29367] python-gdb: display wrapper_call()

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88 by Victor Stinner in 
branch '3.6':
[3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
https://github.com/python/cpython/commit/d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88


--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88 by Victor Stinner in 
branch '3.6':
[3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
https://github.com/python/cpython/commit/d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88


--

___
Python tracker 

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



[issue30345] test_gdb fails on Python 3.6 when built with LTO+PGO

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88 by Victor Stinner in 
branch '3.6':
[3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
https://github.com/python/cpython/commit/d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88


--

___
Python tracker 

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



[issue30350] devguide suggests to use VS 2008 to build Python 2.7, but VS 2008 is no more supported?

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

Anyway, I fixed some issues specific to VS9.0 recently, so things
should be a little bit better now :-)

For me, the last annoying issue is bpo-30313: re-run failed tests in
verbose mode. I will try to implement proposed solution.

--

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2017-05-12 Thread Dustin Oprea

Dustin Oprea added the comment:

Thanks for expounding on this, Christian. Assuming your assertions are
correct, this makes perfect sense.

Can anyone listening close this?

On May 12, 2017 17:45, "Christian Heimes"  wrote:

Christian Heimes added the comment:

The ticket is dead for a very good reason. Past me was not clever enough
and didn't know about the difference between the cert chain sent by the
peer and the actual trust chain. The peer's cert chain is not trustworthy
and must *only* be used to build the actual trust chain. X.509 chain trust
chain construction is a tricky business.

Although I thought that peer cert chain is a useful piece of information,
it is also dangerous. It's simply not trustworthy. In virtually all cases
you want to know the chain of certificates that leads from a local trust
anchor to the end-entity cert. In most cases it just happens to be the same
(excluding root CA). But that's not reliable.

--

___
Python tracker 

___

--

___
Python tracker 

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



[issue30347] itertools.groupby() can fail a C assert()

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

At first glance, the suggested PR looks fine.  Unless there is a rush, I would 
like to hold-off spend more time thinking about Issue 30346 before moving 
forward with this one.

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> If I was to submit this as a PR, ...

Please don't jump to writing code yet.  We need to decide what should be done 
first.  

I'm not really excited about making a change at all.  No users seem to have 
ever been affected by this.  The CPython code matches what it is documented to 
do (by the pure python code in the documentation).  In a way, it is just an 
obscure implementation artifact.

If we do make a small change, I would like it to be 3.7 only.  No need to risk 
breaking existing code for something that technically isn't even a bug (because 
it matches the documentation).  As the title suggests, it is more of an oddity 
than anything else.

--
versions: +Python 3.7 -Python 3.3, Python 3.5

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2017-05-12 Thread Christian Heimes

Christian Heimes added the comment:

The ticket is dead for a very good reason. Past me was not clever enough and 
didn't know about the difference between the cert chain sent by the peer and 
the actual trust chain. The peer's cert chain is not trustworthy and must 
*only* be used to build the actual trust chain. X.509 chain trust chain 
construction is a tricky business.

Although I thought that peer cert chain is a useful piece of information, it is 
also dangerous. It's simply not trustworthy. In virtually all cases you want to 
know the chain of certificates that leads from a local trust anchor to the 
end-entity cert. In most cases it just happens to be the same (excluding root 
CA). But that's not reliable.

--

___
Python tracker 

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



[issue30312] Small correction in set code sample

2017-05-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue30352] The 'in' syntax should work with any object that implements __iter__

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-1 on this proposal.  We haven't really seen a need for this in practice.  And 
such as change would be likely create unforeseen consequences to existing code. 
 

The proposal is at odds with the existing design.  Python internals work by 
checking for whether a given slot is filled-out.  Trying to make these lookups 
transparent to __getattr__ calls would be tricky at best (we can't know what 
__getattr__ does without calling it) and definitely not fast.

Even if it could be done easily, I would still prefer the current design which 
requires explicit delegation of magic methods by proxy objects.

FWIW, me made the same decision for super() objects ( 
https://docs.python.org/3/library/functions.html#super ):

"""
Note that super() is implemented as part of the binding process for explicit 
dotted attribute lookups such as super().__getitem__(name). It does so by 
implementing its own __getattribute__() method for searching classes in a 
predictable order that supports cooperative multiple inheritance. Accordingly, 
super() is undefined for implicit lookups using statements or operators such as 
super()[name].
"""

For the reasons listed above and those listed by Steven, I'm marking this as 
closed/rejected.  Thank you for the suggestion, but we need to decline.

--
assignee:  -> rhettinger
resolution:  -> rejected
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



[issue30312] Small correction in set code sample

2017-05-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

English 'or' remains ambiguous, and often exclusive, even without 'either'.  
Hence jokes like
  Parent: "Cake or pie?"
  Smart kid: "Both!"
I agree with replacing 'either' with 'or both'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Matthew Gilson

Matthew Gilson added the comment:

Tracking which group the grouper _should_ be on using an incrementing integer 
seems to work pretty well.

In additional to the tests in `test_itertools.py`, I've gotten the following 
tests to pass:

class TestGroupBy(unittest.TestCase):
def test_unpacking(self):
iterable = 'AB'
(_, a), (_, b) = groupby(iterable)
self.assertEqual(list(a), [])
self.assertEqual(list(b), [])

def test_weird_iterating(self):
g = groupby('AB')
_, a = next(g)
_, b = next(g)
_, aa = next(g)
self.assertEqual(list(a), [])
self.assertEqual(list(b), [])
self.assertEqual(list(aa), list('A'))

If I was to submit this as a PR,

1. where would I want to add these tests?
2. should I update the documentation for the "equivalent" python version to 
match exactly?

--
keywords: +patch
Added file: http://bugs.python.org/file46860/groupby-fix.patch

___
Python tracker 

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



[issue30355] Unicode symbols crash lib2to3.parse

2017-05-12 Thread Yann Grisel

New submission from Yann Grisel:

The code formatter YAPF relies on lib2to3 to parse the code before formatting 
it. The function "classify" from "lib2to3/pgen2/parse.py" returns a ParseError 
when encountering unicode variable names (like Δ), which it should not.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 293573
nosy: Yann Grisel
priority: normal
severity: normal
status: open
title: Unicode symbols crash lib2to3.parse
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



[issue30310] tkFont.py assumes that all font families are encoded as ascii in Python 2.7

2017-05-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Marc, In the future please copy and paste such text interactions instead of 
posting an image.

A 'crash' on Windows is when one gets the Windows' Error messagebox 'You 
application has stopped working.'

Since the exception comes from trying to encode non-ascii unicode to bytes, I 
would expect the condition in the fix to be
+if isinstance(v, unicode):
+options.append(v.encode('utf8'))
instead of the str/decode version in your patch.
If v is already a string (of ascii bytes), I think it should just be appended 
as is.  Anyway, Serhiy can decide what to do.

--
nosy: +serhiy.storchaka, terry.reedy
stage:  -> patch review
type: crash -> behavior

___
Python tracker 

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



[issue11681] -b option undocumented

2017-05-12 Thread Zachary Ware

Changes by Zachary Ware :


--
pull_requests: +1660

___
Python tracker 

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



[issue30296] Remove unnecessary tuples, lists, sets, and dicts from Lib

2017-05-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

As I said on review, I want idlelib changes either not made or in a separate 
patch that can be backported as is.  Partial backport/cherry-picks are a major 
nuisance.  I don't know if anything else should be treated similarly.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2017-05-12 Thread Chet Nichols III

Chet Nichols III added the comment:

Is this dead at this point? Just stumbled upon it, and I'm hopeful that maybe 
there's still a chance, since it's still `open`. :)

--
nosy: +chet

___
Python tracker 

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



[issue30219] webbrowser.open outputs xdg-open deprecation warning

2017-05-12 Thread desbma

desbma added the comment:

The only issue with Python itself is that the output of a subprocess call 
hidden behind a high level abstraction is thrown into the user's face in an 
unexpected way.
This just does not seem to be the right thing to do to me.

The deprecation warning of xdg-open/gvfs-open is just a particular example that 
shows this problem.

The "what if the output is actually useful?" argument does not hold IMHO, 
because the all the other browser invocations in the webbrowser module (except 
the TTY browsers of course) are properly silenced.

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree and prefer #1. This will save users from incorrect using and us from 
reports about odd behavior.

The implementation is simple. The groupby object generates an unique identifier 
when creates a new grouper. This may be a sequential integer, just object(), or 
the grouper object itself (but the latter case creates a reference loop). The 
grouper object saves the parent's identifier when created and compare the owned 
reference with the current parent's identifier before every use (in __next__ 
and __reduce__). If they don't match, the grouper object is not valid.

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note also that using separators=COMPACT doesn't guarantee the most compact 
output. As Inada mentioned ensure_ascii=False may make JSON more compact. And 
you shouldn't use non-default indent!

I don't understand effort spent for this issue. Even if add json.COMPACT you 
could use it only with 3.7+. And adding a named constant in your program is 
just one line!

--

___
Python tracker 

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



[issue30354] Change data model documentation to zero-argument super()

2017-05-12 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +1659

___
Python tracker 

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



[issue30354] Change data model documentation to zero-argument super()

2017-05-12 Thread Cheryl Sabella

New submission from Cheryl Sabella:

Update data model documentaion to reflect the zero-argument form of super().

--
assignee: docs@python
components: Documentation
messages: 293566
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Change data model documentation to zero-argument super()
type: enhancement
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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I have no interest in #2.   Itertools are all about *not* storing data in 
memory unless that is an intrinsic requirement for the operation (tee() and 
cycle() for example).

Also, I would like any changes to be minimal and have the lowest possible risk 
of breaking code.  The groupby() tool is about 13 years old and has served its 
users well.  These little corner cases we're working on now don't seem to 
correspond to how users actually use groupby or how it was intended to be used 
(either eat the sub-iterator right away before advancing the outer iterator or 
ignore it entirely).

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Having mulled this over for a while, I'm disinclined to go forward with this 
proposal.  On the one hand, it is a relatively small change, so it doesn't 
affect the overall complexity much.  However, API design principles suggest 
that this isn't the right thing to do.

Good APIs tend to steer users towards correct design.  I'm concerned that 
adding a COMPACT constant will suggest to users that compacting separators in 
the output is something they should be doing.  Instead, it is a distracting 
micro-optimization that rarely saves much space but comes at a cost of 
readability (it is no fun to have to read JSON without spaces).

For other kinds of code generation, minification is normally a post-processing 
step rather than something incorporated into the generator itself.  When we 
care about the size of JSON, we really want people to use compression rather 
than feebly editing-out a few spaces.

The main reason to have the *separators* argument is to factor-out hardwired 
behavior.  It wasn't really about binary choices: normal-vs-thin, 
readable-vs-smushed.

Lastly, I don't really like having two-ways-to-do-it.  We already have 
something that works, so should have we should have a preference for 
documenting what we have rather than leaning towards continuous slow sprawl 
with new options that aren't backwards compatible (creating yet another 
cross-version maintenance issue).

--

___
Python tracker 

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



[issue27144] concurrent.futures.as_completed() memory inefficiency

2017-05-12 Thread Grzegorz Grzywacz

Grzegorz Grzywacz added the comment:

> We just ran into the exact same issue here in Google using a 
> ThreadPoolExecutor.map call
Looks like map got simillar issue. I created GitHub PR with map fixed.

>  Concurrent package was added in 3.2. How backport it 2.7?
There is official, unofficial 2.7 backport.

Git: https://github.com/agronholm/pythonfutures
Pip: futures
Ubuntu package: python-concurrent.futures

--

___
Python tracker 

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



[issue27144] concurrent.futures.as_completed() memory inefficiency

2017-05-12 Thread Grzegorz Grzywacz

Changes by Grzegorz Grzywacz :


--
pull_requests: +1658

___
Python tracker 

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



[issue29573] NamedTemporaryFile with delete=True should not fail if file already deleted

2017-05-12 Thread R. David Murray

R. David Murray added the comment:

I think we are leaning strongly toward making no change here.

--

___
Python tracker 

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



[issue30181] Correct the parsing of a test case docstring.

2017-05-12 Thread R. David Murray

R. David Murray added the comment:

Ah, yes, that's a bug in our workflow we'll need to fix.  The CLA signed on the 
bug tracker is the ultimate authority, so we need some way to manually bypass 
the bot for cases like this.

A committer should be able to bypass the problem and get the patch pushed, once 
it is approved.

--

___
Python tracker 

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



[issue30350] devguide suggests to use VS 2008 to build Python 2.7, but VS 2008 is no more supported?

2017-05-12 Thread Zachary Ware

Zachary Ware added the comment:

Jeremy is correct.

To further clarify, *all* 2.7 Windows builders *are* using VS 2008's compiler 
toolchain, but they're using VS 2015's MSBuild with VS 2010's description of 
2008's compiler toolchain to build the projects described in PCbuild/.  It's a 
mess, but it works and makes things much easier to customize.  The two specific 
VS9.0 builders are using VS 2008 directly via the PC/VS9.0 build files, but 
ideally the output from both methods should be exactly the same.  As Jeremy 
pointed out, the PC/VS9.0 files are still explicitly supported, and those two 
builders were set up to make sure they're not broken.

Anything older than PC/VS9.0 is explicitly *un*supported, and I would have no 
problem with just removing them (and any support for them in sysconfig).

--

___
Python tracker 

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



[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2017-05-12 Thread Erik Bray

Changes by Erik Bray :


--
pull_requests: +1656

___
Python tracker 

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



[issue29573] NamedTemporaryFile with delete=True should not fail if file already deleted

2017-05-12 Thread Andrew Nester

Andrew Nester added the comment:

any conclusion on this? looks like it's a bit stuck

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Andrew Nester

Andrew Nester added the comment:

any conclusion on this? looks like it's a bit stuck

--
nosy: +andrewnester

___
Python tracker 

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



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2017-05-12 Thread Andrew Nester

Andrew Nester added the comment:

so any feedback on this?

--

___
Python tracker 

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



[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2017-05-12 Thread Erik Bray

New submission from Erik Bray:

The test ctypes.test.test_structures.StructureTestCase.test_pass_by_value fails 
on 64-bit Cygwin and MinGW using the system libffi with:

==
FAIL: test_pass_by_value (ctypes.test.test_structures.StructureTestCase)
--
Traceback (most recent call last):
  File "/home/embray/src/python/cpython/Lib/ctypes/test/test_structures.py", 
line 416, in test_pass_by_value
self.assertEqual(s.first, 0xdeadbeef)
AssertionError: 195948557 != 3735928559


It seems that libffi does not handle passing structs by value properly on those 
platforms as I explained here: https://github.com/libffi/libffi/issues/305

The upstream bug hasn't been confirmed yet by the libffi developers so I could 
be wrong, but I think this is fairly clearly broken there.

I have a PR forthcoming to work around the issue.

--
components: ctypes
messages: 293556
nosy: erik.bray
priority: normal
severity: normal
status: open
title: ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit
type: behavior

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-12 Thread Bernhard M. Wiedemann

Bernhard M. Wiedemann added the comment:

Tracking this in https://bugzilla.opensuse.org/show_bug.cgi?id=1038906
now.
It turned out to be a problem with (our?) openssl-1.0.2
which Debian stable does not have yet
and Debian/9 (stretch) has openssl-1.1.0 without this problem

The nicest python-based reproducer so far is
time python -S -c '' ; time python -S -c 'import _hashlib'

--

___
Python tracker 

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



[issue30343] Subclassed json.JSONEncoder does not respect default method for supported types

2017-05-12 Thread Christopher Harrison

Christopher Harrison added the comment:

I have written a proof-of-concept implementation and submitted a pull request. 
See the PR for details: https://github.com/python/cpython/pull/1558

(My CLA is pending; submitted around 2017-05-12T10:30:00Z+0100)

--

___
Python tracker 

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



[issue30343] Subclassed json.JSONEncoder does not respect default method for supported types

2017-05-12 Thread Christopher Harrison

Changes by Christopher Harrison :


--
pull_requests: +1654

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a Python implementation of the idea #2:

from itertools import tee
def groupby(iterable, key=None):
if key is None:
key = lambda x: x
def grouper(currvalue, it, tgtkey):
yield currvalue
for currvalue in it:
if key(currvalue) != tgtkey:
break
yield currvalue
it = iter(iterable)
tgtkey = init = object()
while True:
try:
currvalue = next(it)
except StopIteration:
return
currkey = key(currvalue)
if tgtkey is init or currkey != tgtkey:
tgtkey = currkey
it, it2 = tee(it)
yield (currkey, grouper(currvalue, it2, tgtkey))

--

___
Python tracker 

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



[issue30352] The 'in' syntax should work with any object that implements __iter__

2017-05-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

A further thought... looking at your example code, I believe that part of the 
__getattr__ is redundant.

def __getattr__(self, item):
try:
return self.__getattribute__(item)
except AttributeError:
return self.f.__getattribute__(item)


__getattr__ is only called if normal attribute lookup has already failed, so 
the call to self.__getattribute__ is unnecessary. If it would have succeeded, 
it would have already succeeded and __getattr__ won't have been called at all.

For more discussion on how to do automatic delegation, you should look at Alex 
Martelli's recipe from the Python Cookbook:

https://code.activestate.com/recipes/52295-automatic-delegation-as-an-alternative-to-inherita/

Also, its a bit... funny... to call dunder methods directly. (I'm deliberately 
not using the word "wrong".) They are implementation, not interface. I think 
your __getattr__ should be:

def __getattr__(self, name):
return getattr(self.f, name)

It also looks nicer :-)

--

___
Python tracker 

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



[issue30350] devguide suggests to use VS 2008 to build Python 2.7, but VS 2008 is no more supported?

2017-05-12 Thread Jeremy Kloth

Jeremy Kloth added the comment:

A few things...

First to Victor's comments on the devguide.  The following sentence after the 
one quoted states:

"To use the build files in the PCbuild directory you will also need Visual 
Studio 2010"

In short, you need *both* VS2008 and VS2010 to compile the "default" way.

Secondly, to Steve's comment on the PC\VS9.0 build files.

Normally Steve would be correct in stating that the PC\VS* directories are not 
maintained, however, in this case they are supported.  It is explicitly stated 
as such in the devguide and PCbuild\readme.txt 
(https://github.com/python/cpython/blob/2.7/PCbuild/readme.txt).

--
nosy: +jkloth

___
Python tracker 

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



[issue30352] The 'in' syntax should work with any object that implements __iter__

2017-05-12 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +rhettinger, xiang.zhang

___
Python tracker 

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



[issue30347] itertools.groupby() can fail a C assert()

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PR 1557 implements the simplest fix -- remove the assert and use Py_XSETREF() 
instead of simple assignment. Since the resulting code in _grouper_next() is 
identical to the code in groupby_next(), it was shared between these two 
functions.

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



[issue30347] itertools.groupby() can fail a C assert()

2017-05-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1653

___
Python tracker 

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



[issue30352] The 'in' syntax should work with any object that implements __iter__

2017-05-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

This is not a small change, and will need careful thought.

The problem is that in Python 3 (and in Python 2 for new-style classes), dunder 
methods are only called by the interpreter if they are defined on the class 
itself, not on the instance. That's an optimization, and it does mean that (for 
example) automatic delegation doesn't work with dunder methods.

But if we change this, we should change it for *all* dunder methods, not just 
__iter__. It would be a problem if we start "fixing" dunders piecemeal, one at 
a time. Either they should all work (like with classic classes) or none of them 
should.

So this is potentially a big change.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue30352] The 'in' syntax should work with any object that implements __iter__

2017-05-12 Thread Edouard KLEIN

New submission from Edouard KLEIN:

In this StackOverflow question:

http://stackoverflow.com/questions/43935187/how-come-an-object-that-implements-iter-is-not-recognized-as-iterable/43935360#43935360

the question of why an object that implements __iter__ through __getattr__ does 
not work with the "in" syntax is raised. The accepted answer is that the 
interpreter checks for __iter__ instead of just calling it.

If that's the case, I think that:
- Either the behaviour of the interpreter should be changed to accept any 
object that implements __iter__, regardless of how,
- Or, if there is a technical reason why the interpreter can't change its 
behavior, the documentation 
https://docs.python.org/3/library/stdtypes.html#iterator-types should make it 
clear that __iter__ must be hard coded into the object.

Here is the code of the object that arguably should be iterable but is not:

class IterOrNotIter:
def __init__(self):
self.f = open('/tmp/toto.txt')
def __getattr__(self, item):
try:
return self.__getattribute__(item)
except AttributeError:
return self.f.__getattribute__(item)

IterOrNotIter().__iter__().__next__()  # Works
'a' in IterOrNotIter()  # Raises a TypeError

--
components: Interpreter Core
messages: 293547
nosy: Edouard KLEIN
priority: normal
severity: normal
status: open
title: The 'in' syntax should work with any object that implements __iter__
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



[issue30219] webbrowser.open outputs xdg-open deprecation warning

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This bug already is fixed in develop branch of xdg-open. But the version 
including that fix still is not released. There may be years until it be 
released and main distributives update xdg-open.

--

___
Python tracker 

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



[issue30342] [2.7] sysconfig.is_python_build() doesn't work if Python is built with VS 2008

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

I tested manually my change: it fixes the issue ;-)

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



[issue30219] webbrowser.open outputs xdg-open deprecation warning

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

2017-05-11 20:42 GMT+02:00 desbma :
> Of course, because gvfs-open is precisely the cause of the deprecation warning

I don't understand something. Why do you consider that it's a Python
bug, whereas xdg-open redirects to the deprecated gvfs-open tool?

Why not reporting the bug to xdg-open?

--

___
Python tracker 

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



[issue30351] regrtest hangs on x86 Windows XP 2.7

2017-05-12 Thread STINNER Victor

New submission from STINNER Victor:

The tests step was killed after a total of 55 min 54 sec, whereas it only took 
38 min 40 sec on the previous build 150.

regrtest was supposed to log "running: test_threading (xxx sec)" every 30 
seconds, but it didn't!? I don't know if the main regrtest process was stuck, 
or the child process running test_threading was stuck? Or both?

http://buildbot.python.org/all/builders/x86%20Windows%20XP%202.7/builds/151/steps/test/logs/stdio

test_pty skipped -- No module named fcntl
0:35:45 [400/402] test_pep352 passed -- running: test_threading (448 sec)
0:35:47 [401/402] test_timeit passed -- running: test_threading (450 sec)

command timed out: 1200 seconds without output running 
['Tools\\buildbot\\test.bat', '-j2'], attempting to kill
program finished with exit code 1
elapsedTime=3354.584000

--
messages: 293543
nosy: haypo
priority: normal
severity: normal
status: open
title: regrtest hangs on x86 Windows XP 2.7

___
Python tracker 

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



[issue30344] test_multiprocessing.test_notify_all(): AssertionError: 6 != 5 on x86 Windows XP 2.7

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

Also failed on:
http://buildbot.python.org/all/builders/x86%20Windows%20XP%20VS9.0%202.7/builds/147/steps/test/logs/stdio

--

___
Python tracker 

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



[issue30003] Fix handling escape characters in HZ codec

2017-05-12 Thread Xiang Zhang

Changes by Xiang Zhang :


--
stage:  -> patch review
title: Remove hz codec -> Fix handling escape characters in HZ codec
versions: +Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue30003] Remove hz codec

2017-05-12 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1652

___
Python tracker 

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



[issue30338] LC_ALL=en_US + io.open() => LookupError: (osx)

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

The best "workaround" on Python 2.7 is to specify the encoding: replace 
io.open(filename) with io.open(filename, encoding="utf8").

It's always better to specify the encoding ;-)

--

___
Python tracker 

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



[issue30338] LC_ALL=en_US + io.open() => LookupError: (osx)

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for your bug report Anthony Sottile! It's now fixed!


My backport was merged.

New changeset 94a3694c3dda97e3bcb51264bf47d948c5424d84 by Victor Stinner in 
branch '2.7':
bpo-6393: Fix locale.getprerredencoding() on macOS (#1555)
https://github.com/python/cpython/commit/94a3694c3dda97e3bcb51264bf47d948c5424d84

Before, without the fix:

macbook:2.7 haypo$ LANG=en_US ./python.exe -c 'import io; 
print(io.open("setup.py").encoding)'
Traceback (most recent call last):
  File "", line 1, in 
LookupError: unknown encoding: 


After, with the fix:

macbook:2.7 haypo$ LANG=en_US ./python.exe -c 'import io; 
print(io.open("setup.py").encoding)'
UTF-8


--

Python 3.7 is not affected:

macbook:master haypo$ LANG=en_US ./python.exe -c 'import locale; 
print(locale.getpreferredencoding())'
UTF-8

macbook:master haypo$ LANG=en_US ./python.exe -c 'import io; 
print(io.open("setup.py").encoding)'
UTF-8

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue30323] concurrent.futures.Executor.map() consumes all memory when big generators are used

2017-05-12 Thread Klamann

Klamann added the comment:

Yes, I was wrong in my assumption that simply replacing the list comprehension 
with a generator expression would fix the issue.

Nevertheless, there is no need to load the *entire* generator into memory by 
converting it to a list. All we have to read are the first n elements, where n 
is the number of workers that are currently available.

I've implemented an alternative solution that works for me, using wait() and 
notify() from threading.Condition, but I'm not quite sure if this would be the 
best solution for everyone. But I could post it here, if you're intrested.

We should also consider that not strictly evaluating every iterable that is 
passed to the map() function might break existing code that implicitly relies 
on that fact that this is happening (although this is not a documented feature 
of the map function and was probably not the intended behaviour in the first 
place).

--

___
Python tracker 

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



[issue30338] LC_ALL=en_US + io.open() => LookupError: (osx)

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

> Note that _pyio uses locale.getpreferedencoding(), not 
> locale.getpreferredencoding(False).

Oh, it's a difference between Python 2.7 and Python 3.

Python 3 calls setlocale(LC_CTYPE, "") at startup, so 
locale.getpreferredencoding(False) can be used in Python 3.

Python 2.7 requires to call locale.getpreferredencoding() to get the encoding 
of the *user* locale.

--

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 94a3694c3dda97e3bcb51264bf47d948c5424d84 by Victor Stinner in 
branch '2.7':
bpo-6393: Fix locale.getprerredencoding() on macOS (#1555)
https://github.com/python/cpython/commit/94a3694c3dda97e3bcb51264bf47d948c5424d84


--
nosy: +haypo

___
Python tracker 

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



[issue30350] devguide suggests to use VS 2008 to build Python 2.7, but VS 2008 is no more supported?

2017-05-12 Thread STINNER Victor

New submission from STINNER Victor:

Steve Dower wrote this comment on my PR 
https://github.com/python/cpython/pull/1544 :

"Ah, I see. This is fine then - I have very little interest in doing much work 
to support the old build files (as they are explicitly unsupported)."

Copy of my reply:

"I have very little interest in doing much work to support the old build files 
(as they are explicitly unsupported)."

Wait wait wait... I fail to follow progress on the Windows build system, so I 
rely on the devguide which I expect to be up to date, and the guide says:

https://docs.python.org/devguide/setup.html#windows-compiling

"Python 2.7 uses Microsoft Visual Studio 2008, which is most easily obtained 
through an MSDN subscription."

I have a MSDN account, but after 30 min, I failed to get my MSDN number and I 
don't know my subscription is still valid or not (well, I guess that, it's 
expired). It took me 1 hour to find an old ISO of Visual Studio 2008, and not 
from microsoft.com :-(

I didn't want to install VS 2008, but I just followed the devguide.

... Do you mean that VS 2010 must now be used and the devguide is just outdated?


Moreover: we do have a buildbot using VS 2008. I'm now trying to fix all 
buildbots, so I had to fix issues on this VS 2008 buildbot too: 
http://bugs.python.org/issue30313

But I guess that it's ok to have a buildbot on a system not officially fully 
supported.

--
assignee: docs@python
components: Build, Documentation, Windows
messages: 293536
nosy: docs@python, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: devguide suggests to use VS 2008 to build Python 2.7, but VS 2008 is no 
more supported?
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



[issue30342] [2.7] sysconfig.is_python_build() doesn't work if Python is built with VS 2008

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:


New changeset f2e894cfd9b6f5d6aacc276476262d481203030c by Victor Stinner in 
branch '2.7':
bpo-30342: Fix sysconfig.is_python_build() on VS9.0 (#1544)
https://github.com/python/cpython/commit/f2e894cfd9b6f5d6aacc276476262d481203030c


--

___
Python tracker 

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



[issue30338] LC_ALL=en_US + io.open() => LookupError: (osx)

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

I created a PR to backport bpo-6393 to Python 2.7: 
https://github.com/python/cpython/pull/1555

--

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2017-05-12 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1651

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does it make sense using a grouper after advancing the groupby iterator? 
Currently it is possible by accident:

>>> from itertools import groupby, count
>>> it = groupby(count(), lambda i: (i//10)%2)
>>> _, even = next(it)
>>> _, odd = next(it)
>>> print(list(even))
[]
>>> print(list(odd))
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> print(list(even))
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
>>> print(list(odd))
[30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
>>> print(list(even))
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49]

But I think that it would be more consistent to implement one of following 
variant:

1. Invalidate groupers after creating a new grouper. There should be only one 
valid grouper related to the groupby object. Using of invalid grouper should 
raise either StopIteration or RuntimeError.

>>> it = groupby(count(), lambda i: (i//10)%2)
>>> _, even = next(it)
>>> _, odd = next(it)
>>> print(list(even))
[]
>>> print(list(odd))
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> print(list(even))
[]
>>> print(list(odd))
[]

or

>>> it = groupby(count(), lambda i: (i//10)%2)
>>> _, even = next(it)
>>> _, odd = next(it)
>>> print(list(even))
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError
>>> print(list(odd))
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> print(list(even))
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError
>>> print(list(odd))
[]

2. Duplicate the source iterator using tee() when create a new grouper. All 
groupers can be used independently from the groupby object and other groupers.

>>> it = groupby(range(100), lambda i: (i//10)%2)
>>> _, even = next(it)
>>> _, odd = next(it)
>>> _ = list(it)  # exhaust the source iterator
>>> print(list(even))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print(list(odd))
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> print(list(even))
[]
>>> print(list(odd))
[]

I think resolving this issue will also fix issue30347.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30349] Preparation for advanced set syntax in regular expressions

2017-05-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1650

___
Python tracker 

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



[issue30349] Preparation for advanced set syntax in regular expressions

2017-05-12 Thread Serhiy Storchaka
New submission from Serhiy Storchaka:

Currently the re module supports only simple sets. They can include literal 
characters, character ranges, some simple character classes and support the 
negation. The Unicode standard [1] defines set operations (union, intersection, 
difference and symmetric difference) and nested sets. Some regular expression 
engines implemented these features, for example the regex module supports all 
TR18 features except not-nested POSIX character classes.

If replace the re module with the regex module or add support of these features 
in the re module and make this syntax enabled by default, this will break some 
code. It is very unlikely the the regular expression contains duplicated 
characters ('--', '||', '&&' or '~~'), but nested sets uses just '[', and 
non-escaped '[' is occurred in character sets in regular expressions (even the 
stdlib contains several occurrences).

Proposed patch adds FutureWarnings emitted when possible breaking set construct 
('--', '||', '&&', '~~' or '[') is occurred in a regular expression. We need 
one or two releases with a warning before changing syntax. The patch also makes 
re.escape() escaping '&' and '~' and fixes several regular expression in the 
stdlib.

Alternatively the support of new set syntax could be enabled by special flag.

I'm not sure that the support of set operations and nested sets is necessary. 
This complicates the syntax of regular expressions (which already is not 
simple). Currently set operations can be emulated with lookarounds:

[set1||set2] -- (?:[set1]|[set2])
[set1&&set2] -- [set1](?<=[set2]) or (?=[set1])[set2]
[set1--set2] -- [set1](?http://unicode.org/reports/tr18/#Subtraction_and_Intersection

--
assignee: serhiy.storchaka
components: Library (Lib), Regular Expressions
messages: 293532
nosy: ezio.melotti, mrabarnett, r.david.murray, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Preparation for advanced set syntax in regular expressions
type: enhancement
versions: Python 3.7

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


[issue30348] IDLE: Add fetch completions and get entity unittest

2017-05-12 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1649

___
Python tracker 

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



[issue30348] IDLE: Add fetch completions and get entity unittest

2017-05-12 Thread Louie Lu

New submission from Louie Lu:

Due to #21261, add relative unittest to test_autocomplete.py

--
assignee: terry.reedy
components: IDLE
messages: 293531
nosy: louielu, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Add fetch completions and get entity unittest
type: enhancement
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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Matthew Gilson

Matthew Gilson added the comment:

Oops.  You don't need to pass `self.currvalue` to `_grouper`. I didn't end up 
using it in there...

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Matthew Gilson

Matthew Gilson added the comment:

I think that works to solve the problem that I pointed out.  In my stack 
overflow question (http://stackoverflow.com/a/43926058/748858) it has been 
pointed out that there are other opportunities for weirdness here.

Specifically, if if I skip processing 2 groups and then I process a third group 
whose key is the same as the first:


inputs = [(x > 5, x) for x in range(10)]
inputs += [(False, 10), (True, 11)]

g = groupby(inputs2 + [(True, 11)], key=itemgetter(0))
_, a = next(g)
_, b = next(g)
_, c = next(g)

print(list(a))
print(list(b))

Both `a` and `b` should probably be empty at this point, but they aren't.  

What if you kept track of the last iterable group and just consumed it at 
whenever `next` is called?  I think then you also need to keep track of whether 
or not the input iterable has been completely consumed, but that's not too bad 
either:

_sentinel = object()

class groupby:
# [k for k, g in groupby('BBBCCDAABBB')] --> A B C D A B
# [list(g) for k, g in groupby('BBBCCD')] -->  BBB CC D
def __init__(self, iterable, key=None):
if key is None:
key = lambda x: x
self.keyfunc = key
self.it = iter(iterable)
self.last_group = self.currkey = self.currvalue = _sentinel
self.empty = False

def __iter__(self):
return self

def __next__(self):
if self.last_group is not _sentinel:
for _ in self.last_group:
pass
if self.empty:
raise StopIteration

if self.currvalue is _sentinel:
try:
self.currvalue = next(self.it)
except StopIteration:
self.empty = True
raise
self.currkey = self.keyfunc(self.currvalue)
self.last_group = self._grouper(self.currkey, self.currvalue)
return (self.currkey, self.last_group)

def _grouper(self, tgtkey, currvalue):
while self.currkey == tgtkey:
yield self.currvalue
try:
self.currvalue = next(self.it)
except StopIteration:
self.empty = True
return
self.currkey = self.keyfunc(self.currvalue)

I haven't tested this to make sure it passes the test suite -- I also don't 
know if this would have major performance implications or anything.  If it did 
have severe performance implications, then it probably isn't worthwhile...

--
nosy: +mgilson

___
Python tracker 

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



[issue30181] Correct the parsing of a test case docstring.

2017-05-12 Thread Ben Finney

Ben Finney added the comment:

> if you upload a patch generated from your branch here, someone else will 
> create the github PR so we can get it processed.

The branch has several commits. I have generated the patches, and am now 
uploading them as a tarball.

It may be easier to simply merge from the Git branch, 
https://rocketgit.com/user/benf_wspdigital/cpython/source/log/branch/wip,issue,issue30181_parse-docstring-using-pydoc

--
Added file: http://bugs.python.org/file46859/issue30181-fix.cfc063a9.tar.gz

___
Python tracker 

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



[issue30181] Correct the parsing of a test case docstring.

2017-05-12 Thread Brian May

Brian May added the comment:

I have already created such a pull requests. It is bidirectionally linked to 
this ticket.

However concerns have been raised that the automatic bot hasn't recognised that 
Ben Finney has signed the CLA. Hence it appears the pull request might be 
rejected.

Sure there are currently problems with the pull request, and it fails the 
tests, however I am not going to spend any additional efforts fixing them 
unless this situation with the CLA can be resolved first.

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I suppose that when the input iterator is exhausted, we could poison the 
currkey to make the subordinate iterator ends as well:

def __next__(self):
while self.currkey == self.tgtkey:
try:
self.currvalue = next(self.it)
except StopIteration:
self.currkey = object()
raise StopIteration from None
self.currkey = self.keyfunc(self.currvalue)
self.tgtkey = self.currkey
return (self.currkey, self._grouper(self.tgtkey))

--

___
Python tracker 

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