[issue6972] zipfile.ZipFile overwrites files outside destination path

2012-04-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> +# make sure the zip file isn't traversing out of the path
> +if not targetpath.startswith(basepath):

Check is insufficient. basepath='/etc/asd', member.filename='../asdfgh'.

The issue10905 has relations with this issue.

P. S. Viewing patches in this issue is not working.

--

___
Python tracker 

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



[issue14527] How to link with an external libffi?

2012-04-07 Thread Ross Lagerwall

Ross Lagerwall  added the comment:

If it is in a non-standard location, try setting the environment variables:

LDFLAGS linker flags, e.g. -L if you have libraries in a 
nonstandard directory 
CPPFLAGS(Objective) C/C++ preprocessor flags, e.g. -I if you 
have headers in a nonstandard directory 

--
nosy: +rosslagerwall

___
Python tracker 

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



[issue14527] How to link with an external libffi?

2012-04-07 Thread Paul A.

New submission from Paul A. :

I trying to build python using an external libffi package I have installed -- 
is there some trick in directing --with-system-ffi to the path where it's 
located.  I don't see clues in config.log or anywhere to help.

--
messages: 157776
nosy: pda
priority: normal
severity: normal
status: open
title: How to link with an external libffi?
type: enhancement
versions: Python 2.7

___
Python tracker 

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



[issue14526] Python-2.6.8rc2 test never finishes ia64-hp-hpux11.31

2012-04-07 Thread R. David Murray

R. David Murray  added the comment:

Oh, wait, I see you are testing the security RC.  Is this a new problem, or 
does it also occur with the previous released version of 2.6?

--

___
Python tracker 

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



[issue14526] Python-2.6.8rc2 test never finishes ia64-hp-hpux11.31

2012-04-07 Thread R. David Murray

R. David Murray  added the comment:

Oh, and python2.6 is in security-fix only mode, so any fixes would only go into 
go into 2.7 and later.  Have you gotten as far as trying to reproduce this on 
2.7?

--

___
Python tracker 

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



[issue14526] Python-2.6.8rc2 test never finishes ia64-hp-hpux11.31

2012-04-07 Thread R. David Murray

R. David Murray  added the comment:

To quote Martin from an older issue: "Python on HP-UX has never really worked 
well, but it has worked in some fashion for a long time".  IA64 probably 
introduces a whole slew of new issues.  If you can work through them and 
suggest patches that would be great.  If you are motivated to do this, you 
might want to sign up for the python core-mentorship list, where you can ask 
questions about how things work and get advice on fixing problems.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue14525] ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without -D_TERMIOS_INCLUDED

2012-04-07 Thread R. David Murray

R. David Murray  added the comment:

Can you suggest a patch?  As I said on the other issue I don't believe any core 
developers have access to hpux.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue14526] Python-2.6.8rc2 test never finishes ia64-hp-hpux11.31

2012-04-07 Thread Paul A.

New submission from Paul A. :

Perhaps I'm not interpreting something happening earlier, but `make test' here  
only seems to run a short time but doesn't actually finish.  It appears not to 
be using any cpu, or waiting for input, so I'm not sure what's happening.
...
test_grammar
test_opcodes
test_dict
test_builtin
test_exceptions
test_types
test_unittest
test_doctest
test_doctest2
test_py3kwarn
test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag
test_MimeWriter
test_SimpleHTTPServer
test_StringIO
test___all__
test test___all__ failed -- Traceback (most recent call last):
  File "/usr/local/src/Python-2.6.8rc2/Lib/test/test___all__.py", line 103, in 
test_all
self.check_all(modname)
  File "/usr/local/src/Python-2.6.8rc2/Lib/test/test___all__.py", line 39, in 
check_all
modname, e.__class__.__name__, e))

AssertionError: __all__ failure in distutils.command: ImportError: No module 
named _sha256

test___future__
test__locale
test_abc
test_abstract_numbers
test_aepack
test_aepack skipped -- No module named aepack
test_aifc
test_al
test_al skipped -- No module named al
test_anydbm
test_applesingle
test_applesingle skipped -- No module named macostools
test_array
test_ast
test_asynchat
test test_asynchat failed -- multiple errors occurred; run in verbose mode for 
details
test_asyncore
test test_asyncore failed -- multiple errors occurred; run in verbose mode for 
details
test_atexit
test_audioop
test_augassign
test_base64
test_bastion
test_bigaddrspace
test_bigmem
test_binascii
test_binhex
test_binop
test_bisect
test_bool
test_bsddb
test_bsddb skipped -- No module named _bsddb
test_bsddb185
test_bsddb185 skipped -- No module named bsddb185
test_bsddb3
test_bsddb3 skipped -- No module named _bsddb
test_buffer
test_bufio
test_bytes
test_bz2
test_bz2 skipped -- No module named bz2
test_calendar
test_call
test_capi

