[issue32349] Add detailed return value information for set.intersection function

2017-12-18 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

The implementation detail is not documented because it is not guaranteed.  The 
behavior has changed over time and other implementation are allowed to do 
something different.  For example, collections.abc.Set.__and__ has different 
behavior.

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



[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER *API* doesn't respect the latest 
Unicode standard. For example, it doesn't support this operation:

>>> "ß".upper()
'SS'

--

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is surprising. But OrderedDict also can be O(N) here.

Do you have benchmarking results Inada?

--

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread INADA Naoki

INADA Naoki  added the comment:

> This is surprising. But OrderedDict also can be O(N) here.

Current dict implementation doesn't skip empty entries.
So next(iter(D)) takes time.
On the other hand, OrderedDict uses doubly-linked list to find first entry.

(I fixed it in compact ODict branch, but it added one word to dict)

> Do you have benchmarking results Inada?

$ ./python -m perf timeit -s 'cache={}' -- '
for i in range(1):
if len(cache) > 512:
del cache[next(iter(cache))]
cache[i]=i
'
.
Mean +- std dev: 6.81 ms +- 0.08 ms

$ ./python -m perf timeit -s 'from collections import OrderedDict; 
cache=OrderedDict()' -- '
for i in range(1):
if len(cache) > 512:
cache.popitem(last=False)
cache[i]=i
'
.
Mean +- std dev: 3.75 ms +- 0.07 ms

Performance difference is measurable even when N is only 512.

Maybe, we can use hack similar to Python 3.5 had for O(1) popitem().
When entries[0].key==NULL, (Py_ssize_t)entries[0].value can be index
to first known non-empty entry.

--

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread INADA Naoki

INADA Naoki  added the comment:

Hmm, 0.3 μs for each lookup may be negligible compared to re.compile() speed?

--

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> del d[next(iter(d))] is not O(1) on current dict implementation.

We are talking about a dictionary of 512 items in the worst case. On such very 
tiny collection, benchmarking matters more than O(...) complexity ;-)

--
nosy: +vstinner

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

STINNER Victor  added the comment:


New changeset b2a6083eb0384f38839d3f1ed32262a3852026fa by Victor Stinner (Segev 
Finer) in branch 'master':
bpo-19764: Implemented support for subprocess.Popen(close_fds=True) on Windows 
(#1218)
https://github.com/python/cpython/commit/b2a6083eb0384f38839d3f1ed32262a3852026fa


--

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread INADA Naoki

INADA Naoki  added the comment:

> We are talking about a dictionary of 512 items in the worst case. On such 
> very tiny collection, benchmarking matters more than O(...) complexity ;-)

You're right. Rob Pike said:

"Fancy algorithms are slow when n is small, and n is usually small."
http://users.ece.utexas.edu/~adnan/pike.html

--

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

STINNER Victor  added the comment:

Copy of my comment on the PR.

https://github.com/python/cpython/pull/1218#issuecomment-352372211

>  Merged from master... Again... Hopefully this won't end up missing 3.7 
> entirely... 😔

Oops sorry, I wanted this feature but I didn't follow closely the PR.

I don't know well the Windows API, so I didn't want to take the responsability 
of reviewing (approving) such PR. But I see that @zooba and @gpshead approved 
it, so I'm now confortable to merge it :-) Moreover, AppVeyor validated the PR, 
so let me merge it.

I prefer to merge the PR right now to not miss the Python 3.7 feature freeze, 
and maybe fix issues later if needed, before 3.7 final.

Thank you @segevfiner for this major subprocess enhancement. I really love to 
see close_fds default changing to True on Windows. It will help to fix many 
corner cases which are very tricky to debug.

Sorry for the slow review, but the subprocess is a critical module of Python, 
and we lack of Windows developers to review changes specific to Windows.

--

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

STINNER Victor  added the comment:

Thank you Sergev Finer for finishing the implementation of my PEP 446. 
Supporting to only inherit a set of Windows handles was a "small note" my PEP 
446, mostly because I didn't feel able to implement the feature, but also 
because we still supported Windows versions which didn't implement this feature 
(PROC_THREAD_ATTRIBUTE_HANDLE_LIST) if I recall correctly.

Thanks Eryk Sun, Gregory P. Smith and Steve Dower for the reviews and help on 
getting this nice feature into Python 3.7!

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



[issue30121] Windows: subprocess debug assertion on failure to execute the process

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Oops, I merged the pull requests, but I forgot to close the issue.

--

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Nathaniel Smith

New submission from Nathaniel Smith :

Suppose you're writing a library that allows users to make or accept SSL/TLS 
connections. You use the 'ssl' module, because that's convenient. You need to 
let your users configure your SSL/TLS connections, and there really isn't any 
generic abstract way to do that -- SSL/TLS configuration is pretty complicated 
-- so you let your users set up an ssl.SSLContext and pass it into your API.

