[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo

Armin Rigo added the comment:

For completeness, can you post one line saying why the much simpler solution 
"range(a).stop" is not accepted?

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Also, cachegrind shows a 3% improvement in the branch misprediction rate (from 
9.9% to 9.6%).

==82814== Mispred rate: 9.9% (  9.4% +  15.5%
==82812== Mispred rate: 9.6% (  9.1% +  14.1%   
)

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Attaching the detailed results of a CacheGrind analysis.  Here are the 
high-points (all of which were expected):

* The last level data cache miss-rate improved 12% (from 4.9% to 4.3%).
* The first level data cache miss-rate improved 14% (from 5.5% to 4.7%).
* The additional code caused the instruction cache miss-rate to get slightly 
worse (from .32% to .40%).

The last level cache misses are the most important.  Per the cachegrind docs, 
"an L1 miss will typically cost around 10 cycles, [and] an LL miss can cost as 
much as 200 cycles."

--
Added file: http://bugs.python.org/file31352/grind.txt

___
Python tracker 

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



[issue18774] There is still last bit of GNU Pth code in signalmodule.c

2013-08-17 Thread Vajrasky Kok

New submission from Vajrasky Kok:

I read this commit:
http://hg.python.org/cpython/rev/1d5f644b9241

But I noticed there is still GNU Pth code lingering around in 
Modules/signalmodule.c.

Beside of that the WITH_PTH code (in the same file) is expired already. If you 
configure python with this option (--with-pth), the configure process will 
complain that it does not recognize the option.

Attached the patch to clean up this last bit of GNU Pth code.

--
components: Extension Modules
files: remove_gnu_pth.patch
keywords: patch
messages: 195542
nosy: christian.heimes, vajrasky
priority: normal
severity: normal
status: open
title: There is still last bit of GNU Pth code in signalmodule.c
versions: Python 3.4
Added file: http://bugs.python.org/file31351/remove_gnu_pth.patch

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2013-08-17 Thread John Pye

John Pye added the comment:

This bug is still present in Python 2.7.5 on Windows 64-bit . I am currently 
providing the following instructions for MinGW-w64 users wanting to link to 
Python27.dll:

http://ascend4.org/Setting_up_a_MinGW-w64_build_environment#Setup_Python_for_compilation_of_extensions

--

___
Python tracker 

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



[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Sorry,

When I read "... wakeup fd:\n" my subconsciousness mind automatically 
translated it to "... wakeup fd: %d\n". Then you made me realized there is 
another error message below it.

I closed this ticket as invalid.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file31350/insert_clean.s

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Here's a simple benchmark to start with.

On my machine (2.4Ghz Core2 Duo with 2MB L3 cache) and compiled with GCC-4.8, 
the benchmark shows a 6% speedup for sets that spill over L2 cache and 11% for 
sets that spill over the L3 cache.

The theoretically expected result is 9.75%:

   26% collision rate (for tables that are 64% full)
 x 75% chance of adjacent entry in same cache line
 x 50% savings (two lookups for the price of one)
 -
 9.75%
 =

Most programs will have less benefit (they may smaller tables that fit in L1 
cache or have tables that are less densely filled resulting in fewer 
collisions).  My quick timings show either no change or inconsequential 
improvement in the performance of those programs.

--
Added file: http://bugs.python.org/file31349/set_bench.py

___
Python tracker 

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



[issue18562] Regex howto: revision pass

2013-08-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, this is already too long IMO. Two sentences should suffice. If you are 
calling a regex very often in a loop, then it makes sense to compile it. 
Otherwise, don't bother.

--
nosy: +pitrou

___
Python tracker 

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



[issue18562] Regex howto: revision pass

2013-08-17 Thread A.M. Kuchling

A.M. Kuchling added the comment:

Slightly revised version that modifies the discussion of when to pre-compile a 
regex and when to not bother.  I don't think this is a very important issue, so 
I don't think it needs a long discussion.

--
Added file: http://bugs.python.org/file31348/regex.diff

___
Python tracker 

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



[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The errno is in the following line (the "[OSError]" one).

--

___
Python tracker 

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



[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Same patch, but more pep8 compliant.

--
Added file: 
http://bugs.python.org/file31347/add_file_descriptor_to_exception_signal_set_wakeup_fd_v2.patch

___
Python tracker 

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



[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok

New submission from Vajrasky Kok:

When a signal handler fails to write to the file descriptor registered with 
``signal.set_wakeup_fd()``, an exception does not report which the file 
descriptor is the problematic one.

Attached the patch to put the file descriptor in the aforementioned exception 
and modify the unit test accordingly.

--
components: Extension Modules
files: add_file_descriptor_to_exception_signal_set_wakeup_fd.patch
keywords: patch
messages: 195534
nosy: pitrou, vajrasky
priority: normal
severity: normal
status: open
title: When a signal handler fails to write to the file descriptor registered 
with ``signal.set_wakeup_fd()``, an exception does not report the file 
descriptor
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file31346/add_file_descriptor_to_exception_signal_set_wakeup_fd.patch

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> With j=11, is the lookup at index 10 in the same cache line?

It might or it might not.  The cache lines are typically 64 bytes which holds 4 
key/hash pairs.  So, the odds are 75% in favor of an adjacent entry being in 
the same cache line.

If malloc where guaranteed to return 64-byte aligned memory blocks, the odds 
would be 100%, but my understanding is that 16-byte alignment is the norm.

> I read that CPU likes to prefetch data forward, 
> but I didn't know that they like prefetching backward.

The integrated memory controller can also prefetch backwards, but that won't 
help us.  The prefetching doesn't start until you've done a series of 
monotonically increasing or decreasing accesses.  There is no prefetch on the 
first probe regardless of whether you're going up or down.

The whole problem with large sets is that the data is scattered all over memory 
and is unlikely to be in cache or to benefit from prefetching in the same way 
that lists and deques do (their memory access patterns are consecutive).   

The core concept for the patch is that a cache line fetch may be expensive so 
you might as well check more than one slot once a line is fetched.  Working 
against us is that we don't have control over where malloc starts a memory 
block (possibly starting in the middle of a cache line).

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

"+ Cache line benefit:  improves the odds that the adjacent probe will
be on the same cache line (...)
+ Reduced loop overhead:  the second lookup doesn't require a new
computation of the index *i* (we just do a XOR 1) (...)"

With j=11, is the lookup at index 10 in the same cache line? Does a
cache line start at the address of the first lookup, or is it
"rounded" to the size of a cache line?

I read that CPU likes to prefetch data forward, but I didn't know that
they like prefetching backward.

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Here's an excerpt from the patch that gives a pretty good idea of what is being 
changed (the three lines of new logic are marked):

static void
set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
{
setentry *table = so->table;
setentry *entry;
size_t perturb = hash;
size_t mask = (size_t)so->mask;
size_t i, j;// the j variable is new
i = j = (size_t)hash & mask;
while(1) {
entry = &table[j];
if (entry->key == NULL)
break;
entry = &table[j ^ 1];  // this line is new
if (entry->key == NULL) // this line is new
break;  // this line new
i = i * 5 + perturb + 1;
j = i & mask;
perturb >>= PERTURB_SHIFT;
}
so->fill++;
entry->key = key;
entry->hash = hash;
so->used++;
}

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
Removed message: http://bugs.python.org/msg195530

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Here's an excerpt of the patch that gives a pretty good idea of that is being 
changed (there are essentially three lines of new logic):

static void
set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
{
setentry *table = so->table;
setentry *entry;
size_t perturb = hash;
size_t mask = (size_t)so->mask;
size_t i, j;// the j variable is new
i = j = (size_t)hash & mask;
while(1) {
entry = &table[j];
if (entry->key == NULL)
break;
entry = &table[j ^ 1];  // this line is new
if (entry->key == NULL) // this line is new
break;  // this line new
i = i * 5 + perturb + 1;
j = i & mask;
perturb >>= PERTURB_SHIFT;
}
so->fill++;
entry->key = key;
entry->hash = hash;
so->used++;
}

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> The theory is sound, but it is going to take a good deal of effort to isolate 
> the effects (either good or bad) in realistic benchmarks.

Oh, it was just asking for a microbenchmark on set(). I don't care of
a "real" benchmark (realistic use case) for such issue :-)

I asked because I don't understand all these complex things of the CPU
(cache size, data dependency, prefetch, ...), whereas I can compare
number of a microbenchmark :-) And I can try to reproduce it on a
different CPU and a different dataset. Because I don't understand
low-level CPU things, I always fear that a patch works well on a
specific CPU whereas it would behave badly on a completly different
CPU architecture (ex: RISC vs CISC).

All your arguments sound good and I'm always happy to see people
involved to optimize Python!

--

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread Maries Ionel Cristian

Maries Ionel Cristian added the comment:

Alright ... would it be a very big hack to preload libgcc in the thread module 
(at import time) ? There is platform specific code there anyway, it wouldn't be 
such a big deal would it?

--

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

2013/8/18 Maries Ionel Cristian :
> Well anyway, is there any way to preload libgcc ? Because in python2.x it 
> wasn't loaded at runtime.

On Linux, you can try to set the LD_PRELOAD environment variable as a
workaround.

LD_PRELOAD=libgcc_s.so.1 python bug.py

You may need to specify the full path.

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
priority: normal -> low

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I just made the patch a few minutes ago.  Am just starting to work on 
benchmarks.  I posted here so that you guys could help find the strengths and 
weaknesses of the approach.  

The theory is sound, but it is going to take a good deal of effort to isolate 
the effects (either good or bad) in realistic benchmarks.  The short, tight 
loops in timeit tend to put everything in cache and hide the effects  of good 
memory access patterns.

If would love to have you all team up with me on this one.  I could use help on 
timings, examining disassembly, and runs with cache grind.

This is just in the experimental phase, so it is premature to be throwing up 
obstacles with "show me your data" or "what does it do in situatation x".  At 
this point, you all could help out by running some timings designed to isolate 
the effects on high collision data big enough to not fit in  L2 cache.  I hope 
you assist in evaluating the idea with an open mind.

--

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread Maries Ionel Cristian

Maries Ionel Cristian added the comment:

Well anyway, is there any way to preload libgcc ? Because in python2.x it 
wasn't loaded at runtime.

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Do you expect visible difference on a microbenchmark? Do you have
benchmarks showing the speedup and showing that many collisions are no
too much slower?

--

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

2013/8/17 Maries Ionel Cristian :
> I don't think it's that obscure ... uwsgi has this issue
> https://www.google.com/search?q=libgcc_s.so.1+must+be+installed+for+pthread_cancel+to+work+uwsgi+site:lists.unbit.it-
> they cause it probably different but the point is that it's not
> obscure.

The error message is maybe the same, the reason is completly different:
http://lists.unbit.it/pipermail/uwsgi/2013-July/006213.html
"IT WAS A limit-as issue"

The root cause is an arbitrary limit on the size of the virtual memory.

Here the bug is that a thread B closes a file descriptor opened in a
thread B by the glibc.

--

___
Python tracker 

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-08-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Potentially relevant to this: we hope to have PEP 451 done for 3.4, which adds 
a __spec__ attribute to module objects, and will also tweak runpy to ensure -m 
registers __main__ under it's real name as well.

If pickle uses __spec__.name in preference to __name__ when __spec__ is 
defined, then objects defined in __main__ modules run via -m should start being 
pickled correctly.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-17 Thread STINNER Victor

STINNER Victor added the comment:

openssl_prng_atfork3.patch: Why not using seconds (only micro or
nanoseconds) in the seed? Add a few more bits should not reduce the
entropy. OpenSSL does hash all these bytes anyway.

+#if 1
+fprintf(stderr, "PySSL_RAND_atfork_child() seeds %i bytes in %i\n",
+(int)sizeof(seed), seed.pid);
+#endif

This should be removed from the final patch ;-)

The patch is specific to pthread. Do we need something similar on
Windows. Windows has no fork, but I don't know if OpenSSL CPRNG state
can be inherited somehow? Does Python support other platforms (other
than pthread or Windows)?

Instead of using pthread_atfork(), we can add an hook in the Python
binding of OpenSSL checking the pid. I don't know which functions
should be modified. ssl.RAND_bytes() is probably not enough :-)

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Serhiy, I've posted a patch so you can examine the effects in detail.

For something like set(range(n)), I would expect no change because the dataset 
is collision free due to Tim's design where hash(someint)==someint.  That said, 
I'm trying to optimize the general case and don't really if rare cases are 
modestly slowed.

The new code only kicks in when there is a collision.  The logic for the 
initial probe is unchanged.   The idea is to pickup some of the cache locality 
benefits of collision resolution by separate chaining, but not incurring the 
100% malloc typically associated with chaining.

When adjacent entries are in the same cache-line, the cost of the extra 
adjacent probe is much cheaper (nearly zero) than a probe somewhere else in 
memory.

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
keywords: +patch
Added file: http://bugs.python.org/file31345/so.diff

___
Python tracker 

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



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2013-08-17 Thread Michael Foord

Michael Foord added the comment:

This is done in outcome.testPartExecutor. If you add it in the except clause 
then it is *only* called on test failure or error. If we call it 
unconditionally with the result (maybe a sys.exc_info tuple?) then it could 
have extended use cases (perhaps custom reporting)?

--

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

It would be fine with me to shorten the suggestion and not repeat the defaults. 
They are currently in both doc and docstring, but with *more* words than I used.

"The file name will begin with *prefix* and end with *suffix*. There is no 
automatic addition of a period ('.') before the suffix."

The explanation of . is already in the doc in a wordier form (too wordy in my 
view). The above is much shorter than what is currently in the docstring.

--

___
Python tracker 

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



[issue18702] Report skipped tests as skipped

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually you should call parent's setUpClass at the and of declared setUpClass. 
Therefore you need 4 nontrivial lines instead of 1. The test will fail in 
setUpClass() in any case because parent's setUpClass() uses NNTP_CLASS. There 
are no behavior difference between this variants, the variant with getattr just 
is shorter.

--

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't think any explanation is needed. A docstring should be short, we can't 
duplicate a manual in it.

The mentioning suffix default is redundant because it already exposed in the 
function signature. The mentioning prefix default adds duplication. The purpose 
of introducing of the template attribute is get rid of such duplication.

--

___
Python tracker 

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



[issue18702] Report skipped tests as skipped

2013-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My original suggestion was to put the possibly failing assignment inside
  @classmethod
  def setUpClass:
NNTP_CLASS = nntplib.NNTP_SSL
so that failure of the assignment would be be reported, but not affect import.

--

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

'Filename extensions' are a proper subset of 'suffixes'.
https://en.wikipedia.org/wiki/Filename_extension
Dan 'solutions' indicates that he thinks that the two sets are or should be the 
same, which they are not. The only thing that is DOS/Windows specific is its 
more special treatment of '.'.  That said, I can see how a Windows user might 
be confused by the following awkward sentence.

If 'suffix' is specified, the file name will end with that suffix,
otherwise there will be no suffix.

as 'no suffix' is easily read as 'no extension. The manual, but not the 
docstring, addresses the possible confusion by adding

  mkstemp() does not put a dot between the file name and the suffix;
  if you need one, put it at the beginning of suffix.

I think the prefix sentence is also a bit awkward.

If 'prefix' is specified, the file name will begin with that prefix,
otherwise a default prefix is used.

I think both parameters should be explained in both docstring and doc with one 
shorter and clearer entry.

"The file name will begin with *prefix* (default 'tmp') and end with *suffix* 
(default ''). The is no automatic addition of a period ('.') before the suffix."

--
stage: test needed -> needs patch
status: pending -> open

___
Python tracker 

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



[issue18770] Python insert operation on list

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> committed/rejected

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Eric Snow

Eric Snow added the comment:

Couldn't you make use of inspect.getattr_static()?

  getattr_static(obj.__class__, '__index__').__get__(obj)()

getattr_static() does some extra work to get do the right lookup.  I haven't 
verified that it matches _PyType_Lookup() exactly, but it should be pretty 
close at least.

Also, pickle (unfortunately) also does lookup on instances rather than classes 
for the special methods (issue #16251).

--
nosy: +eric.snow

___
Python tracker 

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



[issue18702] Report skipped tests as skipped

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> You changed "NNTP_CLASS = nntplib.NNTP_SSL", which could potentially fail, to 
> "NNTP_CLASS = getattr(nntplib, 'NNTP_SSL', None)", which cannot fail.  Since 
> that was the only thing that previously could fail, the change leaves nothing 
> that can fail, so the test is not a test.

This statement is not a part of a test. It runs at module import time. As you 
said in msg194907 the failing here will prohibit the running of all tests (even 
not SSL related).

> I suggested that you either not add the third param, a default,

getattr(nntplib, 'NNTP_SSL') is same as nntplib.NNTP_SSL. And it will break all 
tests.

> or that you remove the null test completely.

The purpose of this issue is stopping silence skipping tests. If some tests 
skipped for some reasons it should be reported.

--

___
Python tracker 

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2013-08-17 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +sbt

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

How it will affect a performance of set(range(n))?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18770] Python insert operation on list

2013-08-17 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-17 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
title: Fix test_gdb for new sets dummy object -> Fix gdb plugin for new sets 
dummy object

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated patch which uses Armin's algorithm for lookup special methods 
and adds special case for int subclasses in index().

I have no idea how the documentation should look.

--
Added file: http://bugs.python.org/file31344/operator_index_3.patch

___
Python tracker 

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



[issue18772] Fix test_gdb for new sets dummy object

2013-08-17 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +dmalcolm, rhettinger

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue18772] Fix test_gdb for new sets dummy object

2013-08-17 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Changeset 2c9a2b588a89 broke the pretty-printing of sets by the gdb plugin.
Here is a temptative patch. It works, but I don't know enough to know whether 
that's the right coding style for a gdb plugin. Dave?

--
components: Demos and Tools, Interpreter Core
files: gdb_sets_repr.patch
keywords: patch
messages: 195509
nosy: larry, pitrou
priority: release blocker
severity: normal
stage: patch review
status: open
title: Fix test_gdb for new sets dummy object
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file31343/gdb_sets_repr.patch

___
Python tracker 

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



[issue16105] Pass read only FD to signal.set_wakeup_fd

2013-08-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I pushed the patch to 3.4. Thanks for the report!

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread Maries Ionel Cristian

Maries Ionel Cristian added the comment:

Correct link 
https://www.google.com/search?q=libgcc_s.so.1+must+be+installed+for+pthread_cancel+to+work+uwsgi+site:lists.unbit.it

--

___
Python tracker 

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



[issue18771] Reduce the cost of hash collisions for set objects

2013-08-17 Thread Raymond Hettinger

New submission from Raymond Hettinger:

I'm working on a patch for the lookkey() functions in Object/setobject.c.  The 
core idea is to follow the probe sequence as usual but to also check an 
adjacent entry for each probe (i.e. check &table[i & mask] as usual and then 
check &table[(i & mask) ^ 1] before going on the next probes which are 
scattered around memory).

On modern processors (anything in the last decade), this is likely to reduce 
the cost of hash collisions and reduce the number of cache lines fetched from 
memory.

+ Cache line benefit:  improves the odds that the adjacent probe will be on the 
same cache line, thereby reducing the total number of cache lines fetched.  
This benefit will work for set insertions as well as set lookups (a partial 
write to a cache line requires that a full cache line be read prior to writing, 
so it is helpful if we've just examined another slot on the same cache line).

+ Parallel execution:  because the second lookup has no data dependency on the 
first lookup, some of its instructions can be executed in parallel by the 
out-of-order engine.

+ Reduced loop overhead:  the second lookup doesn't require a new computation 
of the index *i* (we just do a XOR 1), a new perturb shift, a new masking of 
*i*, or a jump to the top of the loop.  In other words, it has all the usual 
benefits of loop unrolling.

- On the downside, even this partial unrolling when increase the total code 
size which has the negative effect of blowing other code out of the I-cache 
(typically 32kb).

? I'm unsure whether the additional if-statements will have a net positive or 
net negative effect on branch prediction rates (positive because each branch 
can be tracked separately or negative because additional branches use up more 
space in the branch prediction tables).  Once the patch is ready, I'll run 
CacheGrind to get a better sense of what is happening.

--
components: Interpreter Core
messages: 195506
nosy: haypo, rhettinger
priority: normal
severity: normal
status: open
title: Reduce the cost of hash collisions for set objects
type: performance
versions: Python 3.4

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-17 Thread Maries Ionel Cristian

Maries Ionel Cristian added the comment:

> What is the version of your libc library? Try something like "dpkg -l
> libc6".
>

 2.15-0ubuntu10.4

I don't think it's that obscure ... uwsgi has this issue
https://www.google.com/search?q=libgcc_s.so.1+must+be+installed+for+pthread_cancel+to+work+uwsgi+site:lists.unbit.it-
they cause it probably different but the point is that it's not
obscure.

--

___
Python tracker 

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

2013-08-17 Thread Charles-François Natali

Charles-François Natali added the comment:

With patch :)

--
Added file: http://bugs.python.org/file31342/subprocess_close.diff

___
Python tracker 

___diff -r 5d4fe1da2c90 Lib/test/test_subprocess.py
--- a/Lib/test/test_subprocess.py   Fri Aug 16 23:19:56 2013 +0200
+++ b/Lib/test/test_subprocess.py   Sat Aug 17 20:53:01 2013 +0200
@@ -1972,6 +1972,19 @@
 self.assertRaises(OSError, os.waitpid, pid, 0)
 self.assertNotIn(ident, [id(o) for o in subprocess._active])
 
+def test_close_fds_after_preexec(self):
+fd_status = support.findfile("fd_status.py", subdir="subprocessdata")
+
+# FDs created by preexec_fn should be closed in the child
+p = subprocess.Popen([sys.executable, fd_status],
+ stdout=subprocess.PIPE, close_fds=True,
+ preexec_fn=os.pipe)
+output, ignored = p.communicate()
+
+remaining_fds = set(map(int, output.split(b',')))
+
+self.assertTrue(remaining_fds <= set([0, 1, 2]))
+
 
 @unittest.skipUnless(mswindows, "Windows specific tests")
 class Win32ProcessTestCase(BaseTestCase):
diff -r 5d4fe1da2c90 Modules/_posixsubprocess.c
--- a/Modules/_posixsubprocess.cFri Aug 16 23:19:56 2013 +0200
+++ b/Modules/_posixsubprocess.cSat Aug 17 20:53:01 2013 +0200
@@ -412,17 +412,6 @@
 POSIX_CALL(close(errwrite));
 }
 