--
components: Tests
messages: 157771
nosy: pda
priority: normal
severity: normal
status: open
title: Python-2.6.8rc2 test never finishes ia64-hp-hpux11.31
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue14524] Python-2.7.3rc2/Modules/_ctypes/libffi/src/dlmalloc.c won't compile on ia64-hp-hpux11.31 without -DHAVE_USR_INCLUDE_MALLOC_H

2012-04-07 Thread R. David Murray

R. David Murray  added the comment:

Is this a bug report about configure, or a bug report about a crash during 
compilation after you've adjusted the configure parameters?  It seems like you 
are reporting two different things here.

For the configure issue, would you care to suggest a patch?  I don't believe we 
have any core developers with access to hpux.

--
nosy: +r.david.murray
type: crash -> compile error

___
Python tracker 

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



[issue14525] ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without -D_TERMIOS_INCLUDED

2012-04-07 Thread Paul A.

New submission from Paul A. :

I can't help thinking that configure should be able to figure out the need for 
this -- Modules/termios.c won't compile without adding -D_TERMIOS_INCLUDED by 
hand. This is far from new, all 2.5+ versions I've tried to compile are like 
that on this platform.

--
components: Build
messages: 157769
nosy: pda
priority: normal
severity: normal
status: open
title: ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without 
-D_TERMIOS_INCLUDED
type: enhancement
versions: Python 2.6

___
Python tracker 

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



[issue14524] Python-2.7.3rc2/Modules/_ctypes/libffi/src/dlmalloc.c won't compile on ia64-hp-hpux11.31 without -DHAVE_USR_INCLUDE_MALLOC_H

2012-04-07 Thread Paul A.

Changes by Paul A. :


--
type:  -> crash

___
Python tracker 

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



[issue14524] Python-2.7.3rc2/Modules/_ctypes/libffi/src/dlmalloc.c won't compile on ia64-hp-hpux11.31 without -DHAVE_USR_INCLUDE_MALLOC_H

2012-04-07 Thread Paul A.

New submission from Paul A. :

Shouldn't configure be able to arrive at that without me adding manually?

Anyway, after the build finishes thing soon come crashing down; my stack trace 
is at the end...

running build_scripts
creating build/scripts-2.7
copying and adjusting /usr/local/src/Python-2.7.3rc2/Tools/scripts/pydoc -> 
build/scripts-2.7
copying and adjusting /usr/local/src/Python-2.7.3rc2/Tools/scripts/idle -> 
build/scripts-2.7
copying and adjusting /usr/local/src/Python-2.7.3rc2/Tools/scripts/2to3 -> 
build/scripts-2.7
copying and adjusting /usr/local/src/Python-2.7.3rc2/Lib/smtpd.py -> 
build/scripts-2.7
changing mode of build/scripts-2.7/pydoc from 644 to 755
changing mode of build/scripts-2.7/idle from 644 to 755
changing mode of build/scripts-2.7/2to3 from 644 to 755
changing mode of build/scripts-2.7/smtpd.py from 644 to 755
sh[3]: 1340 Abort(coredump)

(gdb) bt
#0  0xc04395d0:0 in kill+0x30 () from /usr/lib/hpux64/libc.so.1
#1  0xc02e8180:0 in raise+0x120 () from /usr/lib/hpux64/libc.so.1
#2  0xc03f8c50:0 in abort+0x170 () from /usr/lib/hpux64/libc.so.1
#3  0xc00010f0c7f0:0 in free (mem=0x600053d0)
at /usr/local/src/Python-2.7.3rc2/Modules/_ctypes/libffi/src/dlmalloc.c:4288
#4  0xc0bfcde0:0 in _UNW_free_mpool()+0xc0 ()
   from /usr/lib/hpux64/libunwind.so.1
#5  0xc004cb50:0 in EM_mark_BOS+0x50 () from /usr/lib/hpux64/dld.so

--
components: Build
messages: 157768
nosy: pda
priority: normal
severity: normal
status: open
title: Python-2.7.3rc2/Modules/_ctypes/libffi/src/dlmalloc.c won't compile on 
ia64-hp-hpux11.31 without -DHAVE_USR_INCLUDE_MALLOC_H
versions: Python 2.7

