[issue30034] csv reader chokes on bad quoting in large files

2017-04-11 Thread Peter Otten

Peter Otten added the comment:

While I don't think that the csv module should second-guess broken input you 
might consider "fixing" your data on the fly:

def close_quote(line):
if line.count('"') % 2:
line = line.rstrip("\n") + '"\n'
return line

with open("data.csv") as f:
for row in csv.reader(map(close_quote, f)):
print(row)

That should give the desired output.

--
nosy: +peter.otten

___
Python tracker 

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



[issue30036] The bugs website doesn't use httpS by default

2017-04-11 Thread Dutcho

New submission from Dutcho:

The footer of httpS://python.org links to httP://bugs.python.org, compromising 
user data for login and register options

--
assignee: christian.heimes
components: SSL
messages: 291463
nosy: Dutcho, christian.heimes
priority: normal
severity: normal
status: open
title: The bugs website doesn't use httpS by default
type: security
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



[issue30037] inspect documentation on code attributes incomplete

2017-04-11 Thread Dutcho

New submission from Dutcho:

The table at the top of the inspect documentation 
(https://docs.python.org/3/library/inspect.html#types-and-members) omits 
co_cellvars, co_freevars, and co_kwonlyargcount attributes of type code

(note: the type's doc string does provide these attributes)

--
assignee: docs@python
components: Documentation
messages: 291464
nosy: Dutcho, docs@python
priority: normal
severity: normal
status: open
title: inspect documentation on code attributes incomplete
type: enhancement
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



[issue25828] PyCode_Optimize() (peephole optimizer) doesn't handle KeyboardInterrupt correctly

2017-04-11 Thread Louie Lu

Changes by Louie Lu :


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



[issue25828] PyCode_Optimize() (peephole optimizer) doesn't handle KeyboardInterrupt correctly

2017-04-11 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1221

___
Python tracker 

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



[issue24076] sum() several times slower on Python 3

2017-04-11 Thread Louie Lu

Changes by Louie Lu :


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



[issue30036] The bugs website doesn't use httpS by default

2017-04-11 Thread Christian Heimes

Changes by Christian Heimes :


--
assignee: christian.heimes -> 
components: +Documentation -SSL
type: security -> behavior

___
Python tracker 

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



[issue24076] sum() several times slower on Python 3 64-bit

2017-04-11 Thread Louie Lu

Changes by Louie Lu :


--
title: sum() several times slower on Python 3 -> sum() several times slower on 
Python 3 64-bit

___
Python tracker 

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



[issue30037] inspect documentation on code attributes incomplete

2017-04-11 Thread Martin Panter

Martin Panter added the comment:

Looks like a there is already a patch discussed at Issue 26985.

--
nosy: +martin.panter
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Information about CodeType in inspect documentation is outdated

___
Python tracker 

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



[issue29881] Add a new private API clear private variables, which are initialized once, at Python shutdown

2017-04-11 Thread Louie Lu

Changes by Louie Lu :


--
nosy: +louielu

___
Python tracker 

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



[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-11 Thread Nick Coghlan

Nick Coghlan added the comment:


New changeset 00c75e9a45ff0366c185e9e8a2e23af5a35481b0 by Nick Coghlan 
(svelankar) in branch 'master':
bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError 
(GH-949)
https://github.com/python/cpython/commit/00c75e9a45ff0366c185e9e8a2e23af5a35481b0


--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

New submission from Nathaniel Smith:

In trip_signal [1], the logic goes:

1) set the flag saying that this particular signal was tripped
2) write to the wakeup fd
3) set the global is_tripped flag saying "at least one signal was tripped", and 
do Py_AddPendingCall (which sets some global flags that the bytecode 
interpreter checks on every pass through the loop)

So the problem here is that it's step (2) that wakes up the main thread to 
check for signals, but it's step (3) that actually arranges for the 
Python-level signal handler to run. (Step (1) turns out to be irrelevant, 
because no-one looks at the per-signal flags unless the global is_tripped flag 
is set. This might be why no-one noticed this bug through code inspection 
though – I certainly missed it, despite explicitly checking for it several 
times!)

The result is that the following sequence of events is possible:

- signal arrives (e.g. SIGINT)
- trip_signal writes to the wakeup fd
- the main thread blocked in IO wait sees this, and wakes up
- the main thread checks for signals, and doesn't find any
- the main thread empties the wakeup fd
- the main thread goes back to sleep
- trip_signal sets the flags to request the Python-level signal handler be run
- the main thread doesn't notice, because it's asleep