-if (close_fds) {
-int local_max_fd = max_fd;
-#if defined(__NetBSD__)
-local_max_fd = fcntl(0, F_MAXFD);
-if (local_max_fd < 0)
-local_max_fd = max_fd;
-#endif
-/* TODO HP-UX could use pstat_getproc() if anyone cares about it. */
-_close_open_fd_range(3, local_max_fd, py_fds_to_keep);
-}
-
 if (cwd)
 POSIX_CALL(chdir(cwd));
 
@@ -451,6 +440,18 @@
 /* Py_DECREF(result); - We're about to exec so why bother? */
 }
 
+/* close FDs after executing preexec_fn, which might open FDs */
+if (close_fds) {
+int local_max_fd = max_fd;
+#if defined(__NetBSD__)
+local_max_fd = fcntl(0, F_MAXFD);
+if (local_max_fd < 0)
+local_max_fd = max_fd;
+#endif
+/* TODO HP-UX could use pstat_getproc() if anyone cares about it. */
+_close_open_fd_range(3, local_max_fd, py_fds_to_keep);
+}
+
 /* This loop matches the Lib/os.py _execvpe()'s PATH search when */
 /* given the executable_list generated by Lib/subprocess.py. */
 saved_errno = 0;
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10654] test_datetime sometimes fails on Python3.x windows binary