___
Python tracker 

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



[issue14222] Use time.steady() to implement timeout

2012-04-07 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'm closing this one.  The "not subject to adjustment" property is more 
desirable than not.  The "undefined reference point" property isn't harmful in 
this context (the start time isn't exposed).  

I'll follow the python-dev thread and re-open this if it becomes clear that 
there are any issues for steady() being used for timeout logic.

--
status: open -> closed

___
Python tracker 

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



[issue14222] Use time.steady() to implement timeout

2012-04-07 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

[Victor]
> The duration of a timeout of N seconds should be N seconds even 
> if the system clock is updated (e.g. a daylight saving time 
> (DST) change).

IIRC, time.time() is not a local time and it is unaffected by a DST change.

--

___
Python tracker 

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



[issue14521] math.copysign(1., float('nan')) returns -1.

2012-04-07 Thread mattip

mattip  added the comment:

Sorry for the garbage c code, the comment however is correct: Py_NAN is created 
with the sign bit set (on windows), and then _copysign on windows uses the sign 
bit to determine the output, which results in the wrong answer.

--

___
Python tracker 

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



[issue14523] IDLE's subprocess startup error

2012-04-07 Thread Arcangeltj

New submission from Arcangeltj :

"IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess 
or personal firewall software is blocking the connection." 

What or why is this happening? Is there something that can fix this issue?

--
components: IDLE
messages: 157764
nosy: arcangeltj
priority: normal
severity: normal
status: open
title: IDLE's subprocess startup error
type: crash
versions: Python 2.6

___
Python tracker 

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



[issue6972] zipfile.ZipFile overwrites files outside destination path

2012-04-07 Thread Thomas W. Barr

Thomas W. Barr  added the comment:

I'll update my patch to work on the current 3.x head later tonight.

--

___
Python tracker 

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



[issue14087] multiprocessing.Condition.wait_for missing

2012-04-07 Thread sbt

sbt  added the comment:

New patch skips tests if ctypes not available.

--
Added file: http://bugs.python.org/file25155/cond_wait_for.patch

___
Python tracker 

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



[issue14521] math.copysign(1., float('nan')) returns -1.

2012-04-07 Thread mattip

mattip  added the comment:

It appears that microsoft decided NAN will be represented by 
'\x00\x00\x00\x00\x00\x00\xf8\xff', which has the sign bit set. 
Compiling this c code with visual 9.0 gives the correct answers for the first 
value, and a mess for the second:

#include 
#include 
#include 

int main( void ) {
   unsigned long nan[2]={0x, 0x7fff};
   double g;
   double z, zn;
   int i;
   for (i=0;i<2; i++)
   {
   g = *( double* )(nan+i);
   printf( "g( %g ) is NaN, _isnan(g) %d\n", g, _isnan(g) );
   z = _copysign(-3, g);
   zn = _copysign(-3, -g);
   printf("z=%g, zn=%g\n", z, zn);
   }
   return 0;
}

This corresponds with loewis 's observation.

--

___
Python tracker 

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



[issue6972] zipfile.ZipFile overwrites files outside destination path

2012-04-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
priority: normal -> high
stage:  -> needs patch
versions: +Python 3.3 -Python 2.6

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed, thank you!

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f8a92fd084c2 by Antoine Pitrou in branch 'default':
Issue #14522: Avoid duplicating socket handles in multiprocessing.connection.
http://hg.python.org/cpython/rev/f8a92fd084c2

--
nosy: +python-dev

___
Python tracker 

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



[issue14310] Socket duplication for windows

2012-04-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9b858096044e by Kristján Valur Jónsson in branch 'default':
Issue #14310: Catch testing errors when trying to create unsupported socket
http://hg.python.org/cpython/rev/9b858096044e

--

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread sbt

sbt  added the comment:

> Is there a reason the patch changes close() to win32.CloseHandle()?

This is a Windows only code path so close() is just an alias for 
win32.CloseHandle().  It allow removal of the lines 

# Late import because of circular import
from multiprocessing.forking import duplicate, close

--

___
Python tracker 

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



[issue14310] Socket duplication for windows

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Re-opening. There is now a buildbot failure:

==
ERROR: testTypes (test.test_socket.TestSocketSharing)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_socket.py",
 line 4738, in testTypes
source = socket.socket(f, t)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\socket.py", 
line 94, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Error 10047] An address incompatible with the requested protocol was 
used

