Giter VIP home page Giter VIP logo

Comments (5)

hartwork avatar hartwork commented on June 12, 2024

@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 avatar mgorny commented on June 12, 2024

@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.

mgorny avatar mgorny commented on June 12, 2024

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.

hartwork avatar hartwork commented on June 12, 2024

@mgorny thanks for the additional details! 🙏

from vcrpy.

mgorny avatar mgorny commented on June 12, 2024

Thanks!

from vcrpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.