Later, you hit a limit in the ssl module and want to switch to PyOpenSSL, or 
perhaps eventually PEP 543. No problem: just switch what you're doing 
internally, and use some shim code to take the ssl.SSLContext objects that your 
users are passing in, and convert that to whatever your new library wants.

Except... ssl.SSLContext objects are almost entirely opaque. You can't read off 
the ciphers, or the ALPN protocols, or the servername_callback... so you're 
sunk. Once you expose ssl.SSLContext in your public API, you're stuck using the 
ssl module forever.

It would be nice if ssl.SSLContext provided getters that let you read off all 
the different configuration it holds.

--
assignee: christian.heimes
components: SSL
messages: 308533
nosy: alex, christian.heimes, dstufft, janssen, njs
priority: normal
severity: normal
status: open
title: Add getters for all SSLContext internal configuration

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread INADA Naoki

INADA Naoki  added the comment:

* del cache[next(iter(cache))] happens only when sre.compile() is called.
* del cache[next(iter(cache))] is much faster than sre.compile().

OK, performance difference is negligible, surely.

--

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2017-12-18 Thread INADA Naoki

Change by INADA Naoki :


--
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Save OrderedDict imports in various stdlibs.

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

I'm considering to add CAPI capsule to the _ssl module. It would allow third 
parties to get hold of the internal SSL* and SSL_CTX* pointers.

--

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Library (Lib)
dependencies: +Save OrderedDict import in argparse, Save OrderedDict import in 
re
type:  -> performance
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



[issue32336] Save OrderedDict import in argparse

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies: +Dict order is now guaranteed, so add tests and doc for it

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies: +Dict order is now guaranteed, so add tests and doc for it

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies: +Dict order is now guaranteed, so add tests and doc for it

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

Let's see what's missing:

* alpn_protocols -- OpenSSL doesn't have SSL_CTX_get_alpn_protos(), so we'd 
have to keep the list around ourselves.
* npn_protocols -- deprecated, I'd rather add a getter
* servername_callback -- simply expose the PyObject* from our struct
* ecdh_curve -- OpenSSL has no getter
* ciphers is covered by 
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.get_ciphers It 
doens't return the cipher string but the actual list of enabled ciphers with 
some extra metadata.

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-18 Thread Camion

New submission from Camion :

Hello, 

"PEP 3104 -- Access to Names in Outer Scopes" introduced the keywords "global" 
and "nonlocal". but didn't make clear (to me) if this behaviour is a bug, an 
intentional feature, or a design hole which might be considered good or bad. 

I have observed that when the nonlocal keyword gives acces to a grand parent 
function's variable, the presence in the parent function, of an access to a 
global variable with the same name, blocks it with a syntax error (SyntaxError: 
no binding for nonlocal 'a' found).


a = "a : global"
def f():
a = "a : local to f"
def g():
#global a # uncommenting this line causes a syntax error.
#a = a+", modified in g"
def h():
nonlocal a
a = a+", modified in h"
h()
print (f"in g : a = '{a}'")
g()
print (f"in f : a = '{a}'")
f()
print (f"glogal : a = '{a}'")

--
components: Interpreter Core
messages: 308537
nosy: Camion
priority: normal
severity: normal
status: open
title: global / nonlocal interference : is this a bug, a feature or a design 
hole ?
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



[issue32360] Save OrderedDict imports in various stdlibs.

2017-12-18 Thread INADA Naoki

New submission from INADA Naoki :

csv and re has issues already.
There are some remaining OrderdDict, including docstring.
It looks like some of them can be removed easily without doc update.

This is `ag --exclude-dir=test OrderedDict`, exluding csv, re, pprint and 
collections.

typing:
2109:nm_tpl.__annotations__ = nm_tpl._field_types = 
collections.OrderedDict(types)

unittest/util.py
3:from collections import namedtuple, OrderedDict
158:c = OrderedDict()

enum.py
153:enum_class._member_map_ = OrderedDict()  # name->value map
615:# We use an OrderedDict of sorted source keys so that the