http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/

--
assignee:  -> krisvale
stage:  -> committed/rejected
status: closed -> open

___
Python tracker 

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



[issue12986] Using getrandbits() in uuid.uuid4() is faster and more readable

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> However, I'm not sure of the legitimacy of replacement suitable for
> cryptographic use `os.urandom` on fast pseudo-random
> `random.getrandbits`. Especially for applications that need to generate 
> a lot of uuids.

Agreed. urandom() is supposed to incorporate "real" random, while getrandbits() 
uses a PRNG.
Also, as the OP shows, it's easy to inject your own random source:

  >>> grb = "uuid.UUID(int=random.getrandbits(128), version=4)"

if you really need the speed.

--
nosy: +pitrou
stage:  -> patch review
versions: +Python 3.3 -Python 3.2

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Is there a reason the patch changes close() to win32.CloseHandle()?

--
components: +Library (Lib)
nosy: +pitrou
stage:  -> patch review
type:  -> behavior
versions: +Python 3.2, Python 3.3

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread James Hutchison

James Hutchison  added the comment:

Shouldn't reduce_pipe_connection just be an alias for reduce_connection in unix 
so that using reduce_pipe_connection would work for both win and unix? My 
understanding after looking at the code is that reduce_pipe_connection isn't 
defined for non-win32, although I haven't tested it to see if that's true.

Of course, ideally a pipe connection would just pickle and unpickle properly 
out-of-the-box, which I think was the original intent.

Here's a complete, working example with Python 3.2 tested on Win 7 64-bit:

import sys
from multiprocessing import Process,Pipe, reduction

def main():
print("starting");
i, o = Pipe(False)
parent, child = Pipe();
reducedchild = reduce_pipe(child);
p = Process(target=helper, args=(i,));
p.start();
parent.send("hi");
o.send(reducedchild);
print(parent.recv());
print("finishing");
p.join();
print("done");

def helper(inPipe):
childPipe = expand_reduced_pipe(inPipe.recv());
childPipe.send("child got: " + childPipe.recv());
return;

def reduce_pipe(pipe):
if sys.platform == "win32":
return reduction.reduce_pipe_connection(pipe);
else:
return reduction.reduce_connection(pipe);

def expand_reduced_pipe(reduced_pipe):
return reduced_pipe[0](*reduced_pipe[1]);

if __name__ == "__main__":
main();

--

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread sbt

sbt  added the comment:

Actually Issue 9753 was causing failures in test_socket.BasicTCPTest and 
test_socket.BasicTCPTest2 on at least one Windows XP machine.

--

___
Python tracker 

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



[issue11980] zipfile.ZipFile.write should accept fp as argument

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue10972] zipfile: add "unicode" option to the force the filename encoding to UTF-8

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue10614] ZipFile: add a filename_encoding argument

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread sbt

sbt  added the comment:

> What is the bug that this fixes? Can you provide a test case?

The bug is using an API in a way that the documentation says is 
wrong/unreliable.  There does not seem to be a classification for that.

I have never seen a problem caused by using DuplicateHandle() so I cannot 
provide a test case.  Note that socket.dup() used to be implemented using 
DuplicateHandle(), but that was changed to WSADuplicateSocket().  See Issue 
9753.

--
Added file: http://bugs.python.org/file25154/mp_socket_dup.patch

___
Python tracker 

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



[issue10905] zipfile: fix arcname with leading '///' or '..'

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue4844] ZipFile doesn't range check in _EndRecData()

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread sbt

Changes by sbt :


Removed file: http://bugs.python.org/file25153/mp_socket_dup.patch

___
Python tracker 

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



[issue6839] zipfile can't extract file

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

What is the bug that this fixes? Can you provide a test case?

--
nosy: +loewis

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread sbt

sbt  added the comment:

> There is a simpler way to do this on Windows.  The sending process 
> duplicates the handle, and the receiving process duplicates that second 
> handle using DuplicateHandle() and the DUPLICATE_CLOSE_SOURCE flag.  That 
> way no server thread is necessary on Windows.

Note that this should not be done for socket handles since DuplicateHandle() is 
not supposed to work for them.  socket.share() and socket.fromshare() with a 
server thread can be used for sockets.

--

___
Python tracker 

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



[issue14521] math.copysign(1., float('nan')) returns -1.

2012-04-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This is a near duplicate of issue7281. Most likely, copysign is behaving 
correctly, and it's already the float conversion that errs.

