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

2017-12-19 Thread Camion

Camion  added the comment:

Even in the code !??
I may have missed something, but I based my question on what I read in the pull 
request...

--

___
Python tracker 

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



[issue27942] Default value identity regression

2017-12-19 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -1087

___
Python tracker 

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



[issue28791] update SQLite libraries for Windows and macOS installers

2017-12-19 Thread Ned Deily

Ned Deily  added the comment:

Looks like unless Benjamin would like 2.7.x updated, this can now be closed.

--
assignee:  -> benjamin.peterson
priority: deferred blocker -> 
status: open -> pending

___
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-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What do you suggest to do with 2.7? Revert the changes that introduced the 
regression, merge the backported fix, or keep all as is?

--

___
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-19 Thread Stefan Krah

Stefan Krah  added the comment:

> Does it makes sense to have the presence of "global a" in g, block all 
> possibility for h, to access it's grand parent's a ?

>From the perspective of ML-style languages with pure lexical scoping, no, it 
>does not make sense.


But Python started with C-like simple name spaces, then nested functions and 
'nonlocal' were added.


I think the answer (as usual) is that people may rely on the established 
convention and that it is no problem in practice.

--
nosy: +skrah

___
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-19 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Yes, in the code for the the unpack message test, the specific non-iterable is 
not relevant.  These are not tests of the iter builtin.

--

___
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-19 Thread Camion

Camion  added the comment:

Ok then. Thank you :-)

It also seemed strange that there were so many messages about int ;-)

--

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

Change by STINNER Victor :


--
nosy: +martin.panter

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

STINNER Victor  added the comment:


New changeset 5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a by Victor Stinner in 
branch 'master':
bpo-32030: Fix compiler warnings (#4921)
https://github.com/python/cpython/commit/5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a


--

___
Python tracker 

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



[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset a7bd64c0c01379e9b82e86ad41a301329a0775d9 by Yury Selivanov in 
branch 'master':
bpo-27456: Simplify sock type checks (#4922)
https://github.com/python/cpython/commit/a7bd64c0c01379e9b82e86ad41a301329a0775d9


--

___
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-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
priority: normal -> high

___
Python tracker 

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



[issue32073] Add copy_directory_metadata parameter to shutil.copytree

2017-12-19 Thread desbma

desbma  added the comment:

Ping

--

___
Python tracker 

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



[issue32287] Import of _pyio module failed on cygwin

2017-12-19 Thread Erik Bray

Erik Bray  added the comment:

Indeed, this is a duplicate of #28459.  I'll also update the existing patch to 
a pull request.

--
resolution:  -> duplicate
stage: needs patch -> 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



[issue28459] _pyio module broken on Cygwin / setmode not usable

2017-12-19 Thread Erik Bray

Erik Bray  added the comment:

Right, the current patch is really combining several issues.  I'll make  a PR 
from it that just fixes the _pyio issue.  I'll also open an issue for fixing 
the ctypes bug (this is a patch I've had in my cygwin branch for ages but just 
never got around to making a report for...)

--

___
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-19 Thread Yury Selivanov

Change by Yury Selivanov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> performance

___
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-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset a9d7e552c72b6e9515e76a1dd4b247da86da23de by Yury Selivanov in 
branch 'master':
bpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915)
https://github.com/python/cpython/commit/a9d7e552c72b6e9515e76a1dd4b247da86da23de


--

___
Python tracker 

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



[issue32355] Optimize asyncio.gather()

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 36c2c044782997520df7fc5604742a615ccf6b17 by Yury Selivanov in 
branch 'master':
bpo-32355: Optimize asyncio.gather() (#4913)
https://github.com/python/cpython/commit/36c2c044782997520df7fc5604742a615ccf6b17


--

___
Python tracker 

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



[issue32355] Optimize asyncio.gather()

2017-12-19 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



[issue29711] When you use stop_serving in proactor loop it's kill all listening servers

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 319c0345cdd8fddb49d235462e71883f1dd51b99 by Yury Selivanov 
(Julien Duponchelle) in branch 'master':
bpo-29711: Fix stop_serving in proactor loop kill all listening servers (#431)
https://github.com/python/cpython/commit/319c0345cdd8fddb49d235462e71883f1dd51b99


--

___
Python tracker 

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



[issue29711] When you use stop_serving in proactor loop it's kill all listening servers

2017-12-19 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue32368] Segfault when compiling many conditional expressions

2017-12-19 Thread Stefan Nordhausen

Stefan Nordhausen  added the comment:

I tried out PR 3015 of Serhiy and this fixes the segfaults. So it seems to be a 
duplicate.

As for backporting the fix: Is this a 'reliable' segfault (i.e. it always 
segfaults when the limit is exceeded) or could there be some silent data 
corruption? If data can be corrupted, I'd consider this bug very serious, 
otherwise it's a rather small annoyance.

--

___
Python tracker 

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



[issue31954] Don't prevent dict optimization by coupling with OrderedDict

2017-12-19 Thread INADA Naoki

INADA Naoki  added the comment:

pyperformance doesn't show significant performance degration.  (using commit 
5d8d3d1)

$ ./python -m perf compare_to -G --min-speed=2 default.json patched.json
Slower (5):
- pickle_list: 9.40 us +- 0.98 us -> 9.96 us +- 1.20 us: 1.06x slower (+6%)
- pickle_dict: 63.1 us +- 0.6 us -> 65.6 us +- 5.2 us: 1.04x slower (+4%)
- regex_effbot: 5.39 ms +- 0.09 ms -> 5.60 ms +- 0.35 ms: 1.04x slower (+4%)
- genshi_xml: 188 ms +- 2 ms -> 193 ms +- 3 ms: 1.03x slower (+3%)
- pickle: 22.4 us +- 0.2 us -> 22.9 us +- 0.3 us: 1.02x slower (+2%)

Faster (5):
- mako: 38.8 ms +- 0.2 ms -> 37.6 ms +- 0.2 ms: 1.03x faster (-3%)
- regex_v8: 44.3 ms +- 0.7 ms -> 43.1 ms +- 0.4 ms: 1.03x faster (-3%)
- scimark_monte_carlo: 254 ms +- 10 ms -> 248 ms +- 6 ms: 1.03x faster (-3%)
- scimark_fft: 740 ms +- 20 ms -> 721 ms +- 14 ms: 1.03x faster (-2%)
- regex_dna: 289 ms +- 5 ms -> 282 ms +- 9 ms: 1.02x faster (-2%)

Benchmark hidden because not significant (50)...

--

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset c5ae169e1b73315672770517bf51cf8464286c76 by Victor Stinner 
(Michael Felt) in branch 'master':
bpo-26439 Fix ctypes.util.find_library failure on AIX (#4507)
https://github.com/python/cpython/commit/c5ae169e1b73315672770517bf51cf8464286c76


--
nosy: +vstinner

___
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-19 Thread Daniel Holmes

Daniel Holmes  added the comment:

I wanted to note here... I've been trying to get strptime to work with the 
types of dates specified in this request and came across a documentation bug 
here: https://docs.python.org/3.5/library/time.html#time.strptime

You can see that the %z attribute's examples given have colons in them while 
the format specified is +HHMM rather than +HH:MM which the examples illude to.

--
nosy: +jaitaiwan

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

Michael Felt: I merged your PR 🎉🍰✨ ! Thank you very much for your patience and 
perseverance. 80 comments on this bug, 117 comments and 19 commits in the PR... 
wow! AIX is not dead 😄

I leave the bug open since Martin, Mariatta and me were interested to make 
further minor coding style changes.

--

___
Python tracker 

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



[issue32371] Delay-loading of python dll is impossible when using some C macros

2017-12-19 Thread Pierre Chatelier

New submission from Pierre Chatelier :

Delay-loading of the python DLL is impossible when using some C macros.

For instance, PyLong_Check() is OK, but PyBool_Check() or PyFunc_Check() 
will eventually raise a link error.

This is due to the fact that PyBool_Check() directly use the PyBool_Type symbol 
instead of getting a reference through a function.

For the same reason, Py_False and Py_True are problematic.

--
components: Windows
messages: 308639
nosy: Pierre Chatelier, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Delay-loading of python dll is impossible when using some C macros
type: compile error
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



[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

Yury: thanks for fixing socket.socket.type. asyncio code now looks simpler and 
easier to follow without the helper functions just to test the socket type for 
equality.

--

___
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-19 Thread R. David Murray

R. David Murray  added the comment:

Right, it was indeed "designed that way" in the sense that nolocal was only 
ever intended to access variables from the surrounding local scope, *not* the 
global scope.  If you put a variable name in the global scope, nonlocal was not 
intended to be able to access it (it is then a global variable, not a local 
variable).

So the only question that keeps this issue open is can the error message be 
improved for the case where a global declaration affects the variable name in 
question (the message is clear when there is no variable with that name in the 
outer function at all).

Any change to this design would be an enhancement request and discussion of it 
should start on the python-ideas mailing list.

--

___
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-19 Thread R. David Murray

R. David Murray  added the comment:

When I said "the only thing keeping this issue open" is the message, I should 
acknowledge that you mentioned clarifying the documentation, but as I pointed 
out the documentation is already clear: it says nonlocal does not access 
variables in the global scope, and in your example 'a' is a variable in the 
global scope, because it is declared to be one.  We generally don't update PEPs 
after they are accepted and implemented; after that point the documentation is 
the real reference since the implementation may actually be different in detail 
than the PEP due to later enhancements. The PEP is still useful as an 
historical document.  (There are exceptions to that, but that is the general 
rule.)

--

___
Python tracker 

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



[issue32372] Optimize out __debug__ at the AST level

2017-12-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

__debug__ is substituted by the constant value at the code generation stage 
(see issue27169). This prevents it from participating in constant folding at 
the AST level. The proposed patch moves this optimization to the AST level. 
This will lead to optimizing "if not __debug__" and will allow to add more 
optimizations at the AST level (like optimizing expressions "a if __debug__ 
else b" and "__debug__ and a").

--
assignee: serhiy.storchaka
components: Interpreter Core
messages: 308643
nosy: inada.naoki, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize out __debug__ at the AST level
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



[issue32372] Optimize out __debug__ at the AST level

2017-12-19 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
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-19 Thread Stefan Krah

Stefan Krah  added the comment:

I guess I'd vote for closing this, because the first Google result for "no 
binding for nonlocal" on Stackoverflow is quite clear.

The ideal message would be "'a' cannot be both global and nonlocal", but
it would probably complicate the compiler ever so slightly.

--

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

New submission from Yury Selivanov :

Currently we have the following methods:

* socket.settimeout(t) -- can set the socket in blocking mode, when t==0.
* socket.setblocking(flag) -- sets in blocking or non-blocking mode.
* socket.gettimeout() -- returns 0 when socket is in non-blocking mode.

socket.gettimeout() is the only easy way of checking if the socket is 
non-blocking or blocking, but it's not intuitive to use it.  It's especially 
strange that we have a setblocking() method without a corresponding 
getblocking().

I propose to add a 'socket.getblocking() -> bool' method.

--
assignee: yselivanov
components: Library (Lib)
messages: 308645
nosy: yselivanov
priority: normal
severity: normal
status: open
title: Add socket.getblocking() method
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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +asvetlov, vstinner

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Change by Yury Selivanov :


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

___
Python tracker 

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



[issue32306] Clarify map API in concurrent.futures

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Hi David,

> what happens behind the scenes is that the call blocks until all results are 
> computed and only then starts yielding them.

The current implementation of the Executor.map() generator is:

def result_iterator():
try:
# reverse to keep finishing order
fs.reverse()
while fs:
# Careful not to keep a reference to the popped future
if timeout is None:
yield fs.pop().result()
else:
yield fs.pop().result(end_time - time.time())
finally:
for future in fs:
future.cancel()


So it seems to me that results are yielded as soon as they arrive (provided 
they arrive in the right order).

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, pitrou
type: enhancement -> behavior
versions: +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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Petr Viktorin

New submission from Petr Viktorin :

After the create phase of multiphase initialization, the per-module state is 
NULL and the module object is reachable by the garbage collector. Between the 
create and exec phases, Python code is run and garbage collection can be 
triggered.
So, any custom m_traverse/m_clear/m_free function must be prepared to handle 
m_state being NULL. This is currently not well documented.

It might be useful to insert a call m_traverse after the first phase, at least 
in --with-pydebug mode, so the potential error gets triggered early.

--
components: Extension Modules
messages: 308647
nosy: encukou
priority: normal
severity: normal
status: open
title: Document that m_traverse for multi-phase initialized modules can be 
called with m_state=NULL
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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Petr Viktorin

Petr Viktorin  added the comment:

Marcel, could you look into this?

--
nosy: +Dormouse759

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Marcel Plch

Change by Marcel Plch :


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

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

So calling urandom() hangs on your device because there's not enough entropy?  
What OS is this running?  Modern Linux, at least, should never block in 
urandom() (AFAIK).

--
nosy: +christian.heimes, pitrou
type: behavior -> 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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +scoder

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

By the way, I think you forgot to answer my question on python-dev:

> can you get multi-interpreter support *without* PEP 489?  That is, using 
> single-phase initialization and PyModule_GetState().

The doc currently isn't very clear about this.

--
nosy: +pitrou

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
type:  -> behavior

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

> Found on Python 3.6 on a low-resource platform (NI RoboRIO), ...

Hum, it looks like an "embedded device", likely with no entropy source.

To check if os.urandom() will block, try to call the following function in your 
main script:

>>> import os; os.getrandom(1, flags=os.GRND_NONBLOCK)
b'\xd1'

os.urandom() blocks at system startup until the entropy pool is initialized 
with 128 bytes of entropy. Once it's initialized, os.urandom() will never block 
again.

You may also check the number of entropy bytes available to /dev/random (Python 
uses /dev/urandom which is different):

$ cat /proc/sys/kernel/random/entropy_avail 
3748

For a longer explanation, see the PEP 524.

--
nosy: +vstinner

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I get the feeling (without actually investigating) that this is because a 
fork()-created process inherits all the parent's configuration, including (in 
this case) signal handlers and whatever file descriptor was configured to 
receive signal events using signal.set_wakeup_fd().  So the child process, when 
it receives a signal, also writes on that file descriptor which happens to be 
the same  underlying self-pipe as in the parent.

In Python 3.6 it seems there isn't much you can't do against this (well, 
nothing obvious, in any case). In Python 3.7, you'll have two fixes available 
in ProcessPoolExecutor (*):

* either pass an initializer function that resets signal configuration to a 
sane default state
* or pass a "forkserver" multiprocessing context that will avoid inheritance 
issues in the process pool workers

(*) see docs at 
https://docs.python.org/3.7/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor

I would generally recommend using "forkserver" whenever possible, since it 
eliminates all those inheritance issues by design.

--
nosy: +njs, pitrou
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



[issue32375] Compilation warnings with gcc

2017-12-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

On Ubuntu 16.04:

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make
[...]
In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:797:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:806:9:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_argv0_path’ at ./Modules/getpath.c:683:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_argv0_path’ at ./Modules/getpath.c:736:13:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^

--
components: Interpreter Core
messages: 308653
nosy: pitrou, serhiy.storchaka, vstinner
priority: low
severity: normal
status: open
title: Compilation warnings with gcc
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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 19/12/2017 à 15:50, STINNER Victor a écrit :
> 
> Hum, it looks like an "embedded device", likely with no entropy source.

If it does I/O (which it probably does, being used for robotics), it
should certainly be able to extract entropy from the outside world.

If it doesn't, it's an OS implementation issue.

Of course it probably doesn't hurt to import concurrent.futures lazily.
However, people should generally not expect us to never call urandom()
when importing stdlib modules.

--

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Dustin Spicuzza

Dustin Spicuzza  added the comment:

I'm sure that the platform (a RT linux customized by National Instruments) has 
issues related to urandom, as this has reared it's ugly head with other PEP 525 
related issues also: https://bugs.python.org/issue29208

I'll have to try those suggestions to investigate the os.urandom issue.

--

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

It looks like we have a bug with 'sock.settimeout()' and non-blocking/blocking 
modes (or maybe this is a feature?)

Currently:

* to make a socket non-blocking, we call 'sock.settimeout(0)'.

* to make a socket blocking, we call 'sock.settimeout(None)'.


What happens if we call sock.settimeout(t), where t > 0?  The internal timeout 
field of the socket object will simply be set to 't'.  What happens if the 
socket was in a non-blocking mode?  Nothing, it stays in non-blocking mode.

What it means: suppose you have a non-blocking socket.  You call 
socket.settimeout(10), and most likely you wanted to make it blocking again.  
Because all operations on the socket become blocking from moment (sock_call_ex 
repeats on EWOULDBLOCK and EAGAIN).

Now is having a timeout and blocking send/recv methods on a non-blocking socket 
a feature? Or is this a bug?

--
nosy: +njs, pitrou

___
Python tracker 

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



[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread Dmitry sky

New submission from Dmitry sky :

def get_search_url(from_, to):
return f"http://thesite.com/Search?SO0={from_}&SD0={to}&SD1={from}&NA=false";
#   pls note `from_` vs `from`  ^^


$ python fstring.py
  File "", line 1
(from)
^
SyntaxError: invalid syntax


Should report real line #.

--
components: Interpreter Core
files: fstring.py
messages: 308657
nosy: Dmitry sky
priority: normal
severity: normal
status: open
title: Unusable syntax error reported when Python keyword in a f-string
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47338/fstring.py

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Now is having a timeout and blocking send/recv methods on a non-blocking 
> socket a feature? Or is this a bug?

I agree it's a bug (but should only be fixed in 3.7).

Also I agree with adding a socket.getblocking() method.

--

___
Python tracker 

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



[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread Eric V. Smith

Eric V. Smith  added the comment:

Yes, this is a real problem. I think there's already an issue for this, but I 
can't find it.

Unfortunately, to fix it requires a bit of refactoring on how line numbers and 
errors are tracked. It's on my list of things to do.

--
nosy: +eric.smith
stage:  -> needs patch

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Eric Cousineau

New submission from Eric Cousineau :

Due to how `PyObject_CallFinalizer` is written in python3, `__del__` will only 
*ever* be called once.

In my use case, I am experimenting with a feature in `pybind11` to prevent 
slicing with Python class instances that inherit from pybind11-C++ base 
classes, which involves detecting when an instance loses all reference in 
Python (`Py_REFCNT(...) == 0`) but still has reference in C++ 
(`shared_ptr::count() > 0`), and reviving the Python portion when this 
situation happens.

In python2, I could do this without a hitch, as a resurrected object could have 
its `__del__` method called multiple times (through `tp_dealloc` I believe?). 
But in python3, the object is marked with `_PyGC_SET_FINALIZED(...)`, thus 
preventing `__del__` from being called again.

It'd be nice to either (a) somehow allow `__del__` to be called naturally 
without too much fuss or, at the least, (b) have this reflected in the 
documentation:
https://docs.python.org/3/reference/datamodel.html#object.__del__

See attached `revive_test`. Example execution:

```
$ python2 ./revive_test.py 
Revive
Destroy
[ Done ]

$ python3 ./revive_test.py 
Revive
[ Done ]
```

--
assignee: docs@python
components: Documentation
files: revive_test.py
messages: 308660
nosy: Eric Cousineau, docs@python
priority: normal
severity: normal
status: open
title: Difference in ressurrection behavior with __del__ in py2 vs. py3
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47339/revive_test.py

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the report.  Apparently I forgot to update that piece of 
documentation when PEP 442 was implemented.

--
nosy: +pitrou
stage:  -> needs patch
versions: +Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Eric Cousineau

Eric Cousineau  added the comment:

You're welcome, and thank you for the prompt response!

I will say that it feels a tad odd to only have `tp_finalize` be called once 
for the entire lifetime of the object, while still having the option of it 
being resurrected.
Is there any way to somehow "un-mark" the object to enable this workflow that I 
would like to have?

My current hack is to call `_PyGC_SET_FINALIZED(self, 0)` - may I ask if there 
is a simpler way to do this?

--

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Agree, it's a bug.

+1 for getblocking()

--

___
Python tracker 

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



[issue31113] Stack overflow with large program

2017-12-19 Thread Stefan Nordhausen

Change by Stefan Nordhausen :


--
nosy: +snordhausen

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 19/12/2017 à 17:46, Eric Cousineau a écrit :
> 
> My current hack is to call `_PyGC_SET_FINALIZED(self, 0)` - may I ask if 
> there is a simpler way to do this?

Well... perhaps you could create another PyObject (it's just a wrapper,
right?) since the old one doesn't have any outside references to it
remaining.

Note that calling __del__ only once is also how PyPy works:
http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies

If there is some demand we could expose a higher-level spelling of
`_PyGC_SET_FINALIZED(self, 0)`.

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
keywords: +patch
pull_requests: +4822
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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've proposed a documentation improvement in 
https://github.com/python/cpython/pull/4927 . Please chime in if you see have 
issues with it.

--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

Welp, another day another attempt.  As mentioned in the PR 4847, atexit is not 
the answer.  If the raw/buffered file pair are part of a reference cycle and 
the GC cleans it before atexit runs, then the buffered data can get lost.

I attempted to implement my weakref idea (i.e. raw file keeps a weakref to the 
buffered file, calls flush before the raw file gets closed).  That doesn't work 
either because the GC clears the weakref before calling __del__.

The attached patch "buffer_register_flush.txt" does seem to work.  The downside 
is that it creates a reference cycle between the raw and buffered file objects. 
 Perhaps that is not a problem since unless you call close() on the raw file, 
you will be leaking resources anyhow.  In the patch, calling close() removes 
the reference cycle.

I still feel like this is worth fixing, as ugly as the implementation is.

--
assignee:  -> nascheme
Added file: https://bugs.python.org/file47340/buffer_register_flush.txt

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 4b965930e8625f77cb0e821daf5cc40e85b45f84 by Antoine Pitrou in 
branch 'master':
bpo-32377: improve __del__ docs and fix mention about resurrection (#4927)
https://github.com/python/cpython/commit/4b965930e8625f77cb0e821daf5cc40e85b45f84


--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4823

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think it would be quite disruptive to create a reference cycle each time 
open() is called.  It may also break user scripts.

--

___
Python tracker 

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



[issue32378] test_npn_protocols broken with LibreSSL 2.6.1+

2017-12-19 Thread Christian Heimes

New submission from Christian Heimes :

LibreSSL 2.6.1 to 2.6.4 have a broken implementation of NPN protocol. 2.6.0 and 
earlier are fine.


==
FAIL: test_npn_protocols (test.test_ssl.ThreadedTests)
--
Traceback (most recent call last):
  File "/home/heimes/dev/python/cpython/Lib/test/test_ssl.py", line 3424, in 
test_npn_protocols
self.assertEqual(client_result, expected, msg % (client_result, "client"))
AssertionError: None != 'http/1.1' : failed trying ['http/1.1', 'spdy/2'] (s) 
and ['http/1.1', 'spdy/2'] (c).
was expecting http/1.1, but got None from the client

Upstream issue https://github.com/libressl-portable/portable/issues/368

--
assignee: christian.heimes
components: SSL
messages: 308669
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: test_npn_protocols broken with LibreSSL 2.6.1+
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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Ouch, yes, that's a tricky bug. This is definitely caused by the way that 
asyncio internally converts signals into messages along a pipe (well, socket, 
but same thing), and then after a fork-without-exec the child keeps writing 
into that pipe. It's exacerbated by asyncio's choice to use the self-pipe as 
its source of truth about which signals have arrived vs just a wake-up pipe 
(see [1]), but that's not really the main issue; even without this we'd get 
spurious wakeups and other unpleasantness.

In addition to the workarounds Antoine suggested, it would possibly make sense 
for forked children to disable any wakeup_fd, perhaps in PyOS_AfterFork or by 
adding a getpid() check to the C level signal handler. I can't think of any 
cases where you actually want to processes to share the same wake-up fd. And 
even if this isn't fixed at that level, it would make sense for asyncio to use 
the new atfork module to do something similar for asyncio specifically.

Also relevant: https://github.com/python/asyncio/issues/347

[1] https://github.com/dabeaz/curio/issues/118

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset dc5770b161a5e28eeff73a406cd4eddb0676c5b5 by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.6':
bpo-32377: improve __del__ docs and fix mention about resurrection (GH-4927) 
(#4929)
https://github.com/python/cpython/commit/dc5770b161a5e28eeff73a406cd4eddb0676c5b5


--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue32378] test_npn_protocols broken with LibreSSL 2.6.1+

2017-12-19 Thread Christian Heimes

Change by Christian Heimes :


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

___
Python tracker 

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



[issue30697] segfault in PyErr_NormalizeException() after memory exhaustion

2017-12-19 Thread Anthony Sottile

Anthony Sottile  added the comment:

Should this have landed in python3.6? It removes a public symbol 
`PyExc_RecursionErrorInst` (abi break?)

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset f7686c1f5553b24e3307506a18e18f6544de94d3 by Andrew Svetlov (Neil 
Aspinall) in branch 'master':
bpo-29970: Add timeout for SSL handshake in asyncio
https://github.com/python/cpython/commit/f7686c1f5553b24e3307506a18e18f6544de94d3


--
nosy: +asvetlov

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

MRO computation involves a complicated merge calculation over several lists.  
But, for the simple (common) case where a class has a single base, the 
computation could be much simpler: take the base's MRO and prepend the derived 
class.

--
components: Interpreter Core
messages: 308674
nosy: pitrou
priority: normal
severity: normal
status: open
title: MRO computation could be faster
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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +inada.naoki, serhiy.storchaka, vstinner

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Benchmarks:

* before:

$ ./env-orig/bin/pyperf timeit "class Test: pass"
.
Mean +- std dev: 9.51 us +- 0.17 us

* after:

$ ./env/bin/pyperf timeit "class Test: pass"
.
Mean +- std dev: 8.89 us +- 0.09 us

--

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Fixed in 3.7

--

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Change by Andrew Svetlov :


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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Can you suggest an alternative to ProcessPoolExecutor for 3.6?

--

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You may switch to multiprocessing.Pool (with the "forkserver" method).

Otherwise, you could workaround it by executing a function on all workers that 
will reset the signal configuration. To maximize the chances that it does get 
executed on all workers, you could add a sleep() call inside it...

--

___
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-19 Thread Camion

Camion  added the comment:

David and Stefan, you're both missing my main point which is the fact that the 
presence of the global declaration in the parent (g) **blocks the access to the 
grand parent context**, which would be accessible without this global 
declaration (of another variable since that one is global. It just happen to 
have the same name) in g; and the stackoverflow post also ignores this question.

I do not disagree that this might be a desired feature (we might wish to reject 
this because of the potential confusion caused by this kind of name collision 
situation), but without any clear specification on it (since this point doesn't 
seem to have been discussed in the (or any?) PEP), it could always be 
challenged as a design flaw.

--

___
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-19 Thread R. David Murray

R. David Murray  added the comment:

Hmm.  I suppose that could be clarified in the docs.  I would find it very 
counter-intuitive for the grandparent 'a' to be accessible, which is probably 
why I did not consider that an issue.

--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

Yeah, I think you are correct.  Currently files not part of reference cycles 
get properly flushed and closed by the reference counter.  Implementing my 
"buffer_register_flush" patch would cause files to be closed only by the cyclic 
garbage collector (if not explicitly closed).  That would mean a script that 
opens a large number of files could run out of file descriptors.  Basically, we 
lose one of the main advantages of reference counting.

Probably the GC should keep track of how many files are open and call collect() 
when a threshold is reached.  Still, forcing every file to be collected only by 
the cyclic GC seems too ugly of a solution to this issue.

--

___
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-19 Thread Camion

Camion  added the comment:

My interrogation is about the fact that this doesn't seem to have been a 
collective decision and I'm not even sure it WAS anyone decision : it might as 
well have been an unintentional consequence of an implementation choice. 

So, in the "weakest" configuration, avoiding the implementation challenge for 
"design flaw" would require a language specification to at least mention that 
in this case, the behavior in undefined.

--

___
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-19 Thread Stefan Krah

Stefan Krah  added the comment:

Okay, I have never used something like that. Personally, I'd
disallow the global statement in g() if 'a' is local in f().

>>> a = 10
>>> def f():
... a = 20
... def g():
... global a
... print(a)
... g()
... 
>>> 
>>> f()
10

--

___
Python tracker 

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



[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

The existing issue is #29051.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Improve error reporting involving f-strings (PEP 498)

___
Python tracker 

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



[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-12-19 Thread Eric V. Smith

Eric V. Smith  added the comment:

The example above (msg289501) has been fixed. I think it was in #30465.

It also fixes some of these other cases, but I haven't reviewed them all.

--

___
Python tracker 

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



[issue30697] segfault in PyErr_NormalizeException() after memory exhaustion

2017-12-19 Thread Brett Cannon

Brett Cannon  added the comment:

Re-opened as a release blocker to make sure we're okay with the potential ABI 
breakage.

--
nosy: +ned.deily
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



[issue32380] functools.singledispatch interacts poorly with methods

2017-12-19 Thread Ethan Smith

New submission from Ethan Smith :

Consider the following:

from functools import singledispatch

class Dispatch:
@singledispatch
def foo(self, a):
return a

@foo.register(int)
def _(self, a):
return "int"

@foo.register(str)
def _(self, a):
return "str"

cls = Dispatch()
cls.foo(3)  # 3
cls.foo('hm')  # 'hm'

I find this quite unintuitive. Essentially, since singledispatch dispatches 
based solely on a functions first argument, it is useless on methods unless one 
wraps it and modifies how it uses the internal wrapper function. I believe this 
should be relatively easy to fix with adding a check of inspect.ismethod and 
then modifying the number of the checked argument where appropriate.

I'm happy to write a patch if this change is seen as a good idea.

--
components: Library (Lib)
messages: 308687
nosy: Ethan Smith
priority: normal
severity: normal
status: open
title: functools.singledispatch interacts poorly with methods
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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4826

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

STINNER Victor  added the comment:


New changeset c4bca951065f4b2b6833f6ce7a0721e863e2343e by Victor Stinner in 
branch 'master':
bpo-32030: Add _PyCoreConfig.argv (#4934)
https://github.com/python/cpython/commit/c4bca951065f4b2b6833f6ce7a0721e863e2343e


--

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

In kernel logs (look at dmesg), I found two messages:

vstinner@apu$ journalctl -k|grep random
déc. 14 23:10:28 apu kernel: random: fast init done
déc. 14 23:10:32 apu kernel: random: crng init done

Sadly, I don't know which one means that urandom is initialized.

See also https://wiki.archlinux.org/index.php/Random_number_generation

--

___
Python tracker 

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



[issue32315] can't run any scripts with 2.7.x, 32 and 64-bit

2017-12-19 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue32345] EIO from write() is only fatal if print() contains a newline

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Python 2 doesn't call write(), it calls fwrite() and friends (i.e. it uses the 
libc's buffered I/O API).  Also we don't do anything special if the printed 
string has a newline in it.  So my guess is that it's a bug in the libc.

--
nosy: +pitrou

___
Python tracker 

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



[issue32304] Upload failed (400): Digests do not match on .tar.gz ending with x0d binary code

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I agree with the suggested fix.  Do you want to submit a PR?

--
nosy: +pitrou -llecaroz
stage:  -> needs patch
versions: +Python 3.6 -Python 3.5, Python 3.8

___
Python tracker 

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



[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread Alexey Luchko

Alexey Luchko  added the comment:

I didn't mean type checking. The point is that since string and bytes are 
different types, then binary and text files are actually much more different 
than before python 3. Therefore they better be of different protocols.
Then inside quopri with StringIO in place of BytesIO the error would be much 
more clear and this issue would not have appeared.
This would be helpful in lack of one's intuition, like with newcomers.

--

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

It appears the the timeouts situation is a bit more complex.  It's perfectly 
normal for a Python socket object to be in a "blocking" mode and for its FD to 
be in a non-blocking mode.  Read more about this in the latest docs update to 
the PR: 
https://github.com/python/cpython/pull/4926/commits/adcc91f93e1538f0d25645ebe0285b12137a3e3b

--

___
Python tracker 

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



[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

That's type checking.  Not type checking is to call the method that writes the 
data, expecting the object to handle the bytes it is passed, and then that 
object raises an error to indicate that it cannot.  There is no protocol that 
can be checked for.

--

___
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-19 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Stefan, your last example is formally speaking OK, if one reads the "Execution 
model" literally. The original example is however too ambiguous, so it is good 
that it triggers an error.

I think there is a chance to improve the error message here, but I didn't think 
about this carefully (in particular, a situation where `global` appears after 
the inner function `h` definition worries me).

--

___
Python tracker 

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



  1   2   >