lib2to3/pgen2/grammar.py
91:dump() recursively changes all dict to OrderedDict, so the pickled 
file
93:pickled file to create the tables, but  only changes OrderedDict to 
dict
94:at the top level; it does not recursively change OrderedDict to dict.
96:passed to load() in that some of the OrderedDict (from the pickled 
file)
98:performance because OrderedDict uses dict's __getitem__ with nothing 
in
142:return collections.OrderedDict(

asyncio/base_events.py
842:addr_infos = collections.OrderedDict()

configparser.py
142:from collections import OrderedDict as _default_dict, ChainMap as _ChainMap

inspect.py
52:from collections import namedtuple, OrderedDict
1712:new_params = OrderedDict(old_params.items())
2563:* arguments : OrderedDict
2663:self.arguments = OrderedDict(new_arguments)
2694:* parameters : OrderedDict
2724:params = OrderedDict()
2727:params = OrderedDict()
2762:params = OrderedDict(((param.name, param)
2839:arguments = OrderedDict()

json/tool.py
41:object_pairs_hook=collections.OrderedDict)

json/__init__.py
31:>>> from collections import OrderedDict
32:>>> mydict = OrderedDict([('4', 5), ('6', 7)])
290:collections.OrderedDict will remember the order of insertion). If
318:collections.OrderedDict will remember the order of insertion). If

json/decoder.py
297:collections.OrderedDict will remember the order of insertion). If

email/_header_value_parser.py
73:from collections import OrderedDict
720:params = OrderedDict()

pydoc_data/topics.py
8585: '"collections.OrderedDict" to remember the order that 
class '
8593: '   return collections.OrderedDict()\n'
8614: 'empty "collections.OrderedDict".  That mapping records 
the '

--

___
Python tracker 

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



[issue32362] multiprocessing.connection.Connection misdocumented as multiprocessing.Connection

2017-12-18 Thread Mark

New submission from Mark :

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Connection
 purports to document the multiprocessing.Connection class. There's no such 
thing:

Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> multiprocessing.Connection
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'multiprocessing' has no attribute 'Connection'

I think it should be multiprocessing.connection.Connection?

--
assignee: docs@python
components: Documentation
messages: 308539
nosy: Amery, docs@python
priority: normal
severity: normal
status: open
title: multiprocessing.connection.Connection misdocumented as 
multiprocessing.Connection
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32349] Add detailed return value information for set.intersection function

2017-12-18 Thread 양유석

양유석  added the comment:

Ok, I got a point of implementation-dependent things. Thank you for comments.

--

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

I opened an issue about missing getters for ALPN protos in OpenSSL 1.1: 
https://github.com/openssl/openssl/issues/4952

--

___
Python tracker 

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



[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-18 Thread Andrew Svetlov

Change by Andrew Svetlov :


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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Task result is given from coroutine execution, explicit modification of the 
value should be deprecated and eventually removed.

--
components: Library (Lib), asyncio
messages: 308542
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Deprecate task.set_result() and task.set_exception()
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue32364] Add AbstractFuture and AbstractTask

2017-12-18 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Asyncio supports custom future and task by third-party loop implementation.
Abstract classes for them is needed.

AbstractTask should not have set_result()/set_exception() maybe, is this case 
abstract base is needed (AbstractPromise, AbstractCancellableValue or whatever).

--
components: Library (Lib), asyncio
messages: 308543
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add AbstractFuture and AbstractTask
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



[issue32365] Referenc leak: test_ast test_builtin test_compile

2017-12-18 Thread STINNER Victor

New submission from STINNER Victor :

The following tests are leaking references: test_ast test_builtin test_compile.

It seems to be a regression introduced by the commit 
3325a6780c81f1ea51190370b5454879c4862a37, bpo-27169.

Serhiy: would you mind to take a look?

--
components: Tests
messages: 308544
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Referenc leak: test_ast test_builtin test_compile
type: resource usage
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



[issue32365] Referenc leak: test_ast test_builtin test_compile

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Python 3.6 and master are affected by the issue. Buildbots:

* x86 Gentoo Refleaks 3.x
* AMD64 Windows8.1 Refleaks 3.x
* AMD64 Windows8.1 Refleaks 3.6

--

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread STINNER Victor

Change by STINNER Victor :


--
title: Referenc leak: test_ast test_builtin test_compile -> Reference leak: 
test_ast test_builtin test_compile
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



[issue32366] suggestion:html.escape(s, quote=True) escape \n to

2017-12-18 Thread iMath

New submission from iMath :

It would be better if html.escape(s, quote=True) could escape linefeed to 
https://docs.python.org/3/library/html.html#html.escape

--
components: XML
messages: 308546
nosy: redstone-cold
priority: normal
severity: normal
status: open
title: suggestion:html.escape(s, quote=True) escape  \n to 
type: enhancement

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

I think we already hold onto the ALPN list internally.

A possibly stickier issue is retrieving certificates, keys, trust db 
configuration.

--

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +4810
stage:  -> patch review

___
Python tracker 

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



[issue27169] __debug__ is not optimized out at compile time for anything but `if:` and `while:` blocks

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4811

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

For certs and keys I have some plans. You might not be able to get hold of the 
actual private key bits, but it is always possible to get the public bits and 
key information.

