[issue45735] Promise the long-time truth that `args=list` works

2022-02-25 Thread Tim Peters


Tim Peters  added the comment:


New changeset e466faa9df9a1bd377d9725de5484471bc4af8d0 by Charlie Zhao in 
branch 'main':
bpo-45735: Promise the long-time truth that `args=list` works (GH-30982)
https://github.com/python/cpython/commit/e466faa9df9a1bd377d9725de5484471bc4af8d0


--

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2022-01-27 Thread Charlie Zhao


Change by Charlie Zhao :


--
pull_requests: +29161
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30982

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2022-01-26 Thread Tim Peters


Tim Peters  added the comment:

Charliz, please do! I have no idea why Raymond just stopped. He even deleted 
his initial message here, saying "I relied on this for many years.  So, yet it 
would be nice to guarantee it :-)".

Best I can tell, nothing has changed: lots of people have relied on this 
behavior for years, and the docs should say it's fine.

--

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2022-01-26 Thread Yu Zhao


Yu Zhao  added the comment:

I'd like to work on this issue recently if it's still needed.

According to suggestions in PR:https://github.com/python/cpython/pull/29437, I 
will:

* Add doc example for Thread function;
* Add some test cases for checking the validity of list args;
* Repeat the above works on multiprocessing module.

--
nosy: +CharlieZhao

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-10 Thread Tim Peters


Tim Peters  added the comment:

Changed stage back to "needs patch", since Raymond appears to have closed his 
PR. Raymond, what's up with that?

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-06 Thread Tim Peters


Tim Peters  added the comment:

Serhiy, we haven't documented such stuff, and, indeed, I've been burned by it 
but much more often in the case of multiprocessing.Process. But note that I'm 
SWAPPING the order of your last two lines. In the original, you mutated the 
argument _before_ starting any parallel work, so "of course" the new worker 
will see the mutation:

def access(xs):
print(xs)

args = ([1],)
t = multiprocessing.Process(target=access, args=args)
t.start() # start parallel work before mutating
args[0][0] = 2



Does that print [1] or [2]? Passing a tuple in no way prevents mutations to 
mutable objects the tuple contains.

When the docs are silent, "implementation defined" rules. Whether you use 
threading or multiprocessing in the altered example above, the result printed 
simply isn't defined - it's a race between the main thread doing the mutation 
and the "parallel part" accessing the mutated object.

This is subtler in the multiprocessing context, though, because the relevant 
"parallel part" is really the hidden thread that pickles the argument list to 
send to the worker. That effectively makes a deep copy. But it's still a race, 
just not one visible from staring at the Python code. In the threading case, no 
copies are made.

--

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is a difference if you modify the arguments list after creating a thread.

args = [1]
t = threading.Thread(target=access, args=args)
args[0] = 2
t.start()

Would it call access(1) or access(2)?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg405847

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +27691
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29437

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I relied on this for many years.  So, yet it would be nice to guarantee it :-)

--
nosy: +rhettinger

___
Python tracker 

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



[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Tim Peters


Change by Tim Peters :


--
title: Promise that the long-time truth that `args=list` works -> Promise the 
long-time truth that `args=list` works

___
Python tracker 

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