For struct.pack('d', float('nan')), I get '\x00\x00\x00\x00\x00\x00\xf8\xff'; 
for -nan, I get '\x00\x00\x00\x00\x00\x00\xf8\x7f'; 
ISTM that this has the sign bits switched.

--
nosy: +loewis

___
Python tracker 

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



[issue14522] Avoid using DuplicateHandle() on sockets in multiprocessing.connection

2012-04-07 Thread sbt

New submission from sbt :

In multiprocessing.connection on Windows, socket handles are indirectly 
duplicated using DuplicateHandle() instead the WSADuplicateSocket().  According 
to Microsoft's documentation this is not supported.

This is easily avoided by using socket.detach() instead of duplicating the 
handle.

--
files: mp_socket_dup.patch
keywords: patch
messages: 157747
nosy: sbt
priority: normal
severity: normal
status: open
title: Avoid using DuplicateHandle() on sockets in multiprocessing.connection
Added file: http://bugs.python.org/file25153/mp_socket_dup.patch

___
Python tracker 

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



[issue2824] zipfile to handle duplicate files in archive

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue6972] zipfile.ZipFile overwrites files outside destination path

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue14521] math.copysign(1., float('nan')) returns -1.

2012-04-07 Thread mattip

New submission from mattip :

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.copysign(1., float('inf'))
1.0
>>> math.copysign(1., float('-inf'))
-1.0
>>> math.copysign(1., float('nan'))
-1.0
>>> math.copysign(1., float('-nan'))
1.0
>>>

--
components: None
messages: 157746
nosy: mattip
priority: normal
severity: normal
status: open
title: math.copysign(1., float('nan')) returns -1.
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread sbt

sbt  added the comment:

> But ForkingPickler could be used in multiprocessing.connection,
> couldn't it?

I suppose so.

Note that the way a connection handle is transferred between existing processes 
is unnecessarily inefficient on Windows.  A background server thread (one per 
process) has to be started and the receiving process must connect back to the 
sending process to receive its duplicate handle.

There is a simpler way to do this on Windows.  The sending process duplicates 
the handle, and the receiving process duplicates that second handle using 
DuplicateHandle() and the DUPLICATE_CLOSE_SOURCE flag.  That way no server 
thread is necessary on Windows.

I got this to work recently for pickling references to file handles for mmaps 
on.  (A server thread would still be necessary on Unix.)

--

___
Python tracker 

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



[issue10376] ZipFile unzip is unbuffered

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue12986] Using getrandbits() in uuid.uuid4() is faster and more readable

2012-04-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> uuids = set()
> for u in [uuid.uuid4() for i in range(1000)]:
> uuids.add(u)

uuids = {uuid.uuid4() for i in range(1000)}

However, I'm not sure of the legitimacy of replacement suitable for 
cryptographic use `os.urandom` on fast pseudo-random `random.getrandbits`. 
Especially for applications that need to generate a lot of uuids.

--
nosy: +storchaka

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread James Hutchison

James Hutchison  added the comment:

@pitrou

You can just delete my original post. I'll repost an edited version here for 
reference

original post with paths removed:
This is an issue for me (Python 3.2). I have a custom pool that sends arguments 
for a function call over a pipe. I cannot send another pipe as an argument. 

Tim's workaround also does not work for me (win xp 32bit and 64bit)

>From what I can tell, you can only send a connection as a direct argument to a 
>function call. This limits what I can do because I cannot introduce new pipes 
>to a worker process after it is instantiated.

Using this code:

def main():
from multiprocessing import Pipe, reduction
i, o = Pipe()
print(i);
reduced = reduction.reduce_connection(i)
print(reduced);
newi = reduced[0](*reduced[1])
print(newi);
newi.send("hi")
o.recv()

if __name__ == "__main__":
main();

This is my output:


(, 
(('.\\pipe\\pyc-3156-1-q5wwnr', 1756, False), True, True))

>>> newi.send("hi")
IOError: [Errno 10038] An operation was attempted on something that is not a 
socket

As you can see, the handle changes

--

___
Python tracker 

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



[issue2377] Replace __import__ w/ importlib.__import__

2012-04-07 Thread Brett Cannon

Brett Cannon  added the comment:

On Fri, Apr 6, 2012 at 16:05, Antoine Pitrou  wrote:

>
> Antoine Pitrou  added the comment:
>
> > OK, -v/PYTHONVERBOSE is as done as it is going to be by me. Next up is
> > (attempting) Windows registry stuff. After that I will push to default
> > with test_trace and test_pydoc skipped so others can help me with
> > those.
>
> Skipped? How so?