The trust store information is pretty much opaque and often loaded by demand. 
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.get_ca_certs and 
https://docs.python.org/3/library/ssl.html#ssl.get_default_verify_paths is 
pretty much everything I know how to retrieve. If find more stuff, I'm more 
than happy to expose it.

--

___
Python tracker 

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



[issue27169] __debug__ is not optimized out at compile time for anything but `if:` and `while:` blocks

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset bd6ec4d79e8575df3d08f8a89ba721930032714c by Serhiy Storchaka in 
branch 'master':
bpo-32365: Fix a reference leak when compile __debug__. (#4916)
https://github.com/python/cpython/commit/bd6ec4d79e8575df3d08f8a89ba721930032714c


--

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset bd6ec4d79e8575df3d08f8a89ba721930032714c by Serhiy Storchaka in 
branch 'master':
bpo-32365: Fix a reference leak when compile __debug__. (#4916)
https://github.com/python/cpython/commit/bd6ec4d79e8575df3d08f8a89ba721930032714c


--

___
Python tracker 

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



[issue27169] __debug__ is not optimized out at compile time for anything but `if:` and `while:` blocks

2017-12-18 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4813

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4812

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 5659743b5693c9e23313a74117948294e35013f4 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-32365: Fix a reference leak when compile __debug__. (GH-4916) (#4918)
https://github.com/python/cpython/commit/5659743b5693c9e23313a74117948294e35013f4


--

___
Python tracker 

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



[issue32365] Reference leak: test_ast test_builtin test_compile

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thanks Victor.

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



[issue27169] __debug__ is not optimized out at compile time for anything but `if:` and `while:` blocks

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 5659743b5693c9e23313a74117948294e35013f4 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-32365: Fix a reference leak when compile __debug__. (GH-4916) (#4918)
https://github.com/python/cpython/commit/5659743b5693c9e23313a74117948294e35013f4


--

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2017-12-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> `recvfrom` from multicast socket is painfull slow.

What do you mean? Can you give results for a benchmark of your choice?  How 
much does your PR speed it up?

--
nosy: +pitrou

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2017-12-18 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
versions:  -Python 3.6, Python 3.8

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2017-12-18 Thread Matthias Klose

Matthias Klose  added the comment:

the patch looks ok. was it tested on a Debian or Ubuntu system to produce the 
same layout with this patch and without the new configure option?

--

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> I would add 'non-iterable', to get "cannot unpack non-iterable int object", 
> to tell people what is needed instead.

Doesn't this imply that there are iterable int objects which can be unpacked?

--

___
Python tracker 

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



[issue32276] there is no way to make tempfile reproducible (i.e. seed the used RNG)

2017-12-18 Thread R. David Murray

R. David Murray  added the comment:

IMO it is better to have an API that can be used when, for example, writing 
tests, than to monkey patch.  On the other hand, I've never had an occasion 
when I cared about the names of tempfiles (or directories) in my test code, and 
it is hard to imagine a circumstance when being able to reproduce the sequence 
of tempfile names chosen would matter for debugging...especially since which 
filenames are actually chosen from the randomly generated sequence can depend 
on other activity on the system.  So I concur with the rejection. 

I wouldn't object to some sort of API that allowed one to control the filename 
generation without worrying that later changes to the module would break ones 
code, but that isn't actually the use case here, so no one has actually asked 
for this feature ;)

--
nosy: +r.david.murray
resolution: fixed -> rejected

___
Python tracker 

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



[issue30416] constant folding opens compiler to quadratic time hashing

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

PR 4896 fixes this issue in 2.7, but I'm not sure that I want to merge it. The 
code in 2.7 is more complex because of two integer types.

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-18 Thread R. David Murray

Change by R. David Murray :


--
nosy: +r.david.murray

___
Python tracker 

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



[issue32234] Add context management to mailbox.Mailbox

2017-12-18 Thread sblondon

sblondon  added the comment:

If the access is read-only, the lock is not required [1].  However, I agree
it does not worth to be more complex (changing the signature of the
subclass or adding another context manager for the lock).
I updated the patch and documentation so the mailbox is locked at the
__enter__().

1:  For example, the first source code example at
https://docs.python.org/3/library/mailbox.html#examples

--

___
Python tracker 

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



[issue32366] suggestion:html.escape(s, quote=True) escape \n to

2017-12-18 Thread R. David Murray

R. David Murray  added the comment:

The point of html.escape is to sanitize a string that contains html such that 
*it does not get interpreted as html*.  So adding html markup would go against 
its purpose.  Further, including  in an attribute value (which is the 
purpose of quote=True) would make no sense and serve no purpose that I can see.

Clearly you have a use case in mind, but you did not describe it.  I would 
recommend posting to the python-list mailing list for advice on the best way to 
accomplish your use case.

--
components: +Library (Lib) -XML
nosy: +r.david.murray
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



[issue31900] localeconv() should decode numeric fields from LC_NUMERIC encoding, not from LC_CTYPE encoding

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Oh. Another Python function is impacted by the bug, str.format:

$ env -i python3 -c 'import locale; locale.setlocale(locale.LC_ALL, "fr_FR"); 
locale.setlocale(locale.LC_NUMERIC, "es_MX.utf8"); print(ascii(f"{1000:n}"))'
'1\xe2\x80\x89000'

It should be '1\u2009000' ('1', '\u2009', '000').

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-18 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4814

___
Python tracker 

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



[issue19977] Use "surrogateescape" error handler for sys.stdin and sys.stdout on UNIX for the C locale

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7. Python 3.7 will now use UTF-8 by default for the 
POSIX locale, and the encoding can be forced to UTF-8 using -X utf8 option.

--

___
Python tracker 

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



[issue29042] os.path.exists should not throw "Embedded NUL character" exception

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> A path containing an embedded NUL character simply cannot name an existing 
> file, and therefore os.path.exists should return False for such a path.

I disagree. Python doesn't call the syscall and so must raise a different 
exception.

You must not pass a path with embedded NULL character/byte. That's all.

Write your own wrapper to os.path.exists() if you want to a different behaviour.

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



[issue22016] Add a new 'surrogatereplace' output only error handler

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--
nosy: +vstinner

___
Python tracker 

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



[issue21368] Check for systemd locale on startup if current locale is set to POSIX

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue19846] Python 3 raises Unicode errors with the C locale

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue20329] zipfile.extractall fails in Posix shell with utf-8 filename

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> I don't think that we can fix this bug, sadly. But I'm happy to see that the 
> PEP 538 and PEP 540 are already useful!

Oops, I mean "we cannot *close* this bug" (right now). Sorry.

I mean that IMHO we still have to fix the bug.

--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-18 Thread Paul Ganssle

Paul Ganssle  added the comment:

> Not if the time is associated with a particular day. Imagine implementing 
> datetime.fromisoformat by separately calling date.fromisoformat and 
> time.fromisoformat. The date will be off by one day if you naively rounded 
> 2017-12-18 23:59 “up” to 2017-12-18 00:00.

Yes, I suppose this is a problem if you implement it that way. Seems like a 
somewhat moot point, but I think any decision about rounding should probably be 
driven by what people are expecting more than by how it is implemented.

That said, I can see a good case for truncation *and* rounding up for something 
like '2016-12-31T23:59:59.9'. Rounding up to '2017-01-01' is certainly 
the closest whole millisecond to round to, *but* often people expressing a 
"23:59:59.999" are trying to actually express "the last possible moment 
*before* 00:00".

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-18 Thread Camion

Camion  added the comment:

I forgot to mention, that I wonder if the interpreter shouldn't instead,
- either consider that since global a is used is g, it should be considered as 
also local to g from h point of view,
- or if h should be able to access f's version of a.
- (or if on the contrary, this ambiguity is the very reason to cause a syntax 
error, -- but in this case, one might need to change the text of the error 
message to make it more accurate. --)

--

___
Python tracker 

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



[issue32236] open() shouldn't silently ignore buffering=1 in binary mode

2017-12-18 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

I had similar thoughts when I was fixing tests that broke due to ValueError. 
I've updated the PR to issue a RuntimeWarning instead.

--

___
Python tracker 

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



[issue32367] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

New submission from STINNER Victor :

https://security-tracker.debian.org/tracker/CVE-2017-17522

Lib/webbrowser.py in Python through 3.6.3 does not validate strings before 
launching the program specified by the BROWSER environment variable, which 
might allow remote attackers to conduct argument-injection attacks via a 
crafted URL.

--
components: Library (Lib)
messages: 308572
nosy: vstinner
priority: normal
severity: normal
status: open
title: CVE-2017-17522: webbrowser.py in Python does not validate strings
type: security
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

Change by STINNER Victor :


--
title: CVE-2017-17522: webbrowser.py in Python does not validate strings -> 
[Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Stefan Nordhausen

New submission from Stefan Nordhausen :

The following code reproducibly segfaults in version 2.7.13, 3.6.3 and the 
current git master (3.7.0a3+):


code = "42 if True else 43\n" * 20
compile(code, "foobar", "exec")


This issue was originally found because the Jinja templating engine internally 
produces large tuples with many conditional expressions, thus triggering this 
bug (see https://github.com/pallets/jinja/issues/784 ).

--
components: Interpreter Core
messages: 308573
nosy: snordhausen
priority: normal
severity: normal
status: open
title: Segfault when compiling many conditional expressions
type: crash
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Red Hat: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-17522
Ubuntu: 
https://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-17522.html
SUSE: https://bugzilla.novell.com/show_bug.cgi?id=CVE-2017-17522

--

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

Looks like 174,565 stack frames are a bit too much :)

(gdb) bt
#0  dfs (c=0x7fffcbe0, b=0x7fffea076d60, a=0x7fffcb50) at 
Python/compile.c:4903
#1  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076db0, 
a=0x7fffcb50) at Python/compile.c:4903
#2  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076cc0, 
a=0x7fffcb50) at Python/compile.c:4903
#3  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076d10, 
a=0x7fffcb50) at Python/compile.c:4903
#4  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076c20, 
a=0x7fffcb50) at Python/compile.c:4903
#5  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076c70, 
a=0x7fffcb50) at Python/compile.c:4903
#6  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076b80, 
a=0x7fffcb50) at Python/compile.c:4903
#7  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076bd0, 
a=0x7fffcb50) at Python/compile.c:4903
#8  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076ae0, 
a=0x7fffcb50) at Python/compile.c:4903
#9  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076b30, 
a=0x7fffcb50) at Python/compile.c:4903
#10 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076a40, 
a=0x7fffcb50) at Python/compile.c:4903
#11 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076a90, 
a=0x7fffcb50) at Python/compile.c:4903
#12 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea0769a0, 
a=0x7fffcb50) at Python/compile.c:4903
#13 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea0769f0, 
a=0x7fffcb50) at Python/compile.c:4903
#14 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076900, 
a=0x7fffcb50) at Python/compile.c:4903

