Yelp / bravado-core

Other
109 stars 98 forks source link

Fix deepcopy issue on Python3.5.0 #362

Closed macisamuele closed 4 years ago

macisamuele commented 4 years ago

While working on https://github.com/Yelp/bravado/pull/445, I've noticed that the deepcopy support added in #360 seems to not be working on Python3.5.0.

The goal of this PR is to fix the issue.

NOTE: This PR is still in draft as the issue is not solved, but as least we can reproduce it via travis

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.1%) to 98.395% when pulling 59f0a363f427d3b70da516e1128ee3a7451baec8 on macisamuele:maci-run-tests-on-python-3.5.0 into 9c20a251f016870f1f716b7217d3dae4ebbf9c56 on Yelp:master.

macisamuele commented 4 years ago

I've dug a bit more into the test failures in Python 3.5.0 and I did found out that the issue is a known issue for the CPython implementation (issue link) and that it has already been resolved.

Unfortunately, the RefResolver of jsonschema library does use lru_cache into the class attributes and so this triggers the issue.

I've not found an easy/nice way to work this around but at the same time I do not expect that a lot of our users are using Python 3.5.0 (which should be the only affected version

My proposal at this point would be to update the bravado-core changelog highlighting the fact that deepcopy might not work properly on CPython 3.5.0.

Test run on all versions is available at: https://gist.github.com/macisamuele/edbdfee3bfdd10c33cc40ab654d9cb71