Message157753
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(); |
|
Date |
User |
Action |
Args |
2012-04-07 19:35:10 | Jimbofbx | set | recipients:
+ Jimbofbx, pitrou, jnoller, gsson, dsvensson, asksol, jodal, dragonfyre13, sbt |
2012-04-07 19:35:10 | Jimbofbx | set | messageid: <1333827310.14.0.8522545144.issue4892@psf.upfronthosting.co.za> |
2012-04-07 19:35:09 | Jimbofbx | link | issue4892 messages |
2012-04-07 19:35:09 | Jimbofbx | create | |
|