(gdb) bt -50
...
#174562 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x704609a0, 
a=0x7fffcb50) at Python/compile.c:4903
#174563 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x704609f0, 
a=0x7fffcb50) at Python/compile.c:4903
#174564 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x70460900, 
a=0x7fffcb50) at Python/compile.c:4903
#174565 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x70460950, 
a=0x7fffcb50) at Python/compile.c:4903
#174566 0x004e47a2 in dfs (c=c@entry=0x7fffcbe0, 
b=b@entry=0x704608b0, a=a@entry=0x7fffcb50) at Python/compile.c:4903
#174567 0x004e9844 in assemble (c=c@entry=0x7fffcbe0, 
addNone=) at Python/compile.c:5411
#174568 0x004ed809 in compiler_mod (c=c@entry=0x7fffcbe0, 
mod=mod@entry=0x3523788) at Python/compile.c:1494
#174569 0x004eda33 in PyAST_CompileObject (mod=0x3523788, 
filename=filename@entry='foobar', flags=flags@entry=0x7fffccb4, 
optimize=optimize@entry=-1, arena=arena@entry=0x70466f40)
at Python/compile.c:345
#174570 0x0050fcaa in Py_CompileStringObject (
str=0x7fffef9d1070 "42 if True else 43\n42 if True else 43\n42 if True else 
43\n42 if True else 43\n42 if True else 43\n42 if True else 43\n42 if True else 
43\n42 if True else 43\n42 if True else 43\n42 if True else 43\n42 if True"..., 
filename=filename@entry='foobar', start=start@entry=257, 
flags=flags@entry=0x7fffccb4, optimize=optimize@entry=-1) at 
Python/pythonrun.c:1098
#174571 0x004d2146 in builtin_compile_impl (module=module@entry=,