By raising unittest.SkipTest.

I already know how to fix pydoc, but I need to get module names attached to
ImportError and I don't want to bother with that until importlib is in
(else it will be weird having it added into default but not in
Python/import.c). As for trace, I have not looked at it, but I know what
the failure is caused by and it's a question of how best to deal with it.

--

___
Python tracker 

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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le samedi 07 avril 2012 à 17:22 +, Raymond Hettinger a écrit :
> --
> keywords: +patch
> Added file: http://bugs.python.org/file25152/decimal_hash.diff

I think patching the C version of Decimal would be more useful :)

--

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> ForkingPickler is only used when creating a child process.  The
> multiprocessing.reduction module is only really intended for sending
> stuff to *pre-existing* processes.

But ForkingPickler could be used in multiprocessing.connection, couldn't
it?

--

___
Python tracker 

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



[issue12805] Optimizations for bytes.join() et. al

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue13126] find() slower than rfind()

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread sbt

sbt  added the comment:

ForkingPickler is only used when creating a child process.  The 
multiprocessing.reduction module is only really intended for sending stuff to 
*pre-existing* processes.

As things stand, after importing multiprocessing.reduction you can do something 
like

  buf = io.BytesIO()
  pickler = ForkingPickler(buf)
  pickler.dump(conn)
  data = buf.getvalue()
  writer.send_bytes(data)

But that is rather less simple and obvious than just doing

  writer.send(conn)

which was possible in pyprocessing.

Originally just importing the module magically registered the reduce functions 
with copyreg.  Since this was undesirable, the reduction functions were instead 
registered with ForkingPickler.  But this fix rather missed the point of the 
module.

--

___
Python tracker 

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



[issue14511] _static/opensearch.xml for Python 3.2 docs directs searches to 3.3 docs

2012-04-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 7f123dec2731 by Georg Brandl in branch '3.2':
Closes #14511: fix wrong opensearch link for 3.2 docs.
http://hg.python.org/cpython/rev/7f123dec2731

New changeset 57a8a8f5e0bc by Georg Brandl in branch 'default':
Closes #14511: merge with 3.2
http://hg.python.org/cpython/rev/57a8a8f5e0bc

--
nosy: +python-dev
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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
keywords: +patch
Added file: http://bugs.python.org/file25152/decimal_hash.diff

___
Python tracker 

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



[issue10408] Denser dicts and linear probing

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Having said all that I agree multiprocessing.reduction should be
> fixed.  Maybe an enable_pickling_support() function could be added to
> register the necessary things with copyreg.

Why not simply use ForkingPickler?

--

___
Python tracker 

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



[issue13031] small speed-up for tarfile.py when unzipping tarballs

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue13621] Unicode performance regression in python3.3 vs python3.2

2012-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread sbt

sbt  added the comment:

Jimbofbx wrote:
> def main():
> from multiprocessing import Pipe, reduction
> i, o = Pipe()
> print(i);
> reduced = reduction.reduce_connection(i)
> print(reduced);
> newi = reduced[0](*reduced[1])
> print(newi);
> newi.send("hi")
> o.recv()

On Windows with a PipeConnection object you should use 
rebuild_pipe_connection() instead of rebuild_connection().  With that change, 
on Python 3.3 I get


(, 
(('.\\pipe\\pyc-6000-1-30lq4p', 356, False), True, True))


Having said all that I agree multiprocessing.reduction should be fixed.  Maybe 
an enable_pickling_support() function could be added to register the necessary 
things with copyreg.

--

___
Python tracker 

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



[issue3561] Windows installer should add Python and Scripts directories to the PATH environment variable

2012-04-07 Thread Brian Curtin

Brian Curtin  added the comment:

Attached is issue3561.diff which adds a path option, off by default, as a 
feature to be installed. I've tested installation and un-installation with the 
feature both installed and not installed and it seems to work fine for me.

http://briancurtin.com/python-dev/python-3.3.15437.msi is an installer built 
with this patch. http://briancurtin.com/python-dev/CustomizePage.png is simply 
a screenshot of the page where you choose to enable this feature.

--
keywords: +needs review
stage:  -> patch review
Added file: http://bugs.python.org/file25151/issue3561.diff

___
Python tracker 

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