2013-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

test_datetime passes on current 3.3 and 3.4.
datetimetest.py now gives the same answer for all 4 classes

unsupported operand type(s) for +: 'SubPy' and 'int'
unsupported operand type(s) for +: 'int' and 'SubPy'
NotImplemented NotImplemented NotImplemented NotImplemented

whereas the first line for the two subclasses was previously NotImplemented. I 
presume the above is the correct behavior, so closing.

--
resolution:  -> out of date
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue16105] Pass read only FD to signal.set_wakeup_fd

2013-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e2b234f5bf7d by Antoine Pitrou in branch 'default':
Issue #16105: When a signal handler fails to write to the file descriptor 
registered with ``signal.set_wakeup_fd()``, report an exception instead of 
ignoring the error.
http://hg.python.org/cpython/rev/e2b234f5bf7d

--
nosy: +python-dev

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-17 Thread Charles-François Natali

Charles-François Natali added the comment:

2013/8/17 Christian Heimes :
> Here is a patch that is based on Apache's mod_ssl code. mod_ssl perturbs the 
> PRNG state more often but I think that's overkill for Python.
>
> The new patch only affects the PRNG state of the child process. In my opinion 
> it is the better way to solve this issue. The RAND API does some internal 
> locking. Bad things might happen if one thread of a process calls fork() 
> while another is in the middle of a locked RAND operation.