--
nosy: +christian.heimes

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Duplicate of issue31113?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread Charalampos Stratakis

Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

I think so, too.

--

___
Python tracker 

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



[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


Added file: https://bugs.python.org/file47337/bench.py

___
Python tracker 

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



[issue32364] Add AbstractFuture and AbstractTask

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

+1, let's do it.  I'd add a new module - 'asyncio.abc' and put them both there 
(as well as asyncio.isfuture() function).

--

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

+1.

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-18 Thread R. David Murray

R. David Murray  added the comment:

What is happening here is that what nonlocal does is give the function 
containing the nonlocal statement access to the "cell" in the parent function 
that holds the local variable of that function.  When you use a global 
statement, the name instead refers to a global variable, and  there is no local 
cell created for that variable name.  Thus you get "no binding [cell] for 
nonlocal 'a' found".  That is literally correct from the compiler's point of 
view.

I agree that this message is mysterious unless you understand how python 
scoping works at a fairly detailed level, and thus it would be nice if the 
error message could be improved.  The code generating the message may not know 
that there's a global statement for that name in effect, though, so it might 
not be trivial to improve it.

Would it be possible for nonlocal to effectively "chain", and turn the 
references in the inner function into global references?  In theory the answer 
would be yes, but in practice it might be distinctly non-trivial, and would 
probably be a PEP level change to the language.  It is currently documented 
that nonlocal does not look in to the global namespace 
(https://docs.python.org/3/reference/simple_stmts.html#nonlocal): "The nonlocal 
statement causes the listed identifiers to refer to previously bound variables 
in the nearest enclosing scope excluding globals.)

--

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

The last part of test_close_fds() doesn't match its own comment. The following 
assertion always holds because fds_to_keep and open_fds are disjoint by 
construction.

self.assertFalse(remaining_fds & fds_to_keep & open_fds,
 "Some fds not in pass_fds were left open")

--
components: Tests
messages: 308581
nosy: izbyshev
priority: normal
severity: normal
status: open
title: test_subprocess: last part of test_close_fds() doesn't check what's 
intended
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
nosy: +gregory.p.smith, pitrou

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
keywords: +patch
pull_requests: +4815
stage:  -> patch review

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Gregory P. Smith

Gregory P. Smith  added the comment:


New changeset 2d8f06382e7d5a759ca554110a699a397114824a by Gregory P. Smith 
(izbyshev) in branch 'master':
bpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)
https://github.com/python/cpython/commit/2d8f06382e7d5a759ca554110a699a397114824a