It turns out that this is a real thing that can actually happen; it's causing 
an annoying intermittent failure in the trio testsuite on appveyor; and under 
the correct conditions I can reproduce it very reliably in my local Windows VM. 
See [2].

I think the fix is just to swap the order of steps (2) and (3), so we write to 
the wakeup fd last. Unfortunately I can't easily test this because I don't have 
a way to build CPython on Windows. But [2] has some IMHO pretty compelling 
evidence that this is what's happening.

[1] 
https://github.com/python/cpython/blob/6fab78e9027f9ebd6414995580781b480433e595/Modules/signalmodule.c#L238-L291
[2] https://github.com/python-trio/trio/issues/119

--
messages: 291467
nosy: haypo, njs
priority: normal
severity: normal
status: open
title: Race condition in how trip_signal writes to wakeup fd
versions: 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



[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-11 Thread Nick Coghlan

Nick Coghlan added the comment:

This has been merged for 3.7, but cherry-picks to the other branches are still 
needed.

I also inadvertently missed adding svelankar's name (Siddharth Velankar) to 
Misc/ACKS, so that oversight will need to be tidied up as well.

--
resolution:  -> fixed
stage: test needed -> backport needed
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



[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-11 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-11 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +1222

___
Python tracker 

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



[issue30039] Resuming a 'yield from' stack is broken if a signal arrives in the middle

2017-04-11 Thread Nathaniel Smith

New submission from Nathaniel Smith:

If we have a chain of generators/coroutines that are 'yield from'ing each 
other, then resuming the stack works like:

- call send() on the outermost generator
- this enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode
- which calls send() on the next generator
- which enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode
- ...etc.

However, every time we enter _PyEval_EvalFrameDefault, the first thing we do is 
to check for pending signals, and if there are any then we run the signal 
handler. And if it raises an exception, then we immediately propagate that 
exception *instead* of starting to execute bytecode. This means that e.g. a 
SIGINT at the wrong moment can "break the chain" – it can be raised in the 
middle of our yield from chain, with the bottom part of the stack abandoned for 
the garbage collector.

The fix is pretty simple: there's already a special case in _PyEval_EvalFrameEx 
where it skips running signal handlers if the next opcode is SETUP_FINALLY. (I 
don't see how this accomplishes anything useful, but that's another story.) If 
we extend this check to also skip running signal handlers when the next opcode 
is YIELD_FROM, then that closes the hole – now the exception can only be raised 
at the innermost stack frame.

This shouldn't have any performance implications, because the opcode check 
happens inside the "slow path" after we've already determined that there's a 
pending signal or something similar for us to process; the vast majority of the 
time this isn't true.

I'll post a PR in a few minutes that has a test case that demonstrates the 
problem and fails on current master, plus the fix.

--
components: Interpreter Core
messages: 291469
nosy: njs, yselivanov
priority: normal
severity: normal
status: open
title: Resuming a 'yield from' stack is broken if a signal arrives in the middle
versions: 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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

New submission from INADA Naoki:

dict.clear() make the dict to empty key-sharing dict to reduce it's size.
New dict can use same technique.

$ ./python.default 
Python 3.7.0a0 (heads/master:6dfcc81, Apr 10 2017, 19:55:52) 
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> d = {}
>>> sys.getsizeof(d)
240
>>> d.clear()
>>> sys.getsizeof(d)
72

$ ./python.patched 
Python 3.7.0a0 (heads/master-dirty:6dfcc81, Apr 11 2017, 18:11:02) 
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getsizeof({})
72

--
messages: 291470
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: new empty dict can be more small

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +1223

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

performance impact

best case:
$ ./python.patched -m perf timeit --compare-to=`pwd`/python.default  -- '{}'
python.default: . 36.9 ns +- 0.9 ns
python.patched: . 25.3 ns +- 0.7 ns
Mean +- std dev: [python.default] 36.9 ns +- 0.9 ns -> [python.patched] 25.3 ns 
+- 0.7 ns: 1.46x faster (-31%)

worst case:
$ ./python.patched -m perf timeit --compare-to=`pwd`/python.default  -- 'x={}; 
x["a"]=1'
python.default: . 73.3 ns +- 1.2 ns
python.patched: . 82.8 ns +- 1.8 ns
Mean +- std dev: [python.default] 73.3 ns +- 1.2 ns -> [python.patched] 82.8 ns 
+- 1.8 ns: 1.13x slower (+13%)

--

___
Python tracker 

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



[issue30039] Resuming a 'yield from' stack is broken if a signal arrives in the middle

2017-04-11 Thread Nathaniel Smith

Changes by Nathaniel Smith :


--
pull_requests: +1224

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

Changes by INADA Naoki :


--
components: +Interpreter Core
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



[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-11 Thread Nick Coghlan

Nick Coghlan added the comment:


New changeset e8a6bb4f3936123f3eca0b6cea05e2875a2722bc by Nick Coghlan in 
branch 'master':
bpo-29692: Add missing ACKS entry (#1079)
https://github.com/python/cpython/commit/e8a6bb4f3936123f3eca0b6cea05e2875a2722bc


--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Changes by Nathaniel Smith :


--
pull_requests: +1226

___
Python tracker 

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



[issue30041] subprocess: weird behavior with shell=True and args being a list

2017-04-11 Thread Dimitri Merejkowsky

New submission from Dimitri Merejkowsky:

If you have:

subprocess.run(["ls", "--help"], shell=True)

you'll see that the command run is actually just "ls", not "ls --help"

--
components: Library (Lib)
messages: 291473
nosy: Dimitri Merejkowsky
priority: normal
severity: normal
status: open
title: subprocess: weird behavior with shell=True and args being a list

___
Python tracker 

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



[issue3041] autodoc does not support unicode docstrings

2017-04-11 Thread Dimitri Merejkowsky

Changes by Dimitri Merejkowsky :


--
pull_requests: +1227

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread STINNER Victor

STINNER Victor added the comment:

Last time I had to make a major change related to signal handling, it was in 
the asyncio module because of a race conditon which occurred on FreeBSD.

commit fe5649c7b7bf52147480d6b1124a3d8e3597aee3
Author: Victor Stinner 
Date:   Thu Jul 17 22:43:40 2014 +0200

Python issue #21645, Tulip issue 192: Rewrite signal handling

Since Python 3.3, the C signal handler writes the signal number into the 
wakeup
file descriptor and then schedules the Python call using 
Py_AddPendingCall().

asyncio uses the wakeup file descriptor to wake up the event loop, and 
relies
on Py_AddPendingCall() to schedule the final callback with call_soon().

If the C signal handler is called in a thread different than the thread of 
the
event loop, the loop is awaken but Py_AddPendingCall() was not called yet. 
In
this case, the event loop has nothing to do and go to sleep again.
Py_AddPendingCall() is called while the event loop is sleeping again and so 
the
final callback is not scheduled immediatly.

This patch changes how asyncio handles signals. Instead of relying on
Py_AddPendingCall() and the wakeup file descriptor, asyncio now only relies 
on
the wakeup file descriptor. asyncio reads signal numbers from the wakeup 
file
descriptor to call its signal handler.

--

___
Python tracker 

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



[issue30041] subprocess: weird behavior with shell=True and args being a list

2017-04-11 Thread Martin Panter

Martin Panter added the comment:

This is as documented, but perhaps see Issue 20344 about clarifying the 
documentation.

--
nosy: +martin.panter
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> subprocess.check_output() docs misrepresent what shell=True does

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

Right. My claim would be that the PR I just submitted is the correct fix for 
bpo-21645 as well.

The approach asyncio uses is very elegant, but unfortunately it assumes that 
the wakeup fd has infinite buffer, which isn't true. If enough signals or other 
callbacks are scheduled to the event loop quickly enough, then the buffer can 
overflow and signals can get lost. This is a very classic issue and source of 
confusion for everyone learning Unix – the reason that there are traditionally 
32 unix signals, and that signals can be coalesced and SIGCHLD is so annoying, 
is that the kernel treats pending signals as flags, not a queue; this means 
that in the worst case it only takes 32 bits to store all pending signals. 
(Even the posix committee screwed this up when designing the real-time signals 
system, which is almost unusable as a result.) On Unix, if you send a process 
10 SIGHUP and 1 SIGCHLD, then it might get only 1 SIGHUP and 1 SIGCHLD, but 
it's guaranteed to get that. With asyncio's model, it might get 10 SIGHUP and 0 
SIGCHLD, or even 0 SIGHUP and 0 SIGCHLD (since other methods like 
call_soon_threadsafe also write to the wakeup fd).

In any case, this is why other async libraries (at least twisted, libuv, 
tornado, trio) treat the wakeup fd as a boolean empty-or-not, and pass the 
actual information via some other out-of-band mechanism that involves a 
Python-level signal handler. So the patch here is necessary for everyone else 
to safely use set_wakeup_fd.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread Xiang Zhang

Xiang Zhang added the comment:

Isn't the latter case the more common one? Creating an empty dict and then 
populate it.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

Err, libuv obviously doesn't use a Python-level signal handler. I just meant to 
include them as another example of a library I checked that uses a self-pipe to 
handle signals but relies on out-of-band information to transmit what the 
actual signal is :-).

--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread STINNER Victor

STINNER Victor added the comment:

Previous changes in signal handling. It's the commit 
c13ef66649985025382c64f6af8e3b956411e05b of the issue #8407 which changed the 
order:  became .

I really *hate* having to think to these evil things which are signals and 
threads... Signals and threads don't go well altogether :-p It reminds me the 
"Ghosts of Unix past, part 3: Unfixable designs" article...
https://lwn.net/Articles/414618/

commit 6c9b35bfe2585af08ea6480294e096e2d2397fe3
Author: Victor Stinner 
Date:   Mon Apr 18 16:25:56 2011 +0200

Issue #11768: The signal handler of the signal module only calls
Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or
parallel calls. PyErr_SetInterrupt() writes also into the wake up file.

commit c13ef66649985025382c64f6af8e3b956411e05b
Author: Victor Stinner 
Date:   Wed May 25 02:35:58 2011 +0200

Issue #8407: Fix the signal handler of the signal module: if it is called
twice, it now writes the number of the second signal into the wakeup fd.

--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

I think the idea in c13ef6664998 wasn't so much that we wanted the wakeup fd to 
be written to first, as that the way the code was written back then, the 
presence of 'if (is_tripped) return;' meant that it wasn't getting written to 
*at all* in some cases. Since then the code got restructured and the early 
return was removed, so this isn't an issue anymore.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

> Isn't the latter case the more common one? Creating an empty dict and then 
> populate it.

This is memory usage optimization, not performance optimization.
(But I think memory efficiency makes multi process application faster because 
L3 cache size is limited resource.)
Later case shows how performance penalty is large.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

macro bench result:

$ ./python.default -m perf compare_to -G --min-speed=1 default.json patched.json
Slower (11):
- scimark_lu: 362 ms +- 13 ms -> 383 ms +- 22 ms: 1.06x slower (+6%)
- unpickle_pure_python: 882 us +- 18 us -> 924 us +- 18 us: 1.05x slower (+5%)
- regex_v8: 45.4 ms +- 0.6 ms -> 46.7 ms +- 3.1 ms: 1.03x slower (+3%)
- mako: 40.4 ms +- 0.4 ms -> 41.4 ms +- 0.4 ms: 1.03x slower (+3%)
- meteor_contest: 200 ms +- 1 ms -> 204 ms +- 2 ms: 1.02x slower (+2%)
- genshi_text: 88.8 ms +- 1.2 ms -> 90.1 ms +- 1.6 ms: 1.01x slower (+1%)
- scimark_monte_carlo: 255 ms +- 6 ms -> 258 ms +- 7 ms: 1.01x slower (+1%)
- richards: 176 ms +- 4 ms -> 178 ms +- 8 ms: 1.01x slower (+1%)
- pickle: 24.2 us +- 0.5 us -> 24.4 us +- 0.7 us: 1.01x slower (+1%)
- sympy_str: 438 ms +- 3 ms -> 442 ms +- 3 ms: 1.01x slower (+1%)
- genshi_xml: 196 ms +- 3 ms -> 198 ms +- 2 ms: 1.01x slower (+1%)

Faster (7):
- logging_silent: 746 ns +- 12 ns -> 722 ns +- 11 ns: 1.03x faster (-3%)
- xml_etree_generate: 272 ms +- 4 ms -> 264 ms +- 4 ms: 1.03x faster (-3%)
- telco: 20.7 ms +- 0.7 ms -> 20.2 ms +- 0.4 ms: 1.02x faster (-2%)
- xml_etree_parse: 311 ms +- 13 ms -> 305 ms +- 12 ms: 1.02x faster (-2%)
- nqueens: 266 ms +- 4 ms -> 262 ms +- 2 ms: 1.02x faster (-2%)
- unpack_sequence: 123 ns +- 1 ns -> 122 ns +- 2 ns: 1.01x faster (-1%)
- raytrace: 1.27 sec +- 0.01 sec -> 1.25 sec +- 0.01 sec: 1.01x faster (-1%)

Benchmark hidden because not significant (46)

--

___
Python tracker 

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



[issue29606] urllib FTP protocol stream injection

2017-04-11 Thread Plenty Su

Changes by Plenty Su :


--
nosy: +supl

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread Xiang Zhang

Xiang Zhang added the comment:

I mean creating a solo empty dict doesn't seem to make much sense. Although it 
saves memory, but when it's populated, it's resized and the memory occupation 
comes back.

And this makes PyDict_New() hard to understand. :-(

--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

If it helps, notice that the SetEvent(sigint_event) call used to wake up the 
main thread on windows is also performed unconditionally and after the call to 
Py_AddPendingEvent. From the point of view of twisted/tornado/trio, this is 
exactly the same as the write to the wakeup fd -- the only reason we use the 
wakeup fd instead of the sigint_event is that it's more convenient to wait on 
an fd than on an event object.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Use "--duplicate 100" when making microbenchmarks for such fast operations. The 
overhead of iterating can be significant and comparable with the time of the 
operation.

--
nosy: +serhiy.storchaka
stage:  -> patch review

___
Python tracker 

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



[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-11 Thread Nick Coghlan

Nick Coghlan added the comment:

Huh, interesting - I'd missed that the only part of the "from a.b import c" 
that IMPORT_FROM implements is the LOAD_ATTR variant that falls back to 
sys.modules. The prior adjustment to get IMPORT_NAME to return "a.b" instead of 
"a" happens inside that opcode based on the fact that a non-empty from_list was 
passed in.

So indeed, there's no new opcode needed - as Serhiy points out, the compiler 
just needs to emit IMPORT_FROM instead of LOAD_ATTR for this case.

--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread STINNER Victor

STINNER Victor added the comment:

"I think the idea in c13ef6664998 wasn't so much that we wanted the wakeup fd 
to be written to first, as that the way the code was written back then, the 
presence of 'if (is_tripped) return;' meant that it wasn't getting written to 
*at all* in some cases. Since then the code got restructured and the early 
return was removed, so this isn't an issue anymore."

I agree. It wasn't deliberate to change the order, it's was more to write a 
short patch fixing a very specific use case.

--

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread STINNER Victor

STINNER Victor added the comment:

I know that it can be very difficult to write such test, but can you please try 
to write a script trying to reproduce the describe the race condition?

Later, we can run the script in a test to check for non-regression.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

While I think it's preferable that {} and d.clear() have same memory footprint,
I need real world example which empty dict affects overall memory usage.

I'll check memory usage difference with application I used in this ML thread.
https://mail.python.org/pipermail/python-dev/2017-January/147194.html

--

___
Python tracker 

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



[issue29590] Incorrect stack traces when re-entering a generator/coroutine stack via .throw()

2017-04-11 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
components: +Interpreter Core

___
Python tracker 

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



[issue30042] fcntl module for windows

2017-04-11 Thread karan

Changes by karan :


--
title: fcntl module foe windows -> fcntl module for windows

___
Python tracker 

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



[issue30042] fcntl module foe windows

2017-04-11 Thread karan

New submission from karan:

NameError: global name 'fcntl' is not defined
such error occurs while running software on windows.

does fcntl module (urwid) is available for windows??

--
messages: 291490
nosy: kk_pednekar
priority: normal
severity: normal
status: open
title: fcntl module foe windows
type: resource usage
versions: Python 2.7

___
Python tracker 

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



[issue30031] Improve queens demo (use argparse and singular form)

2017-04-11 Thread Pavlo Kapyshin

Changes by Pavlo Kapyshin :


--
pull_requests: +1228

___
Python tracker 

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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2017-04-11 Thread Pierre Quentel

Pierre Quentel added the comment:

Senthil,

Can you take a look at the Pull Request when you have time ? The correct PR is 
#991, not #990.

--

___
Python tracker 

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



[issue30042] fcntl module for windows

2017-04-11 Thread Christian Heimes

Christian Heimes added the comment:

Yes, it's Unix only: https://docs.python.org/2.7/py-modindex.html#cap-f

--
nosy: +christian.heimes
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



[issue30043] fcntl module for windows platform

2017-04-11 Thread karan

New submission from karan:

is there any fcntl module alternative available that would support windows 
platform??

in any of futures release of python is it possible that fcntl would support 
windows??

--
messages: 291493
nosy: kk_pednekar
priority: normal
severity: normal
status: open
title: fcntl module for windows platform
type: resource usage

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread R. David Murray

R. David Murray added the comment:

I've worked on an application (proprietary, unfortunately) that created a lot 
of empty dictionaries that only sometimes got populated.  It involved 
sqlalchemy, but I don't remember if the dicts came from sqlalchemy itself or 
from the code that used it.  That application did care about memory, and the 
shared-key dicts were a big benefit to it.

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-11 Thread Keith Erskine

Keith Erskine added the comment:

The csv reader already supports bad CSV - that's what I believe "strict" is for 
- but only in one specific scenario.  My request is to make that "strict" 
attribute a bit more useful.

Thank you for your suggestion, Peter.  I have toyed with the idea of looking 
for an even number of double quotes in each line, but thank you for your neat 
way of encapsulating it.  (I already have to strip null bytes out of the input 
data because they break csv, see issue #27580).

--

___
Python tracker 

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



[issue30043] fcntl module for windows platform

2017-04-11 Thread STINNER Victor

STINNER Victor added the comment:

The Python bug tracker is not a forum. Please ask such question on a Python 
help mailing list or any Python forum, but not here. Thank you ;-)

(No, there is no fcntl module on Windows.)

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

After adapting your test script to run against a local openssl server (`openssl 
s_server -www`), I can't see a single leak: the process is peaking at 20860 KB 
RSS.  This is with Python 3.5 tip.

Does it need a specific server to test against to showcase the leak?

--

___
Python tracker 

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-11 Thread Keith Erskine

Keith Erskine added the comment:

I should have said, Peter, an odd number of quotes does not necessarily mean 
the quoting is bad.  For example, a line of:
a,b",c
will parse fine as ['a', 'b"', 'c'].  Figuring out bad quoting is not easy, but 
if we know that there are no multiline fields in the file, then at least the 
parsing can stop at the end of the line.

--

___
Python tracker 

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



[issue30044] shutil.copystat should (allow to) copy ownership, and other attributes

2017-04-11 Thread Florent Coriat

New submission from Florent Coriat:

shutil.copystat() copies permissions, timestamps and even flags and xattrs (if 
supported), but not ownership.
Furthermore, shutil.copy2() documentation until 2.7 used to say it behaves like 
cp -p, which preserves ownership, and not xattr nor flags. (On my system it 
silently fails to copy ownership when not root).

It may not be related, but comments in source code for the except 
NotImplementedError block concerning chmod mistakenly mentions chown-related 
functions.

I think copystat (and copy2) should at least provide an option to preserve 
ownership.
I do not know if it currently preserves SELinux context and ACL, but if not, it 
may also allow it.
It would be really useful for replication or backup applications to have a 
function that copies everything it can.

--
components: Library (Lib)
messages: 291499
nosy: noctiflore
priority: normal
severity: normal
status: open
title: shutil.copystat should (allow to) copy ownership, and other attributes
type: enhancement
versions: 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



[issue29870] ssl socket leak

2017-04-11 Thread Alexander Mohr

Alexander Mohr added the comment:

the interesting part is it doesn't leak with a local https server, it appears 
to need to be a remove server.

--

___
Python tracker 

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



[issue19084] No way to use TLS-PSK from python ssl

2017-04-11 Thread chrysn

Changes by chrysn :


--
nosy: +chrysn

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is there a fast enough remote server that shows the leak? I've tested with my 
own remote server (https://pitrou.net/), but it doesn't leak.

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Alexander Mohr

Alexander Mohr added the comment:

ya, my sample script hits google.com , it's pretty fast.  
It just does a "HEAD".

> On Apr 11, 2017, at 9:14 AM, Antoine Pitrou  wrote:
> 
> 
> Antoine Pitrou added the comment:
> 
> Is there a fast enough remote server that shows the leak? I've tested with my 
> own remote server (https://pitrou.net/), but it doesn't leak.
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Google is not very fast here (a couple of requests / sec at most).  How many 
requests does it take to see a clear tendency?

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Alexander Mohr

Alexander Mohr added the comment:

see graphs here: https://github.com/kennethreitz/requests/issues/3933, x-axis 
is number of requests not what it says (seconds).

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, thank you. I've tweaked the script to remove most threads and use 
maps.google.com (which is faster here), and I managed to bisect the leak to 
deduce that the offending changeset is 598894ff48e9c1171cb2ec1c798235826a75c7e0.

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

Thank you for your reply.
Would you try to check how the patch [1] affects memory usage of your 
application?
I think the patch can be applied to 3.6 easily.

[1] https://patch-diff.githubusercontent.com/raw/python/cpython/pull/1080.patch

--

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread R. David Murray

R. David Murray added the comment:

Sorry, but I no longer have access to that application (I'm a consultant, and 
the owner is no longer a client).

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The following addition fixes the leak:

diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index bb40051..8f5facd 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1203,6 +1203,8 @@ _get_crl_dp(X509 *certificate) {
 Py_XDECREF(lst);
 #if OPENSSL_VERSION_NUMBER < 0x10001000L
 sk_DIST_POINT_free(dps);
+#else
+CRL_DIST_POINTS_free(dps);
 #endif
 return res;
 }


Christian, what do you think?

--
priority: normal -> high
versions: +Python 2.7, Python 3.7

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Christian Heimes

Christian Heimes added the comment:

CRL_DIST_POINTS_free() should be available in all supported OpenSSL versions. 
The function is defined by DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS).

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

So we should use it instead of sk_DIST_POINT_free()? I'd like to minimize 
potential breakage here.

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Alexander Mohr

Alexander Mohr added the comment:

awesome! Thanks for finding a proposing fix pitrou!  btw I found an example of 
freeing this structure here: 
http://www.zedwood.com/article/c-openssl-parse-x509-certificate-pem

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Christian Heimes

Christian Heimes added the comment:

Yes, I'm currently testing the change with a bunch of OpenSSL and LibreSSL 
versions.

By the way the memory issue can be reproduced with any certificate that 
contains a CRL distribution point. Letsencrypt certs don't have a CRL DP. I 
guess Alexander's test cert doesn't have a CRL DP either. The Nokia test cert 
in our test suite contains one.

---
import _ssl
import sys

PEM = 'Lib/test/nokia.pem'

def mem():
with open('/proc/self/status') as f:
for line in f:
if line.startswith('RssAnon'):
print(line, end='')

for i in range(1):
if i % 1000 == 0:
mem()
d = _ssl._test_decode_cert(PEM)
assert d['crlDistributionPoints']

mem()
---

Without fix:

$ ./python t.py 
RssAnon:4376 kB
RssAnon:4840 kB
RssAnon:5224 kB
RssAnon:5608 kB
RssAnon:6120 kB
RssAnon:6504 kB
RssAnon:6888 kB
RssAnon:7272 kB
RssAnon:7656 kB
RssAnon:8040 kB
RssAnon:8424 kB


With fix:

$ ./python t.py 
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB
RssAnon:4376 kB

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Christian Heimes

Changes by Christian Heimes :


--
pull_requests: +1229

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Christian Heimes

Christian Heimes added the comment:

Antoine, you might find multissl.py helpful. I wrote a script to automate 
testing with multiple versions of OpenSSL and libressl. The first time it takes 
about half an hour to download, compile and install all versions locally. 
https://github.com/tiran/multissl/blob/master/multissl.py

--

___
Python tracker 

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



[issue30045] Bad parameter name in re.escape()

2017-04-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently re.escape() parameter has a name "pattern", but in the documentation 
the name of the parameter is "string".

The name "pattern" is not correct, and maybe even misleading. The argument of 
escape() is not a pattern, it is an arbitrary string, and escape() makes a 
pattern from it by escaping special characters.

It is unlikely that the argument is passed to re.escape() by keyword. Therefore 
renaming it to "string" shouldn't break existing code.

--
components: Regular Expressions
messages: 291514
nosy: ezio.melotti, mrabarnett, r.david.murray, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Bad parameter name in re.escape()
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



[issue30030] Simplify _RandomNameSequence

2017-04-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Merged in f50354adaaafebe95ad09d09b825804a686ea843.

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




[issue30046] csv: Inconsistency re QUOTE_NONNUMERIC

2017-04-11 Thread Thomas Lotze

New submission from Thomas Lotze:

A csv.writer with quoting=csv.QUOTE_NONNUMERIC does not quote boolean values, 
which makes a csv.reader with the same quoting behaviour fail on that value:

 csv.py --

import csv
import io


f = io.StringIO()

writer = csv.writer(f, quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(['asdf', 1, True])

f.seek(0)
reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC)
for row in reader:
print(row)

--

$ python3 csvbug.py 
Traceback (most recent call last):
  File "csvbug.py", line 12, in 
for row in reader:
ValueError: could not convert string to float: 'True'

--

I'd consider this inconsistency a bug, but in any case something that needs 
documenting.

--
components: Library (Lib)
messages: 291516
nosy: tlotze
priority: normal
severity: normal
status: open
title: csv: Inconsistency re QUOTE_NONNUMERIC
type: behavior

___
Python tracker 

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



[issue29966] typing.get_type_hints doesn't really work for classes with ForwardRefs

2017-04-11 Thread Simon Percivall

Simon Percivall added the comment:

It think it's important to document this caveat in `get_type_hints`, that there 
is virtually _no_ way to use it safely with a class, and that there will always 
be a high risk of getting an exception unless using this function in a highly 
controlled setting.

This also, as a consequence, means that there is no "best-effort" support for 
collecting type hints from a class hierarchy, and every instance of trying to 
use this function with classes, or traversing __annotations__ "manually", will 
need to be solved ad-hoc and from scratch by the user (until someone publishes 
a "typing-utils" package on PyPI).

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Antoine, you might find multissl.py helpful.

Very nice, thank you!

--

___
Python tracker 

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



[issue29994] site.USER_SITE is None for Windows embeddable Python 3.6

2017-04-11 Thread Steve Dower

Steve Dower added the comment:

This is by design - the embeddable Python is meant to exclude anything relating 
to the current user by default.

If you're looking for a lightweight Python install that you can use for things 
like building or managing packages, you may be interested in the Nuget packages 
- see 
https://www.nuget.org/packages?q=publisher%3A%22Python+Software+Foundation%22

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



[issue30047] Typos in Doc/library/select.rst

2017-04-11 Thread OSAMU NAKAMURA

New submission from OSAMU NAKAMURA:

In 18.3.2. Edge and Level Trigger Polling (epoll) Objects,
there is duplicated 'on' in description of `EPOLLEXCLUSIVE`.

   Wake only ... objects polling on on a fd.
 ^

--
assignee: docs@python
components: Documentation
messages: 291520
nosy: OSAMU.NAKAMURA, docs@python
priority: normal
severity: normal
status: open
title: Typos in Doc/library/select.rst
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



[issue30047] Typos in Doc/library/select.rst

2017-04-11 Thread OSAMU NAKAMURA

Changes by OSAMU NAKAMURA :


--
pull_requests: +1230

___
Python tracker 

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



[issue30040] new empty dict can be more small

2017-04-11 Thread INADA Naoki

INADA Naoki added the comment:

> I mean creating a solo empty dict doesn't seem to make much sense. Although 
> it saves memory, but when it's populated, it's resized and the memory 
> occupation comes back.

But sometimes it's not populated.

class A:
def __init__(self, **kwargs):
self._extra = kwargs

xa = [A() for _ in range(1000)]

So problem is (a) how many empty dicts, and (b) how much memory this patch 
saves.

> And this makes PyDict_New() hard to understand. :-(

Yes, but it is not new complexity because it's same to d.clear().

--

___
Python tracker 

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



[issue30048] If a task is canceled at the right moment, the cancellation is ignored

2017-04-11 Thread Evgeny Kapun

New submission from Evgeny Kapun:

If I run this code:

import asyncio as a

@a.coroutine
def coro1():
yield from a.ensure_future(coro2())
print("Still here")
yield from a.sleep(1)
print("Still here 2")

@a.coroutine
def coro2():
yield from a.sleep(1)
res = task.cancel()
print("Canceled task:", res)

loop = a.get_event_loop()
task = a.ensure_future(coro1())
loop.run_until_complete(task)

I expect the task to stop shortly after a call to cancel(). It should surely 
stop when I try to sleep(). But it doesn't. On my machine this prints:

Canceled task: True
Still here
Still here 2

So, cancel() returns True, but the task doesn't seem to be canceled.

--
components: asyncio
messages: 291522
nosy: abacabadabacaba, yselivanov
priority: normal
severity: normal
status: open
title: If a task is canceled at the right moment, the cancellation is ignored
type: behavior
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



[issue30048] If a task is canceled at the right moment, the cancellation is ignored

2017-04-11 Thread Yury Selivanov

Yury Selivanov added the comment:

Interesting. It doesn't work for both C and Python versions of the Task. I'll 
take a look in detail when I return from vacation.

--
assignee:  -> yselivanov
nosy: +inada.naoki

___
Python tracker 

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



[issue30045] Bad parameter name in re.escape()

2017-04-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

"Pattern" seems right to me.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29933] asyncio: set_write_buffer_limits() doc doesn't specify unit of the parameters

2017-04-11 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> needs patch

___
Python tracker 

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



[issue29933] asyncio: set_write_buffer_limits() doc doesn't specify unit of the parameters

2017-04-11 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
assignee: docs@python -> Mariatta
nosy: +Mariatta

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-04-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

The attached script wakeup-fd-racer.py fails consistently for me using cpython 
3.6.0 on my windows 10 vm:

> python wakeup-fd-racer.py
Attempt 0: start
Attempt 0: FAILED, took 10.0160076 seconds
select_calls = 2

(It may help that the VM only has 1 CPU? But the same test passes on Linux even 
when I use taskset to restrict it to 1 cpu. Maybe Windows has some scheduling 
heuristic where one thread writing to a socket when another thread is blocked 
on it triggers an immediate context switch.)

--
Added file: http://bugs.python.org/file46797/wakeup-fd-racer.py

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2017-04-11 Thread Xiang Zhang

Changes by Xiang Zhang :


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



[issue29642] Why does unittest.TestLoader.discover still rely on existence of __init__.py files?

2017-04-11 Thread Berker Peksag

Changes by Berker Peksag :


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