Comments (1)
return merge({}, self._custom_request_kwargs, kwargs)
File "/opt/python/mergedeep/mergedeep.py", line 106, in merge
return reduce(partial(_deepmerge, strategy=strategy), sources, destination)
File "/opt/python/mergedeep/mergedeep.py", line 94, in _deepmerge
dst[key] = deepcopy(src[key])
File "/var/lang/lib/python3.8/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/var/lang/lib/python3.8/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/var/lang/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/var/lang/lib/python3.8/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/var/lang/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/var/lang/lib/python3.8/copy.py", line 237, in _deepcopy_method
return type(x)(x.__func__, deepcopy(x.__self__, memo))
File "/var/lang/lib/python3.8/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/var/lang/lib/python3.8/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/var/lang/lib/python3.8/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/var/lang/lib/python3.8/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/var/lang/lib/python3.8/copy.py", line 161, in deepcopy
rv = reductor(4)
TypeError: cannot pickle 'module' object
Probably not very useful, but it's happening inside a multithread context.
I tried to replicate the same scenario in a test, but it didn't work:
def test__merge_kwargs(self, requests_mock):
"""
Normally, private methods shouldn't have tests, however this one had problems in production,
so now we have tests for it.
"""
def auth_method(client, method, uri, headers, body):
body = add_params_to_qs(
body or "",
[
("client_id", client.client_id),
("client_secret", client.client_secret or ""),
],
)
if "Content-Length" in headers:
headers["Content-Length"] = str(len(body))
headers["Content-Type"] = "application/x-www-form-urlencoded"
return uri, headers, body
client = OAuthClient("client_id", "client_secret", token_endpoint_auth_method="auth_method")
client.register_client_auth_method(("auth_method", auth_method))
requests_mock.post(self.url, json={"refresh_token": "123123"})
client.refresh_token(self.url, refresh_token="123123")
Maybe be a shallow copy would work here too, I couldn't pinpoint the problem, but it seems to be the same issue with threads.
from mergedeep.
Related Issues (8)
- The `typesafe` merge strategy should support both replace and additive.
- 1.3.4: sphinx 4.x warnings
- Additive merge for dict with list values?
- Types are not used after installation of the package HOT 1
- Credit HOT 1
- Add py.typed file so types can be used for users of mergedeep HOT 5
- Support for Arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mergedeep.