Ouch, this would mean making the interpreter prone to deadlock/crash
(since the atfork hook is not async-signal safe) :-\

--

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The patch looks fine on the principle, but you should add a test.

--

___
Python tracker 

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-08-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Alexandre, Stefan, is any of you working on this?
If not, could you please expose what the status of the patch is, whose work is 
the most advanced (Alexandre's or Stefan's) and what should be the plan to move 
this forward?

Thanks!

--

___
Python tracker 

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



[issue18770] Python insert operation on list

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

The docs say that:
  l.insert(pos, val)
is equivalent to:
  l[pos:pos] = [val]
The docstring also says that the value is inserted before pos, so .insert is 
working as documented.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18770] Python insert operation on list

2013-08-17 Thread Vivek Ratnaparkhi

New submission from Vivek Ratnaparkhi:

Example 1:

mylist = ['a','b','c','d','e']
mylist.insert(len(mylist),'f')
print(mylist)

Output: ['a', 'b', 'c', 'd', 'e', 'f']

Example 2:

mylist = ['a','b','c','d','e']
mylist.insert(10,'f')
print(mylist)

Output: ['a', 'b', 'c', 'd', 'e', 'f']

Why should mylist.insert(len(mylist), x) be equivalent to 
mylist.insert(len(mylist)+10, x)

