Comments (5)
@mgorny before having a closer look:
- Which versions of VCR.py are known affected or not affected, what did you use and try?
- Is there a related ticket In Gentoo that I just failed to find?
from vcrpy.
@mgorny before having a closer look:
* Which versions of VCR.py are known affected or not affected, what did you use and try?
5.1.0 failed, 5.0.0 passed.
* Is there a related ticket In Gentoo that I just failed to find?
No, I noticed while bumping, so I deselected it.
Bisect says it's 4f70152 (CC @jairhenrique):
commit 4f70152e7ce510cde41cf071585cbdb481e4e8f2 (HEAD)
Author: Jair Henrique <[email protected]>
AuthorDate: 2023-06-27 14:12:40 +0200
Commit: Jair Henrique <[email protected]>
CommitDate: 2023-06-27 22:36:26 +0200
Enable rule B (flake8-bugbear) on ruff
Prior to this change, the exception is:
ValueError: 'utf-8' codec can't decode byte 0x45 in position 0: invalid start byteDoes this HTTP interaction contain binary data? If so, use a different serializer (like the yaml serializer) for this request?
After it, it is:
ValueError: 'utf-8' codec can't decode byte 0x8c in position 0: invalid start byte
Without simplejson
installed, it is:
ValueError: Does this HTTP interaction contain binary data? If so, use a different serializer (like the yaml serializer) for this request?
Perhaps the simplest solution would be to remove simplejson
support entirely — I suspect it's only there for py2 support.
from vcrpy.
Oh, and my educated guess is that this is the problematic part of the change:
diff --git a/vcr/serializers/jsonserializer.py b/vcr/serializers/jsonserializer.py
index 5ffef3e..55cf780 100644
--- a/vcr/serializers/jsonserializer.py
+++ b/vcr/serializers/jsonserializer.py
@@ -17,13 +17,5 @@ def serialize(cassette_dict):
try:
return json.dumps(cassette_dict, indent=4) + "\n"
- except UnicodeDecodeError as original: # py2
- raise UnicodeDecodeError(
- original.encoding,
- b"Error serializing cassette to JSON",
- original.start,
- original.end,
- original.args[-1] + error_message,
- )
- except TypeError: # py3
- raise TypeError(error_message)
+ except TypeError:
+ raise TypeError(error_message) from None
Note that it removes exception rewriting for "py2" case, and I guess simplejson
falls into that case.
from vcrpy.
@mgorny thanks for the additional details! 🙏
from vcrpy.
Thanks!
from vcrpy.
Related Issues (20)
- Integration tests fail with httpbin 0.10.0 HOT 3
- AIOHTTP not recording json body HOT 1
- How to run tests HOT 2
- [BUG] Doesn't work for URL's beginning with www.
- How is vcrpy importing from a parent directory in a test file HOT 1
- AttributeError: 'VCRHTTPResponse' object has no attribute 'json' HOT 2
- Add type annotations HOT 1
- Backport patch to fix test failures with Python 3.12: AttributeError: type object 'VCRHTTPConnection[…]' has no attribute 'debuglevel' HOT 1
- [Duplicate of #719?] Upgrading to VCR.py that uses urllib3 v2+ causes string decoding problems with requests HOT 2
- 🛠️ Custom Persister HOT 1
- Release 6.0.0 to allow users to update to Python 3.12? HOT 20
- `TypeError: cannot pickle 'generator' object` with urllib 2.1.0, no error with urllib 1.26.18
- [Question] Would it make sense to support glob in `filter_headers`
- VCRHTTPResponse should have a `release_conn()` method
- record creation failed when using async HOT 2
- 'VCRHTTPConnection/...' has no attribute 'debuglevel'. Did you mean: 'set_debuglevel'
- Bug Report: Installation Failure of vcrpy>=5.0.0 in Conda Environment HOT 1
- Exception httpx.ResponseNotRead thrown randomly when using cassettes HOT 1
- Httpx Response content is not set/read, causing JSON parsing errors
- Allow to disable or limit `find_requests_with_most_matches`
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 vcrpy.