[issue10576] Add a progress callback to gcmodule

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Uploaded another review.
I also notice you didn't really address my point, since self.visit is still 
initialized too early. IMO it should be initialized after the first 
gc.collect() at the beginning of each test (not in setUp()).

--

___
Python tracker 

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



[issue10576] Add a progress callback to gcmodule

2012-04-07 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Here is an updated patch, taking Jim's and Antoine's comments into account.

Jim, I´d like to comment that I think the reason __del__ objects are 
uncollectable is more subtle than there being no defined order of calling the 
__del__ functions.  More significantly, no python code may be executed during 
an implicit garbage collection.
Now, it is possible that one could clean up cycles containing only one __del__ 
method during _expcicit_ collections (calling gc.collect()) but it hardly seems 
worth the effort.

--
Added file: http://bugs.python.org/file25150/gccallback.patch

___
Python tracker 

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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > > I recommend that __hash__ should use functools.lru_cache for caching.
> > Why would you do such a thing? A hash value is a single 64-bit slot, no 
> > need to add the memory consumption of a whole dictionary and the runtime 
> > cost of a LRU eviction policy when you can simply cache the hash in the 
> > object itself (like we already do for strings)...
> 
> It was a joke (I think). Taking into account the fact that LRU cache
> uses a hashtable and need to calculate the hash of arguments (i.e., the
> Decimal self) to get the cached value of hash.

Damn. Shame on me for not understanding Raymond's humour :-)

--

___
Python tracker 

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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> > I recommend that __hash__ should use functools.lru_cache for caching.
> Why would you do such a thing? A hash value is a single 64-bit slot, no need 
> to add the memory consumption of a whole dictionary and the runtime cost of a 
> LRU eviction policy when you can simply cache the hash in the object itself 
> (like we already do for strings)...

It was a joke (I think). Taking into account the fact that LRU cache
uses a hashtable and need to calculate the hash of arguments (i.e., the
Decimal self) to get the cached value of hash.

--

___
Python tracker 

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



[issue14520] Buggy Decimal.__sizeof__

2012-04-07 Thread Stefan Krah

Stefan Krah  added the comment:

In full:

>>> d = 
>>> Decimal(1)
>>> 
>>> sys.getsizeof(d)
>>>   
96  
  
>>> sys.getsizeof(d._int)   
>>>   
212

--

___
Python tracker 

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



[issue14520] Buggy Decimal.__sizeof__

2012-04-07 Thread Stefan Krah

Stefan Krah  added the comment:

It isn't implemented at all. The Python version also always returns 96,
irrespective of the coefficient length. Well, arguably the coefficient
is a separate object in the Python version:

96
>>> sys.getsizeof(d._int)
212

For the C version I'll do the same as in longobject.c.

--

___
Python tracker 

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



[issue14310] Socket duplication for windows

2012-04-07 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue14310] Socket duplication for windows

2012-04-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 51b4bddd0e92 by Kristján Valur Jónsson in branch 'default':
Issue #14310: inter-process socket duplication for windows
http://hg.python.org/cpython/rev/51b4bddd0e92

--
nosy: +python-dev

___
Python tracker 

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-04-07 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Hi David,

I am sorry, I did not notice your second comment in this bug and later when you 
closed this, noticed the bug report. 

Yes, the default=None but actually pointing to a sentinel value is an odd duck 
and I believe the explanation in  docs were updated a couple of times to inform 
user of that behavior, but still the signature gives a feeling that it could be 
improved. I am at loss as well in terms of giving an "easy solution" to fix the 
docs.

Thanks,
Senthil

--

___
Python tracker 

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



[issue14520] Buggy Decimal.__sizeof__

2012-04-07 Thread Antoine Pitrou

New submission from Antoine Pitrou :

I'm not sure __sizeof__ is implemented correctly:

>>> from decimal import Decimal
>>> import sys
>>> d = Decimal(123456789123456798123456789123456798123456789123456798)
>>> d
Decimal('123456789123456798123456789123456798123456789123456798')
>>> sys.getsizeof(d)
24

... looks too small.

--
assignee: skrah
messages: 157726
nosy: pitrou, skrah
priority: normal
severity: normal
status: open
title: Buggy Decimal.__sizeof__
type: behavior
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



[issue7978] SocketServer doesn't handle syscall interruption

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Jerzy's latest patch looks ok to me.
This is a slight behaviour change so I'm not sure it should go in 3.2/2.7.

--
stage:  -> patch review
versions: +Python 3.3 -Python 2.7, Python 3.1

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee: jnoller -> 
nosy: +sbt
versions: +Python 3.3 -Python 3.2