Excepted Output: Should give index error.

--
messages: 195497
nosy: vivek.ratnaparkhi
priority: normal
severity: normal
status: open
title: Python insert operation on list
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
status: open -> pending

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

Works for me on Linux too (all branches, with different types of suffix).
Maybe it's a Windows issue?

--
nosy: +terry.reedy
status: pending -> open

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> import tempfile
>>> f = tempfile.NamedTemporaryFile(suffix='$')
>>> f.name
'/tmp/tmpumyks8ju$'

I see an effect.

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue12866] Want to submit our Audioop.c patch for 24bit audio

2013-08-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18769] argparse remove subparser

2013-08-17 Thread Michael Bikovitsky

New submission from Michael Bikovitsky:

It might be useful in some circumstances to be able to remove a subparser, 
however the module does not provide such functionality.

The proposed method takes the same arguments as the add_parser method and 
removes the matching subparser from the map (including aliases).

--
components: Library (Lib)
files: argparse_remove_parser.patch
keywords: patch
messages: 195494
nosy: Michael.Bikovitsky, bethard
priority: normal
severity: normal
status: open
title: argparse remove subparser
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31341/argparse_remove_parser.patch

___
Python tracker 

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



[issue18178] Redefinition of malloc(3) family of functions at build time

2013-08-17 Thread koobs

