copy.deepcopy() fails when using a SessionOrientedStub
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Attempting to use copy.deepcopy() fails when using a pyVim.connect.VimSessionOrientedStub, while (since the fix introduced in a90023fedfeda48cb1824200dc4530084215f99e) it works correctly for the bare pyVmomi.SoapStubAdapter.
Reproduction steps
>>> import copy, pyVim.connect, pyVmomi
>>> stub = pyVim.connect.VimSessionOrientedStub(
... pyVim.connect.SmartStubAdapter(host='vcenter.example', disableSslCertValidation=True),
... pyVim.connect.VimSessionOrientedStub.makeUserLoginMethod('administrator@vsphere.local', 'swordfish'))
>>> copy.deepcopy(pyVmomi.vim.ServiceInstance('ServiceInstance', stub.soapStub))
'vim.ServiceInstance:ServiceInstance'
>>> copy.deepcopy(pyVmomi.vim.ServiceInstance('ServiceInstance', stub))
[...]
TypeError: cannot pickle '_thread.lock' object
Expected behavior
copy.deepcopy() should work equally well for SoapStubAdapters and VimSessionOrientedStubs.
Additional context
Tested on 8.0.2.0.1, but I see no relevant code changes since then.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided example, then inspect pyVim.connect.VimSessionOrientedStub and the deepcopy-related handling for pyVmomi.SoapStubAdapter. Done means copy.deepcopy() succeeds for a ServiceInstance created with either stub, including the session-oriented stub.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100