classification
Title: ShareableList() raises TypeError when passing "name" keyword
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: steve.newcomb
Priority: normal Keywords:

Created on 2021-04-02 16:28 by steve.newcomb, last changed 2021-04-04 15:57 by steve.newcomb.

Files
File name Uploaded Description Edit
shareableListBug.txt steve.newcomb, 2021-04-02 16:28 2 little programs, one for each process, shell outputs, and commentary
5.py steve.newcomb, 2021-04-04 15:57 script for concurrent processes with shared memory and manual unlinking
Messages (4)
msg390080 - (view) Author: Steve Newcomb (steve.newcomb) * Date: 2021-04-02 16:28
This is especially weird because the Python source code says:

class ShareableList:
[...]
   def __init__(self, sequence=None, *, name=None):
msg390087 - (view) Author: Steve Newcomb (steve.newcomb) * Date: 2021-04-02 18:40
I just tried the same thing on Python-3.10.0a6.  Same behavior.
msg390092 - (view) Author: Steve Newcomb (steve.newcomb) * Date: 2021-04-02 19:19
And again with 3.8.8, with the same result.

I also tried just using the same shared memory manager again within the same process, just as shown in the documentation.  Same result:

TypeError: ShareableList() got an unexpected keyword argument 'name'

I must be missing something too obvious for me to see it?  Or has ShareableList not worked at least since 3.8.8?
msg390197 - (view) Author: Steve Newcomb (steve.newcomb) * Date: 2021-04-04 15:57
The documentation, which needs some improvement, I think.  I'll suggest some improvements when I understand things a little better.

For the record, it turned out that SharedMemoryManager was irrelevant, as were sockets.  That makes sense since memory can't be shared across a network, but the doc nevertheless implies that the socket interface is available.  I don't see why.  ShareableList is a class in shared_memory.py and is a function name, despite its capitalization, in managers.py, with a different signature.  That's massively confusing in combination with the foregoing.  In retrospect, I should have started by paying most of my attention to the documentation's numpy example, even though numpy is irrelevant to my problem and the example was more work to sort through than the other, simpler examples.

With all that resolved in my mind, I immediately ran aground on https://bugs.python.org/issue38119.  In that discussion, Guido notes that [automatic] garbage collection is hard, and I would add that automatic garbage collection is especially hard to deal with when it's not wanted.  I'm attaching the script I wrote in order to satisfy myself that turicas's monkeypatch (see issue38119) allows me to create a standing block of shared memory and to unlink it only when I want to.
History
Date User Action Args
2021-04-04 15:57:51steve.newcombsetfiles: + 5.py
resolution: not a bug
messages: + msg390197
2021-04-02 19:19:00steve.newcombsetmessages: + msg390092
2021-04-02 18:40:32steve.newcombsetmessages: + msg390087
2021-04-02 16:28:21steve.newcombcreate