koobs added the comment:

Commit looks good, confirming test suite passing for 3.x, 3.3 and 2.7.on 
http://buildbot.python.org/all/buildslaves/koobs-freebsd10

Thank you for picking this up and finishing it off Christian.

--

___
Python tracker 

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



[issue18746] test_threading.test_finalize_with_trace() fails on FreeBSD buildbot

2013-08-17 Thread koobs

koobs added the comment:

I'm not sure if this issue is/was related, but it seems the commit addressing 
#18178 has taken care of the test_finalize_runnning_thread failure.

I note that your description specifies test_finalize_"with_trace", perhaps 
suggesting your reproduction case may be something slightly different?

FWIW, I don't think I've seen the 'with_trace' test fail on my buildbots (but 
correct me if I'm wrong)

After the commit mentioned above, the FreeBSD 10 buildbot is now green on all 
branches.

--

___
Python tracker 

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



[issue11671] Security hole in wsgiref.headers.Headers

2013-08-17 Thread Devin Cook

Devin Cook added the comment:

It looks like it's allowed for header line continuation.

http://www.ietf.org/rfc/rfc2616.txt

HTTP/1.1 header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.

...

A CRLF is allowed in the definition of TEXT only as part of a header
field continuation. It is expected that the folding LWS will be
replaced with a single SP before interpretation of the TEXT value.

--

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo

Armin Rigo added the comment:

Sorry, realized that my pure Python algorithm isn't equivalent to 
_PyType_Lookup() --- it fails the staticmethod example of Serhiy.  A closer one 
would be:

for t in type(a).__mro__:
if '__index__' in t.__dict__:
return t.__dict__['__index__'].__get__(a)()

But it's still not a perfect match.  I think right now the only "perfect" 
answer is given by workarounds like "range(a).stop"...

--

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo

Armin Rigo added the comment:

This may have been the most recent discussion of this idea (as far as I can 
tell):
http://mail.python.org/pipermail//python-ideas/2012-August/016036.html

Basically, it seems to be still unresolved in the trunk Python; sorry, I 
thought by now it would have been resolved e.g. by the addition of a method on 
types or a function in the operator module.  In the absence of either, you need 
either to simulate its behavior by doing this:

for t in type(a).__mro__:
if '__index__' in t.__dict__:
return t.__dict__['__index__'](a)

Or you can piggyback on an unrelated call that simply causes the C-level 
PyNumber_Index() to be called:

return range(a).stop

--

___
Python tracker 

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-17 Thread Christian Heimes

Christian Heimes added the comment:

Here is a patch that is based on Apache's mod_ssl code. mod_ssl perturbs the 
PRNG state more often but I think that's overkill for Python.

The new patch only affects the PRNG state of the child process. In my opinion 
it is the better way to solve this issue. The RAND API does some internal 
locking. Bad things might happen if one thread of a process calls fork() while 
another is in the middle of a locked RAND operation.

--
Added file: http://bugs.python.org/file31340/openssl_prng_atfork3.patch

___
Python tracker 

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



[issue11671] Security hole in wsgiref.headers.Headers

2013-08-17 Thread Christian Heimes

Christian Heimes added the comment:

What do the RFCs for RFC-822 and HTTP 1.1 say about \r and \n in header names?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue2506] Add mechanism to disable optimizations