--

___
Python tracker 

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



[issue32278] Allow dataclasses.make_dataclass() to omit type information

2017-12-18 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm going to use "typing.Any" (as a string) if the type information is omitted 
in the call to make_dataclass(). That way I don't need to import typing.

--

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In English, 'adjective noun' does not necessarily imply the existence of 
'not-adjective' nouns, and the adjective may serve as a reminder or reason.  
For instance, "This job is too dangerous for mortal humans!"

In the current context, failure of 'iter(ob)', by itself, only tells us that 
the particular object ob is not iterable. "'X' object is not iterable", rather 
that "'X' objects are not iterable", is correct.  (Ditto for other messages.)

That said, I think "cannot unpack int object, because not iterable" is better.

--

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Is it worth to emit more specific (but possible uniform) error messages in 
other unpacking cases (see msg307999)?

FYI if a class implements __iter__ which returns non-iterable, the following 
error is raised:

>>> class C:
... def __iter__(self):
... return 1
... 
>>> a, b = C()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: iter() returned non-iterator of type 'int'

--

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-18 Thread Brett Cannon

Brett Cannon  added the comment:

Yep, I assumed implementing the ReourceReader API would be a separate step.

As for the type hints, I thought it was lifted such that new code could include 
it but we wouldn't be taking PRs to add them to pre-existing code?

--

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset d757aaf9dd767d13205bf9917e520ebf43e7f6e5 by Yury Selivanov in 
branch 'master':
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)
https://github.com/python/cpython/commit/d757aaf9dd767d13205bf9917e520ebf43e7f6e5


--

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue20891] PyGILState_Ensure on non-Python thread causes fatal error

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

I ran pyperformance on my PR 4700. Differences of at least 5%:

haypo@speed-python$ python3 -m perf compare_to 
~/json/uploaded/2017-12-18_12-29-master-bd6ec4d79e85.json.gz 
/home/haypo/json/patch/2017-12-18_12-29-master-bd6ec4d79e85-patch-4700.json.gz 
--table --min-speed=5

+--+--+-+
| Benchmark| 2017-12-18_12-29-master-bd6ec4d79e85 | 
2017-12-18_12-29-master-bd6ec4d79e85-patch-4700 |
+==+==+=+
| pathlib  | 41.8 ms  | 44.3 ms: 1.06x 
slower (+6%) |
+--+--+-+
| scimark_monte_carlo  | 197 ms   | 210 ms: 1.07x 
slower (+7%)  |
+--+--+-+
| spectral_norm| 243 ms   | 269 ms: 1.11x 
slower (+11%) |
+--+--+-+
| sqlite_synth | 7.30 us  | 8.13 us: 1.11x 
slower (+11%)|
+--+--+-+
| unpickle_pure_python | 707 us   | 796 us: 1.13x 
slower (+13%) |
+--+--+-+

Not significant (55): 2to3; chameleon; chaos; (...)

--

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

This issue is not specific to Linux. FreeBSD is also affected:

>>> s=socket.socket()
>>> s.type

>>> s.setblocking(False)
>>> s.type
536870913

See for example https://sourceware.org/ml/libc-alpha/2013-08/msg00528.html

--

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

> This issue is not specific to Linux. FreeBSD is also affected:

So instead of '#ifdef __linux__' we should use `#ifdef SOCK_NONBLOCK` etc.  
I'll update the PR.

--

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

> But I would prefer to avoid a syscall just to clear flags :-/

Yes, that's what I want to do.

We control what constants the socket module exports. Let's just clear them if 
we export them -- that's a good working solution (and also the most backwards 
compatible, as opposed to calling sock.getsockopt)

--

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

The most portable solution seems to getsockopt():

>>> s.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE)
1