___
Python tracker 

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> err, is it possible to edit out those file paths?

I don't know how to do that. If you want I can remove the message altogether. 
But I don't see anything confidential or exploitable in your message.

--
nosy: +pitrou

___
Python tracker 

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



[issue9141] Allow objects to decide if they can be collected by GC

2012-04-07 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Btw. tangentially related to this discussion, issue 10576 aims to make the 
situation with uncollectable objects a little more bearable.  An application 
can listen for garbage collection, visit gc.garbage and deal with its 
problematic types in its own way.

--

___
Python tracker 

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



[issue9141] Allow objects to decide if they can be collected by GC

2012-04-07 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Jim: The edge case of collecting an object that is alone in a cycle is 
something that isn't handled.  I'm also not sure that it is worth doing or even 
safe or possible.  but that is beside the point and not the topic of this patch.

Martin: This patch is formalizing a known fact about cpython objects, albeit an 
uncommon one:  Some objects with finalizers can be safely collected if they are 
in a certain state.  The canonical example is the PyGeneratorObject.  
gccollect.c has special code for this type and there is a special evil API 
exposed to deal with the case.

_This patch is not changing any behaviour._  Generator objects that are in a 
special state of existance cannot be collected.  Rather, they are (and always 
have been) put in gc.garbage along with the rest of their cycle chain.  In 
other cases, the finalizer causes no side effects and simply clearing them is 
ok.  I couldn't tell you what those generator execution states are, but the 
fact is that they exist.

A similar problem exists in Stackless python with tasklets.  We solved it in 
this generic way there rather than add more exceptional code to gcmodule.c and 
this patch is the result of that work.  In Stackless, the inverse is true:  An 
object without an explicit finalizer can still be unsafe to collect, because 
the tp_dealloc can do evil things, but doesn't always, depending on object 
state.

So, objects who change their mind about whether they can be collected or not 
are a fact of life in python.  Yes, even cPython.  This patch aims to formalize 
that fact and give it an interface, rather than to have special code for 
generator objects in gcmodule.c and an inscrutable API exposed 
(PyGen_NeedsFinalizing())

About reusing the slot:  Slots are a precious commodity in python.  This 
particular slot is undocumented and used only for one known thing:  To 
distinguish PyTypeObjects from PyHeapTypeObjects.  In fact, creating a slot and 
not using special case code (like they did for PyGeneratorObjects) was forward 
thinking, and I'm trying to build on that.  Renaming the slot is a fine idea.

A brief search on google code (and google at large) showed no one using this 
slot.  It is one of those undocumented strange slots that one just initializes 
to 0.

--

___
Python tracker 

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



[issue14310] Socket duplication for windows

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Any other comments?

No, the patch looks ok now. Please watch the buildbots after you commit.

--

___
Python tracker 

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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage:  -> needs patch
versions: +Python 3.3 -Python 3.2

___
Python tracker 

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



[issue14478] Decimal hashing very slow, could be cached

2012-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I recommend that __hash__ should use functools.lru_cache for caching.

Why would you do such a thing? A hash value is a single 64-bit slot, no need to 
add the memory consumption of a whole dictionary and the runtime cost of a LRU 
eviction policy when you can simply cache the hash in the object itself (like 
we already do for strings)...

--
nosy: +pitrou

___
Python tracker 

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



[issue9141] Allow objects to decide if they can be collected by GC

2012-04-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I'm still unclear about the rationale for this change. krisvale says in the 
patch and in msg109099 that this is to determine whether an object can be 
collected "at this time". Is the intended usage that the result value may 
change over the lifetime of the object?

If so, I'm -1 on the patch. If an object cannot be collected "at this time", it 
means that it is added to gc.garbage, which in turn means that it will never be 
collected (unless somebody explicitly clears gc.garbage).

Supporting the case of objects that can be collected despite living in a cycle 
is fine to me, but those objects must not change their mind.

Supporting the case of objects that are not collectable now, but may be 
collectable later, may have its use case (which one?), but this is not 
addressed by the patch (AFAICT). To support it, processing of the entire cycle 
must be postponed (to the next collection? to the next generation?).

I'm -0 on recycling the is_gc slot. Having a GC header and having a non-trivial 
tp_del are two unrelated issues. If this is done, I think it would be best to 
rename the slot to tp_gc_flags or something. There is also the slight risk of 
some type in the wild returning non-1 currently, which then would get 
misinterpreted.

--

___
Python tracker 

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