2013-08-17 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe :


--
nosy: +tshepang
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue2516] Instance methods are misreporting the number of arguments

2013-08-17 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe :


--
nosy: +tshepang
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Christian Heimes

Christian Heimes added the comment:

Thanks :)

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ae91252943bf by Christian Heimes in branch '3.3':
Issue 18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/ae91252943bf

New changeset 5c091acc799f by Christian Heimes in branch 'default':
Issue 18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/5c091acc799f

New changeset 31389495cdbf by Christian Heimes in branch '2.7':
Issue 18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/31389495cdbf

--

___
Python tracker 

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



[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Christian Heimes

Christian Heimes added the comment:

Thanks, I have removed the extra space in gntype = name-> type;

--

___
Python tracker 

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



[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b352a5cb60b6 by Christian Heimes in branch '3.3':
Issue #18768: coding style nitpick. Thanks to Vajrasky Kok
http://hg.python.org/cpython/rev/b352a5cb60b6

New changeset fe444f324756 by Christian Heimes in branch 'default':
Issue #18768: coding style nitpick. Thanks to Vajrasky Kok
http://hg.python.org/cpython/rev/fe444f324756

New changeset a8787a6fa107 by Christian Heimes in branch '2.7':
Issue #18768: coding style nitpick. Thanks to Vajrasky Kok
http://hg.python.org/cpython/rev/a8787a6fa107

--
nosy: +python-dev

___
Python tracker 

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



[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Vajrasky Kok

New submission from Vajrasky Kok:

>>> import ssl
>>> ssl.RAND_egd.__doc__
"RAND_egd(path) -> bytes\n\nQueries the entropy gather daemon (EGD) on the 
socket named by 'path'.\nReturns number of bytes read.  Raises SSLError if 
connection to EGD\nfails or if it does provide enough data to seed PRNG."

Compare it to documentation about RAND_egd() function from openssl website 
(https://www.openssl.org/docs/crypto/RAND_egd.html):

RAND_egd() and RAND_egd_bytes() return the number of bytes read from the daemon 
on success, and -1 if the connection failed or the daemon did not return enough 
data to fully seed the PRNG. 

Attached the patch to fix the documentation. I am not sure whether we should 
put the word "fully" or not.

On the side note:
In line 813 in Modules/_ssl.c (the same file where my patch fixed the 
documentation about RAND_egd function):

gntype = name-> type;

The space between "->" and "type" irritates my eyes. Maybe we can fix this 
while we fix the documentation? Anyway, this is not really important. I just 
want to expose it to public and think this does not deserve a dedicated ticket.

--
assignee: docs@python
components: Documentation
files: fix_documentation_on_rand_egd_function.patch
keywords: patch
messages: 195482
nosy: christian.heimes, docs@python, vajrasky
priority: normal
severity: normal
status: open
title: Wrong documentation of RAND_egd function in ssl module
versions: Python 3.3, Python 3.4
Added file: 
http://bugs.python.org/file31338/fix_documentation_on_rand_egd_function.patch

___
Python tracker 

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



[issue15939] make *.rst files in Doc/ parseable by doctest

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
type:  -> enhancement
versions:  -Python 3.2
Added file: http://bugs.python.org/file31339/issue15939-ctypes-2.diff

___
Python tracker 

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



[issue18762] error in test_multiprocessing_forkserver

2013-08-17 Thread koobs

koobs added the comment:

2 more cases seen here:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/227/steps/test/logs/stdio

Note: cc on FreeBSD 10.0-CURRENT is clang

and here:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%203.x/builds/1825/steps/test/logs/stdio

--
nosy: +koobs

___
Python tracker 

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2013-08-17 Thread James Sanders

James Sanders added the comment:

I did a bit more digging and I think I've worked out what is going on.  The 
particular bit of tcl initialization code that triggers the problem if it is 
run before the fork is Tcl_InitNotifier in tclUnixNotify.c.  It turns out there 
is a known problem with this bit of tcl not being process-safe if tcl was built 
with threading support (this is discussed at 
https://bugs.archlinux.org/task/16401, for example).

The bug doesn't show up in my 8.5 builds as threading support is off by 
default, though the debian/ubuntu packages apparently have it switched on.  
Threading was turned on by default in 8.6, but a recent change to 
tclUnixNotify.c (discussed at 
https://issues.apache.org/bugzilla/show_bug.cgi?id=55153#c13 - it should be 
included in 8.6.1 and 8.5.15) appears to have fixed the whole problem anyway.

So hopefully the bug should disappear entirely in future releases of tcl, but 
for now you can work around it by building tcl without threads, calling exec in 
between the fork and any use of tkinter in the child process, or not importing 
tkinter until after the fork.  I don't know if there should be a note about 
this somewhere in the tkinter docs?

--

___
Python tracker 

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



[issue18553] os.isatty() is not Unix only

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

Are there tests for this?

--
components: +Tests
keywords: +easy
nosy: +ezio.melotti

___
Python tracker 

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



[issue12985] Check signed arithmetic overflow in ./configure

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
versions: +Python 3.4 -Python 3.1, Python 3.2

___
Python tracker 

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



[issue13822] is(upper/lower/title) are not exactly correct

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue18626] Make "python -m inspect " meaningful

2013-08-17 Thread Nick Coghlan

Nick Coghlan added the comment:

I realised that with the "module:qualname" syntax, it's straightforward to 
expand this beyond module introspection to arbitrary objects.

What I suggest we could output:

- a header with key module info (names taken from PEP 451):
Origin
Cached
Submodule search path
Loader (repr output)

- for non-module objects, also include the line within the file (if it can be 
determined)

- the output of getsource() if a "--source" option is given

--
title: Make "python -m inspect " dump the source of a module -> Make 
"python -m inspect " meaningful

___
Python tracker 

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



[issue13924] Mercurial robots.txt should let robots crawl landing pages.

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
stage:  -> needs patch

___
Python tracker 

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



[issue16699] Mountain Lion buildbot lacks disk space

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
resolution:  -> out of date
stage:  -> committed/rejected
status: open -> closed
type:  -> resource usage

___
Python tracker 

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



[issue5720] ctime: I don't think that word means what you think it means.

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

What was the outcome?

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Mark Dickinson

Mark Dickinson added the comment:

Serhiy:  Yep, or even on bool.  Thanks.

Armin: I don't think either of us thinks there isn't a problem here. :-)
The Google search you suggested didn't turn up a whole lot of useful 
information for me.  Was there a discussion of this on python-dev at some 
point?  (And if not, should there be?)

For this *particular* issue, it seems we can't exactly reproduce.  
type(a).__index__(a) seems like the best practical approximation to the true 
behaviour.  I'm guessing that it's fairly rare to have useful definitions of 
__index__ on a metaclass.

--

___
Python tracker 

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



[issue17232] Improve -O docs

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

Terry, do you want to update your patch?

--
versions:  -Python 3.2

___
Python tracker 

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



[issue12913] Add a debugging howto

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
type:  -> enhancement
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Hmm.  "type(a).__dict__['__index__'](a)" ?

This variant fails on:

class A(int):
@staticmethod
def __index__():
return 42

--

___
Python tracker 

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



[issue10654] test_datetime sometimes fails on Python3.x windows binary

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

Is this still an issue?

--
nosy: +ezio.melotti
type:  -> behavior

___
Python tracker 

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



[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

FWIW now we have Lib/test/test_tools.py.

--
nosy: +ezio.melotti
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue12866] Want to submit our Audioop.c patch for 24bit audio

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

What's the status of this?

--
nosy: +ezio.melotti
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue6916] Remove deprecated items from asynchat

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

What's the status of this?

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
assignee:  -> docs@python
components: +Documentation
keywords: +easy
nosy: +docs@python
versions: +Python 2.7, Python 3.3

___
Python tracker 

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



[issue9882] abspath from directory

2013-08-17 Thread Ezio Melotti

Ezio Melotti added the comment:

Was this brought up on python-ideas?  If so, what was the outcome?

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue13107] Text width in optparse.py can become negative

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
stage: needs patch -> test needed

___
Python tracker 

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



[issue18730] suffix parameter in NamedTemporaryFile silently fails when not prepending with a period

2013-08-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
nosy: +ezio.melotti
stage:  -> test needed
versions: +Python 3.3, Python 3.4

___
Python tracker 

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



  1   2   >