[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

To Build:

$ gcc -fPIC -shared -o psempy.c psempy.so -I/usr/include/python2.6
-L/usr/lib/python2.6 -lpython2.6  mv psempy.so psem.so
$ dd if=/dev/urandom of=app1_20090407.01.log bs=100 count=1
$ python
 import sys, os, re, datetime, psem, psem_example
 psem_example.compress_log( app1, 2009, 04, 07, 01, bzip,
app1_20090407.01.log);
0

Example psem.so using program that compresses logs 
named *{YEAR}-${MONTH}-${DAY}* in a psem.* based 
parallel for .
On a 32 2Ghz processor SPARC, the time taken to compress
32 1MB files using the psem parallel-for (for 32 CPUs) 
was really of the order of the time taken to compress 1
1MB file - ie. roughly 1/32nd of the time taken to compress
32 files serially . 
The number of processes was made secure and run-away safe 
ONLY because direct access was available to the 
   semop(2), semget(2), and semctl(2) system calls.
Please can Python put this API into sys or I will create a
Python add-on module to do so - let me know whether this is
a good idea or not - thank you, Jason.

--
Added file: http://bugs.python.org/file13656/psem_example.py

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

Changes by jvdias jason.vas.d...@gmail.com:


Removed file: http://bugs.python.org/file13656/psem_example.py

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

Example Python use of psem.so Parallel ForEach : Log Compressor

Usage:

$ gcc -o psem.so -fPIC -shared psempy.c -I/usr/include/python2.6
-L/usr/lib/python2.6 -lpython2.6
$ dd if=/dev/urandom bs=100 count=1 of=app1_20090407.01.log
$ python 
Python 2.6 (r26:66714, Oct 16 2008, 00:21:12)
[GCC 4.2.4] on linux2
Type help, copyright, credits or license for more information.
 import sys, os, re, datetime, psem, psem_example
 psem_example.compress_log( app1, 2009, 04, 07, 01, bzip,
app2_20090407.02.log);
0
 quit
Use quit() or Ctrl-D (i.e. EOF) to exit


Now, one can time for example 16 runs of the above command with 
16 different input files, and on a 16 CPU machine one would expect
the elapsed time between start and finish to be of the order of
1/16th of the time taken to compress all of the 16 files sequentially.

--
Added file: http://bugs.python.org/file13657/psem_example.py

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

The same issue is present in 2.4 and 2.5 as well as 3.0 so I'm updating
this issue accordingly (haven't tried 2.7 or 3.1).  I've been working
around this issue with some success and will be posting patches shortly.

--
nosy: +julians37
versions: +Python 2.4, Python 2.5, Python 3.0

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

$ time /usr/bin/python2.6 ./psem_example.py 21 | tee log
Do you really want to run test using 16 1MB log files ? Y/Ny
generating files 0..15
generating file 0
generating file 1
generating file 2
generating file 3
generating file 4
generating file 5
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.783862 s, 1.3 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.890675 s, 1.1 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.831693 s, 1.2 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.84914 s, 1.2 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.885601 s, 1.1 MB/s
generating file 6
generating file 7
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.942455 s, 1.1 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.282143 s, 3.5 MB/s
generating file 8
generating file 9
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.41776 s, 2.4 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.292488 s, 3.4 MB/s
generating file 10
generating file 11
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.396643 s, 2.5 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.2736 s, 3.7 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.316026 s, 3.2 MB/s
generating file 12
generating file 13
generating file 14
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.349368 s, 2.9 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.364177 s, 2.7 MB/s
generating file 15
compressing files 0..15
compressing file 0
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.495831 s, 2.0 MB/s
1+0 records in
1+0 records out
100 bytes (1.0 MB) copied, 0.229301 s, 4.4 MB/s
compressing file 1
compressing file 2
compressing file 3
compressing file 4
compressing file 5
compressing file 6
compressing file 7
compressing file 8
compressing file 9
compressing file 10
compressing file 11
compressing file 12
compressing file 13
compressing file 14
compressing file 15

real0m10.700s
user0m7.987s
sys 0m5.130s

--
Added file: http://bugs.python.org/file13658/psem_example.py

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

Actually this seems to be fixed in 3.0.1 - yay!

--
versions:  -Python 3.0

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

Attached a fix for release26-maint branch.

I've tested this as follows:

./configure --enable-toolbox-glue --enable-universalsdk
--enable-framework=/tmp/python-2.6-maint-install/Library/Framework
--prefix=/tmp/python-2.6-maint-install  make -j3  make frameworkinstall

I have not tested this with the default install paths.

Patches for 2.5 and 2.4 coming up.

--
keywords: +patch
Added file: 
http://bugs.python.org/file13659/Python-2.6-maint-osx-framework-path.patch

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



[issue5676] shutils test fails on ZFS (on FUSE, on Linux)

2009-04-09 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

The analysis I wrote on 2009/4/6 is correct, but I just discovered
another important detail: it only happens on my ZFS partition.  I'm
using ZFS on Linux, via FUSE.  No wonder I'm the only person it's
happening to!  I don't know whether it's because of FUSE or because of
ZFS; if it's because of ZFS, then more people will see this once the
next rev of OS X hits the streets.

To reproduce:
% mkdir foo
% touch foo/a
% chmod 400 foo
% python -c 'import os ; print(os.listdir(foo))'

On my ext4 root partition this works, printing
  ['a']
On my ZFS home partition this fails, printing
  Traceback (most recent call last):
File string, line 1, in module
  OSError: [Errno 13] Permission denied: 'foo'

I observe this behavior in Python 2.6.1 and in py3k/trunk.

The attached patch fixes test_shutil so it passes on both partitions. 
The fix: allow the first failure to be *either* os.listdir (in which
case arg must be TESTFN) or os.remove (in which case arg must be
self.childpath).  Patch was written against r71404.

--
title: Fix make clean in py3k/trunk - shutils test fails on ZFS (on FUSE, on 
Linux)
versions: +Python 2.6
Added file: http://bugs.python.org/file13660/lch.test_shutil.r71404.diff

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



[issue5676] shutils test fails on ZFS (on FUSE, on Linux)

2009-04-09 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

I should be more specific: patch was written against py3k/trunk r71404.
 Though I imagine a very similar patch could be written for 2.7 (or 2.6
if appropriate).

--

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

Julian: patches for 2.4 and 2.5 will not be accepted, both releases are in 
critical security fixes only mode.

--

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

I had a hunch that might be the case.  I'm still planning to upload them
here for the benefit of others who, like me, have to maintain those
versions as framework installs.  Is that OK?

--

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

I was a bit surprised myself but I've just double-checked and it seems
to work fine.  I started with a freshly unpacked 3.0.1 tarball and used
the following command:

./configure --enable-toolbox-glue --enable-universalsdk
--enable-framework=/tmp/python-3.0.1-install/Library/Framework
--prefix=/tmp/python-3.0.1-install  make -j3  make fullinstall

That went through OK, everything seems to be in its place and the
interpreter starts up.

I was testing with make frameworkinstall earlier, that worked, too.

One question, $PREFIX/bin doesn't have the files without version number
(e.g. it has python3.0 but doesn't have python) even in fullinstall
mode.  Is that intentional?  (The framework's bin directory does have
all files.)  I've seen the same issue in 2.6.

--

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

Uploading a patch is fine, my comment was just a warning that your patch 
won't be applied in the repository (at least not for 2.4 and 2.5).

I will look at your patch for 2.6 in the near future. 

Are you sure that the issue is fixed in 3.x? AFAIK that would be 
completely accidental, I'm pretty sure I haven't changed anything that 
would affect this.

--

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



[issue5727] doctest pdb readline broken

2009-04-09 Thread Wolfgang Schnerring

New submission from Wolfgang Schnerring wosc+pyt...@wosc.de:

When pdb is called from inside a doctest under python2.5, the readline
keys do not work anymore -- like they did just fine in 2.4.

Steps to reproduce: 
1. Create two files, foo.txt and foo.py, like so:
$ cat  foo.txt
 import pdb; pdb.set_trace()
$ cat  foo.py
import doctest; doctest.testfile('foo.txt')
2. run it
$ python2.5 foo.py
3. If I now press Ctrl-P, I get ^P printed on the prompt, instead of
going back in the readline history. Likewise, the arrow keys print
escape sequences instead of moving the cursor.

--
components: Library (Lib)
messages: 85808
nosy: wosc
severity: normal
status: open
title: doctest pdb readline broken
type: behavior
versions: Python 2.5

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

C source code implementing psem.* python module functions

--
Added file: http://bugs.python.org/file13662/psempy.c

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

Changes by jvdias jason.vas.d...@gmail.com:


Removed file: http://bugs.python.org/file13655/psempy.c

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

On second thought, are you sure that's how fullinstall is meant to work?
If I use frameworkinstall I get the following message at the end:

* Note: not installed as 'python'.
* Use 'make fullinstall' to install as 'python'.
* However, 'make fullinstall' is discouraged,
* as it will clobber your Python 2.x installation.

Doesn't that suggest that fullinstall would put the no-suffix symlinks
in place?

In other words, is there a reason that no-suffix links _are_ installed
in the framework bin directory in fullinstall mode, but aren't installed
in $PREFIX/bin?

--

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

Changes by jvdias jason.vas.d...@gmail.com:


--
components: +Interpreter Core

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



[issue5728] Support telling TestResult objects a test run has finished

2009-04-09 Thread Robert Collins

New submission from Robert Collins robe...@robertcollins.net:

Original mail:
JML's testtools has a TestResult subclass with a done() method. The
reason for this method is to allow doing things after the last test has
run. While a result can infer 'first test' it can't infer 'last test'
without ugliness like __del__.

Some uses for this are:
 - reporting summary data
 - closing external resources like log files, sockets to remote machines
etc
 - your idea here

This can be added quite safely I think - check for the attribute, and if
present call it.

done() could be spelt differently - I don't think anyone would care.
testsFinished()
finished()
etc.

--
components: Library (Lib)
messages: 85812
nosy: michael.foord, olemis, rbcollins
severity: normal
status: open
title: Support telling TestResult objects a test run has finished
versions: Python 2.7, Python 3.1

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



[issue5728] Support telling TestResult objects a test run has finished

2009-04-09 Thread Robert Collins

Robert Collins robe...@robertcollins.net added the comment:

Now, some refinements, as usual (for me at least) when considering a
feature like this from an upstream perspective, where one's immediate
use cases are just special cases not general case, I've come up with
some refinements.

Firstly, I said you can infer starting. But its asymmetrical to have a
'run is finished' method that unittest will call, and not a 'run is
about to start' method too. So I think we should have two methods,
paired. This will avoid people having to write inference code themselves
every time.

Secondly, TestCase.run(None) creates a result. I think it would be good
to make a clear statement about who, and when should and will call these
two new methods. Something like:

Whomever calls 'start' is responsible for calling 'done'. Concretely
this means that when TestCase implicitly creates a TestResult, it will
call start, and also call done.

Thirdly, naming. I'm agnostic, but I'd lean towards something clear, and
something that can't be easily confused with startTest/stopTest. e.g.
'startTestRun' and 'stopTestRun' (just pluralising 'Test' to 'Tests'
would be easily confusable).

If this all makes sense, I'll write up some tests and put a patch
together. I'm pasting this into the issue to, for folk that watch issues
only :).

--

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



[issue5726] ld_so_aix does exit successfully even in case of failure

2009-04-09 Thread Floris Bruynooghe

New submission from Floris Bruynooghe floris.bruynoo...@gmail.com:

ld_so_aix is used to invoke the linker correctly on AIX.  However when
the linking fails the script happily returns 0 and a Makefile using it
will assume all went well.

See the trivial patch attached.

--
components: Build
files: ld_so_aix.diff
keywords: patch
messages: 85807
nosy: flub
severity: normal
status: open
title: ld_so_aix does exit successfully even in case of failure
type: compile error
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13661/ld_so_aix.diff

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Julian Scheid

Julian Scheid julian...@gmail.com added the comment:

Ah, that makes sense - thanks for clarifying.

And I was mistaken about 2.6, the no-suffix symlinks are there in
$PREFIX/bin so all is good.

Let me know what you think of the patch when you get a chance to look at it.

--

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

PS: Timings for x86{-32,-64} or ia{32,64} architectures are likely
to show a significantly smaller speedup because they truly are
 MIMD CISC pipeline machines ( the multiple-core feature and
IA64 instruction triplet groups mean they are more optimized
for hyperthreading WITHIN the same process.

Please remember that Python must also be capable of taking advantage
of SIMD parallelism also on architectures such as the SPARC where
often fork()-ing a new process is vastly more efficient than 
creating a new LWP with true shared memory .
  
On the amd64 machines, also, which do not have such a huge
microcode overhead headache such as on IA64 machines, 
running multiple processes instead of multiple threads
can often be more efficient.

But on ia64 and of course single-processor machines of all types
there is no improvement to be found in running multiple processes
and running multiple threads is greatly to be preferred .

--

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



[issue3646] MacOS X framework install to non-standard directory fails

2009-04-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

For 3.1 I need to check if the right files get install into the various 
'bin' directories. At the languages summit at PyCon'09 the consensus 
seemed to be that the command-line interpreter for Python 3.x should be 
python3 and that python would always refer to a Python 2.x 
interpreter.

I haven't updated the Mac Makefiles for that yet.

--

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

I suggest a new sys SysV-semaphore API :

  sys.semget( sem_key, sem_nsems, sem_flags)
  sys.SEM_KEY_ANY = 0
  sys.SEM_UNDO= 0x1000   /*chain of atomic kernel UNDO operations*/ 
  sys.SEM_GETPID  = 11   /* get sempid */
  sys.SEM_GETVAL  = 12   /* get semval */
  sys.SEM_GETALL  = 13   /* get all semval's */
  sys.SEM_GETNCNT = 14   /* get semncnt */
  sys.SEM_GETZCNT = 15   /* get semzcnt */
  sys.SEM_SETVAL  = 16   /* set semval */
  sys.SEM_SETALL  = 17   /* set all semval's */
#if ( ! defined(__sun__) ) || defined ( __GNU__ )
  sys.SEM_STAT= 18
  sys.SEM_INFO= 19
#endif
  
  sys.semop(semid, sops, nsops)

  sys.semtimedop(semid, sops, nsops,
 timeout
)
  
  sys.semctl(semid, semnum, cmd, ...);

--
versions: +Python 2.6, Python 2.7

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

Changes by jvdias jason.vas.d...@gmail.com:


Removed file: http://bugs.python.org/file13657/psem_example.py

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc

Changes by djc dirk...@ochtman.nl:


--
nosy: +djc

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc

djc dirk...@ochtman.nl added the comment:

I'll take a stab at doing it Raymond's way this weekend.

--

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



[issue5728] Support telling TestResult objects a test run has finished

2009-04-09 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

startTestRun and stopTestRun sound good to me.

--

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



[issue5673] Add timeout option to subprocess.Popen

2009-04-09 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I think taking this to python-ideas to discuss the API (and the
implementation) would be the best way forward.  You can probably get
help on the Windows stuff there, too.

You are also going to need unit tests.

--
nosy: +r.david.murray
stage:  - test needed

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

jvdias jason.vas.d...@gmail.com added the comment:

Contrast what I had to do to perform a process semaphore operation
in Python with how one would do it in PERL :

-- Perl 5.10.0 documentation --
Show toolbar
Home  Language reference  Functions  semop
semop
Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

* semop KEY,OPSTRING

  Calls the System V IPC function semop to perform semaphore
operations such as signalling and waiting. OPSTRING must be a packed
array of semop structures. Each semop structure can be generated with
pack(s!3, $semnum, $semop, $semflag) . The length of OPSTRING implies
the number of semaphore operations. Returns true if successful, or false
if there is an error. As an example, the following code waits on
semaphore $semnum of semaphore id $semid:

  $semop = pack(s!3, $semnum, -1, 0);
  die Semaphore trouble: $!\n unless semop($semid, $semop);

  To signal the semaphore, replace -1 with 1 . See also SysV IPC
in perlipc, IPC::SysV , and IPC::SysV::Semaphore documentation.

Nice ! Why can't Python provide something similar ?

Then my example psempy.c module could be implemented in 100% pure
python.

I'm bringing this issue up here so as to gain some feedback from
the Python development team as to the likelihood of Python's Core
'sys' module ever supportting process-scope semaphores - if I don't
here back from them within three days I'll submit a patch for
Python to support the sys.semget(), sys.semctl(), and
sys.semop/sys.semtimedop operations as described above .

--

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



[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-09 Thread Paul Morelle

Paul Morelle madp...@htkc.org added the comment:

Hello, I can reproduce the bug on a Windows XP Professional, SP 3, with
three versions of Python:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
win32
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32

I can have this error code with the following code:

===
import struct, subprocess

command = 'C:\\WINDOWS\\NOTEPAD.EXE'
env = {'FOO': 'bar'}
p = subprocess.Popen(command, env=env)

p.wait()

err = struct.unpack('I', struct.pack('i', p.returncode))[0]
print '%x (%d)'%(err, err)
===

The output is c0150004 (3222601732) with the three versions

If the `env' variable is set to None before the creation of the Popen
object, then Notepad.exe is launched correctly.

So, it is not only the python interpreter that fails with this call, it
would be the call to CreateProcess in the subprocess module that would
be incorrect…

Any hint?

--
nosy: +madprog
title: Starting Python as a subprocess fails when subprocess.Popen has env 
argument - Starting any program as a subprocess fails when subprocess.Popen 
has env argument
Added file: http://bugs.python.org/file13663/fail2.py

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



[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-09 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

If you are passing a custom environment to a subprocess, then you must
supply everything in that environment that the program you are calling
requires in order to run.

That said, it would be a good idea to document the Windows minimum
environment requirements in the subprocess documentation.  Hopefully
someone can come up with a doc patch; as a non-Windows user I can't be
of much help with that.

--
assignee:  - georg.brandl
components: +Documentation -Library (Lib), Windows
nosy: +georg.brandl, r.david.murray
priority:  - normal
stage:  - needs patch
type: crash - feature request
versions: +Python 2.7, Python 3.0, Python 3.1

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



[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-09 Thread Paul Morelle

Paul Morelle madp...@htkc.org added the comment:

I have just figured out that if you initialize env with
os.environ.copy() and then add/modify its components, then the bug
disappears:

env = os.environ.copy()
env['FOO'] = 'BAR'
[…]

But I have no idea (for the moment) of which variable is mandatory or not.

--

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



[issue5729] Allows tabs for indenting JSON output

2009-04-09 Thread Walter Dörwald

New submission from Walter Dörwald wal...@livinglogic.de:

This patchs makes it possible to use tabs for indenting the output of
json.dumps(). With this patch the indent argument can now be either an
integer specifying the number of spaces per indent level or a string
specifying the indent string directly::

   json.dumps(list(range(10), indent=3) # three spaces per indent
   json.dumps(list(range(10), indent=\t) # one tab per indent

--
components: Library (Lib)
files: json.diff
keywords: patch
messages: 85821
nosy: doerwalter
severity: normal
status: open
title: Allows tabs for indenting JSON output
type: feature request
versions: Python 3.1
Added file: http://bugs.python.org/file13664/json.diff

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread jvdias

Changes by jvdias jason.vas.d...@gmail.com:


--
versions: +Python 3.0, Python 3.1

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



[issue4799] handling inf/nan in '%f'

2009-04-09 Thread Christoph Zwerschke

Christoph Zwerschke c...@online.de added the comment:

This is a related problem on Windows:

'%g' % 1e400 - '1.#INF'
'%.f'  % 1e400 -- '1'

--
nosy: +cito

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



[issue2170] rewrite of minidom.Node.normalize

2009-04-09 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
versions:  -Python 2.6, Python 3.0

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



[issue5728] Support telling TestResult objects a test run has finished

2009-04-09 Thread Doug Philips

Doug Philips d...@mac.com added the comment:

Quite useful! Names are hard, but the ones proposed are pretty good.

--
nosy: +dgou

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



[issue5730] setdefault speedup

2009-04-09 Thread Dan Schult

New submission from Dan Schult dsch...@colgate.edu:

In the depths of dictobject.c one can see that dict_setdefault uses two 
identical calls to PyObject_Hash and ma_lookup.  The first to see if the 
item is in the dict, the second (only if key is not present) to add the 
item to the dict.

This second lookup (and hash) are not needed and can be avoided by 
inlining a portion of PyDict_SetItem instead of calling the entire 
subroutine.

--
components: Interpreter Core
messages: 85824
nosy: dschult
severity: normal
status: open
title: setdefault speedup
type: performance
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

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



[issue5730] setdefault speedup

2009-04-09 Thread Dan Schult

Changes by Dan Schult dsch...@colgate.edu:


--
keywords: +patch
Added file: http://bugs.python.org/file13665/dict_setdefault.patch

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



[issue5730] setdefault speedup

2009-04-09 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee:  - rhettinger
nosy: +rhettinger
versions:  -Python 2.6, Python 3.0

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



[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2009-04-09 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
assignee:  - pitrou
nosy: +pitrou

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



[issue5731] bdist_wininst no longer works on non-Windows platforms

2009-04-09 Thread Paul Moore

New submission from Paul Moore p.f.mo...@gmail.com:

In revision 62197, Mon Apr 7 01:53:39 2008 UTC, Mark Hammond added code
to Lib/distutils/command/bdist_wininst.py which was intended to select
an architecture-specific installer executable.

In doing so, the code appears to have broken the ability to build
installers on non-Windows platforms.

The current code is

if self.plat_name == 'win32':
sfix = ''
else:
sfix = self.plat_name[3:] # strip 'win' - leaves eg '-amd64'
filename = os.path.join(directory, wininst-%.1f%s.exe % (bv, sfix))
return open(filename, rb).read()

This says strip 'win', but in practice strips the first 3 characters
from any plat_name other than win32.

I've attached an untested patch to fix this, by setting sfix to '' if
self.plat_name doesn't start with 'win'.

--
assignee: tarek
components: Distutils
files: bdist_wininst.patch
keywords: patch
messages: 85825
nosy: mhammond, pmoore, tarek
priority: normal
severity: normal
status: open
title: bdist_wininst no longer works on non-Windows platforms
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file13666/bdist_wininst.patch

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



[issue5730] setdefault speedup

2009-04-09 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Inlining code saves work but breaks the effort to minimize the number of
functions that have direct access to the underlying data structure.

The performance of setdefault() is hard to improve in real apps because
the cost of instantiating the default object is outside of the method. 
Also, the method often gets used in a loop where the first call adds an
entry and subsequent calls just do a get; so, any efforts to optimize
the second look-up only help on the first call and are completely wasted
on subsequent calls.

All that being said, there's no reason we can't save the double call to
PyObject_Hash().  See attached patch.

Martin, any thoughts?

--
assignee: rhettinger - loewis
nosy: +loewis
priority:  - low
Added file: http://bugs.python.org/file13667/setdefault.diff

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



[issue5108] Invalid UTF-8 (%s) length in PyUnicode_FromFormatV()

2009-04-09 Thread Walter Dörwald

Walter Dörwald wal...@livinglogic.de added the comment:

The problem with your patch is that it calls PyUnicode_DecodeUTF8()
twice. It would be better if step 1 in the code would include the %s
format specifiers and step 3 would then call PyUnicode_DecodeUTF8() and
put the result into the callresults buffer.

BTW, I can't make your examples segfault.

Attached is a new version of the patch that implements this. Could you
test this new version to see if there's still a Valgrind report?

--
nosy: +doerwalter
Added file: http://bugs.python.org/file13668/diff.txt

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



[issue5731] bdist_wininst no longer works on non-Windows platforms

2009-04-09 Thread Mark Hammond

Mark Hammond mhamm...@users.sourceforge.net added the comment:

+1 on the idea - it's not the first time I've forgotten that works on
platforms other than Windows.  It appears the patch you attached is
reversed though (or its just way too early for me...)

--

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



[issue5731] bdist_wininst no longer works on non-Windows platforms

2009-04-09 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

Mark, I have just applied the patch in r71413 because it was obvious.

If it's fine with you I'll backport it to 2.6 so it makes it to 2.6.2 final

--

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



[issue2170] rewrite of minidom.Node.normalize

2009-04-09 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Committed in r71414.

--
resolution:  - accepted
status: open - closed

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



[issue5730] setdefault speedup

2009-04-09 Thread Martin v. Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 Martin, any thoughts?

The same as always: Dan, do you have any benchmarks
that demonstrate the speedup?

Looking at the usage of setdefault in the standard library,
it seems that it's most of the time either an interned string,
or an object hashed by memory address that gets passed as a
key. Hashing these is very cheap, so I would be skeptical
that any real benefits can be demonstrated.

I also agree with Raymond that, by nature, setdefault only
calls hash() twice on the very first call, and not in subsequent
calls, so even if there was an improvement, it shouldn't matter
for the total runtime. I also agree that setdefault is somewhat
inappropriate for performance critical code, since it will create
the default value anyway (often a dict or a list), even if a
value is already stored. So users who care about performance
should write something like

try:
  l = d[k]
except KeyError:
  l = d[k] = []

to avoid the list creation in the common case, or use a
defaultdict in the first place.

--

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



[issue5731] bdist_wininst no longer works on non-Windows platforms

2009-04-09 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

fixed in r71413 and r71415.

Thanks for the patch !

--
status: open - closed
versions: +Python 2.7, Python 3.0, Python 3.1

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



[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-09 Thread Lenard Lindstrom

Lenard Lindstrom le...@telus.net added the comment:

The notepad example works with Pythons 2.4.4 and 2.5.4 on Windows 98. So
something changed in Windows XP. The 0xc0150004 error code crops up when
a side-by-side assembly fails to load. The DLL loader appears to use the
SystemRoot environment variable to find dependencies. I will check if
the XP notepad.exe is an SxS and post a follow-up.

--

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



[issue5725] process SysV-Semaphore support

2009-04-09 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

In issue5672 Martin said:

  If somebody would provide a patch that adds prctl to the posix module,
  that would be fine with me - we have a long tradition of exposing all
  available system calls if somebody wants them.

However, you are talking about a System V call, not a posix call, so
it's not clear to me if the same rules apply.

I suggest bringing this up on python-ideas.

(BTW, sys is for python system stuff, not OS system stuff (which goes in
the 'os' module).

--
components: +Library (Lib) -Interpreter Core
nosy: +r.david.murray
priority:  - low
versions:  -Python 2.6, Python 3.0

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



[issue5723] Incomplete json tests

2009-04-09 Thread Bob Ippolito

Bob Ippolito b...@redivi.com added the comment:

I don't think the decorator approach would work for the doctests, it looks 
like it could be an interesting approach though. I have a feeling that 
it's going to have to be done in some kind of ugly subclass though, I'll 
dig into unittest deeper this weekend to see how that might be done.

--

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



[issue4753] Faster opcode dispatch on gcc

2009-04-09 Thread Andrew I MacIntyre

Andrew I MacIntyre aimacint...@users.sourceforge.net added the comment:

Antoine, in my testing the loss of the HAS_ARG() optimisation in my
patch appears to have negligible cost on i386, but starts to look
significant on amd64.

On an Intel E8200 cpu running FreeBSD 7.1 amd64, with gcc 7.2.1 and the
3.1a2 sources, the computed goto version is ~8% faster (average time of
all rounds) for pybench (with warp factor set to 3 rather than the
default 10, to get the round time up over 10s) than without computed
gotos.  With my patch applied, the computed goto version is ~5.5% faster
than without computed gotos by the same measure.  On this platform,
Pystone rates at ~86k (no computed gotos), ~85k (computed gotos) and
~82k (computed gotos + my patch).

For comparison, this machine running Windows XP (32 bit) with the
python.org builds rates ~92k pystones for 2.6.1 and ~81k for 3.1a2. 
Pybench isn't distributed in the MSI installers :-(

--

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



[issue5730] setdefault speedup

2009-04-09 Thread Dan Schult

Dan Schult dsch...@colgate.edu added the comment:

Benchmarks:
Upon trying cooked up examples, I do not notice any speedup
beyond 5-10%.  Seems like function calling time swamps everything
for small examples with fast hashes.  I don't have a handy dandy
example with long hash times or long lookup times.  That's what
it would take to show a large performance boost with this patch.

I also agree with Martin that there are many reasons not to use
setdefault...   But it is part of the API.
We might as well make it worth using.  (Which probably
means changing the default value to a factory function which gets
called when the key is not found.  But that's a much bigger change...)
I'm just suggesting that the code should not do extra work.

By the way, defaultdict is NOT like setdefault--it is like get().
Missing entries do no get set.  Perhaps there should be a
collections entry that does setdefault instead of get..

Next, the second hash gets executed only the first time for EACH key.
So, e.g. if you have a lot of entries that get called up 2 or 3 times,
using the second hash does make a difference1/2 to 1/3 of the time.
And we don't need a second hash or lookup so why do it.

I understand Raymond's concern about more code using the
data structure directly.  There are three basic routines to deal with
the data structure:  ma_lookup/lookdict,  insertdict and resizedict.
The comments for lookdict encourage you to use the ep entry
to check if it is empty and add the key/value pair if desired.
But as currently implemented, insertdict calls lookdict, so
they aren't atomistic in that sense.  If atomism is a design goal
(even if it isn't a word :) then insertdict would take ep as an input
instead of doing a lookup.  I'm not sure if atomism is part of the  
design
in Python though...

 From my perspective creating an internal SetItem adds another function
handling the data structure just as setdefault would--that's why I  
inlined
in setdefault.  But, it does keep the name similar and thus its  
easier to
identify it as writing to the data structure.  If this style is  
promoted here
then I think there ought to be an internal insertdict that doesn't do  
the
lookup.   Also shouldn't the parent functions call these internal  
versions
instead of duplicating code?   Ack---that means more changes.  Not
difficult ones though...

What do you think?
Dan

--

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