But I would prefer to avoid a syscall just to clear flags :-/

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 6efcb6d3d5911aaf699f9df3bb3bc26e94f38e6d by Victor Stinner in 
branch 'master':
bpo-32030: Fix compilation on FreeBSD, #include  (#4919)
https://github.com/python/cpython/commit/6efcb6d3d5911aaf699f9df3bb3bc26e94f38e6d


--

___
Python tracker 

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



[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yeah, I'm not entirely sure whether fixing this is actually doable or 
worthwhile, but figured I should at least make an issue to discuss :-).

The problem is, in the motivating use case of wanting to be able to reliably 
convert an SSLContext into some other representation, we really need to be able 
to get 100% of the configuration out. I think the trust configuration can 
probably be handled in principle by remembering the arguments to any calls to 
load_verify_locations, so they can be replayed later. But... that won't work 
for private keys, because if they're password-protected then replaying a call 
to load_cert_chain will end up prompting for the password twice. So maybe we 
really would need a way to pull out the actual private key bits. And if we 
can't do that, then maybe it's not worth stressing about the other stuff 
either...

--

___
Python tracker 

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



[issue32245] OSError: raw write() returned invalid length on latest Win 10 Consoles

2017-12-18 Thread Segev Finer

Segev Finer  added the comment:

Upstream issue https://github.com/Microsoft/console/issues/40, also has links 
to similar issues this caused in other projects.

--
nosy: +Segev Finer

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I retested and iter(ob) (1) apparently raises 'not iterable' only when it can 
find neither __iter__ nor __getitem__.  It (2) raises 'non-iterator', as above, 
when it finds  __iter__, calls its, and get a non-iterator.  (3) Exceptions in 
__iter__ are passed through.  (If it finds and wraps __getitem__, errors only 
appear during iteration.)

The current patch for assignment unpacking catches case (1) with 
"v->ob_type->tp_iter == NULL && !PySequence_Check(v))".  Removing this would 
catch case (2) and incidentally case (3) TypeErrors.  Not catching user 
TypeErrors would require looking at the message.  I intentionally am not 
proposing to remove the TypeError check.

Presuming the existence of a PyErr_' function to get exception messages, we 
could simply prefix the existing message with a short 'Cannot unpack. '  The 
same could be done for the other cases in msg307999, but I don't know if they 
are subject to the same need.

--

___
Python tracker 

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



[issue32370] Wrong ANSI encoding used by subprocess for some locales

2017-12-18 Thread Segev Finer

New submission from Segev Finer :

The following test is failing randomly for me (python -m test test_uuid -v):
==
ERROR: test_ipconfig_getnode (test.test_uuid.TestInternalsWithoutExtModule)
--
Traceback (most recent call last):
  File "cpython\lib\test\test_uuid.py", line 551, in test_ipconfig_getnode
node = self.uuid._ipconfig_getnode()
  File "cpython\lib\uuid.py", line 487, in _ipconfig_getnode
for line in pipe:
  File "cpython\lib\encodings\cp1255.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 682: 
character maps to 

This is caused by trying to decode the output of "ipconfig" using cp1255, while 
the output really uses cp862 and annoyingly it started to print times using the 
current locale (Which displays broken in the console anyhow, question mark 
boxes... *sigh*) in some Windows version (Using Windows 10.0.16299 ATM).

--
components: Windows
messages: 308597
nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Wrong ANSI encoding used by subprocess for some locales
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue31803] time.clock() should emit a DeprecationWarning

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

I read again the whole issue and I dislike the "time.clock becomes an alias to 
time.perf_counter" idea. Calling time.clock() now emits a deprecation warning, 
the issue is fixed, so I close it.

Many discussions were about removal of the function. IHMO it's out of the scope 
of this specific issue and should be discussed later, once someone will propose 
to remove time.clock().

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



[issue32324] [Security] "python3 directory" inserts "directory" at sys.path[0] even in isolated mode

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

A compromise would be to refuse to start on "python3 -I directory" to remain 
secure and respect -I documentation:

https://docs.python.org/dev/using/cmdline.html#id2

"In isolated mode sys.path contains neither the script’s directory nor the 
user’s site-packages directory."

Example of error message:

"Running a Python package is incompatible with the isolated mode (-I option)"

--

___
Python tracker 

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



[issue19100] Use backslashreplace in pprint

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

$ LANG= ./python -c "import pprint; pprint.pprint('\u20ac')"

Thanks to the PEP 538 and PEP 540, this command now works as expected in Python 
3.7:

vstinner@apu$ LANG= python3.7 -c "import pprint; pprint.pprint('\u20ac')"
'€'

Do we still need pprint_unencodable_2.patch workaround?

--
nosy: +vstinner

___
Python tracker 

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



  1   2   >