Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-json5 for openSUSE:Factory 
checked in at 2025-09-29 16:37:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-json5 (Old)
 and      /work/SRC/openSUSE:Factory/.python-json5.new.11973 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-json5"

Mon Sep 29 16:37:09 2025 rev:15 rq:1307693 version:0.12.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-json5/python-json5.changes        
2025-06-10 09:09:36.698165278 +0200
+++ /work/SRC/openSUSE:Factory/.python-json5.new.11973/python-json5.changes     
2025-09-29 16:37:10.930896841 +0200
@@ -1,0 +2,7 @@
+Mon Sep 29 07:13:11 UTC 2025 - John Paul Adrian Glaubitz 
<[email protected]>
+
+- Update to 0.12.1
+  * Fix #94, where objects returned from a custom encoder were
+    not being indented properly.
+
+-------------------------------------------------------------------

Old:
----
  pyjson5-0.12.0.tar.gz

New:
----
  pyjson5-0.12.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-json5.spec ++++++
--- /var/tmp/diff_new_pack.iuSl5t/_old  2025-09-29 16:37:11.654927176 +0200
+++ /var/tmp/diff_new_pack.iuSl5t/_new  2025-09-29 16:37:11.658927344 +0200
@@ -25,7 +25,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-json5
-Version:        0.12.0
+Version:        0.12.1
 Release:        0
 Summary:        A Python implementation of the JSON5 data format
 License:        Apache-2.0

++++++ pyjson5-0.12.0.tar.gz -> pyjson5-0.12.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyjson5-0.12.0/README.md new/pyjson5-0.12.1/README.md
--- old/pyjson5-0.12.0/README.md        2025-04-03 18:33:01.000000000 +0200
+++ new/pyjson5-0.12.1/README.md        2025-08-12 21:45:27.000000000 +0200
@@ -114,11 +114,13 @@
 
 ## Version History / Release Notes
 
+* v0.12.1 (2025-08-12)
+    * Fix [#94](https://github.com/dpranke/pyjson5/issues/94), where objects
+      returned from a custom encoder were not being indented properly.
+
 * v0.12.0 (2025-04-03)
     * Roll back pyproject.toml change for licensing so that we can still
       build the package on 3.8.
-
-* v0.12.0dev0 (prerelease)
     * Upgrade devenv package dependencies to latest versions; they now need
       Python 3.9 or newer, though json5 itself still supports 3.8.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyjson5-0.12.0/json5/lib.py 
new/pyjson5-0.12.1/json5/lib.py
--- old/pyjson5-0.12.0/json5/lib.py     2025-04-03 18:33:01.000000000 +0200
+++ new/pyjson5-0.12.1/json5/lib.py     2025-08-12 21:45:27.000000000 +0200
@@ -803,7 +803,7 @@
         elif hasattr(obj, '__getitem__') and hasattr(obj, '__iter__'):
             s = self._encode_array(obj, seen, level + 1)
         else:
-            s = self.encode(self.default(obj), seen, level + 1, as_key=False)
+            s = self.encode(self.default(obj), seen, level, as_key=False)
             assert s is not None
 
         if self.check_circular:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyjson5-0.12.0/json5/version.py 
new/pyjson5-0.12.1/json5/version.py
--- old/pyjson5-0.12.0/json5/version.py 2025-04-03 18:33:01.000000000 +0200
+++ new/pyjson5-0.12.1/json5/version.py 2025-08-12 21:45:27.000000000 +0200
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__version__ = '0.12.0'
+__version__ = '0.12.1'
 
 # For backward-compatibility with earlier versions of json5:
 VERSION = __version__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyjson5-0.12.0/tests/lib_test.py 
new/pyjson5-0.12.1/tests/lib_test.py
--- old/pyjson5-0.12.0/tests/lib_test.py        2025-04-03 18:33:01.000000000 
+0200
+++ new/pyjson5-0.12.1/tests/lib_test.py        2025-08-12 21:45:27.000000000 
+0200
@@ -515,6 +515,24 @@
 
         self.assertEqual(json5.dumps(MyDict()), '{a: 1, b: 2}')
 
+    def test_custom_encoder(self):
+        class Test:
+            pass
+
+        class Encoder(json5.JSON5Encoder):
+            def default(self, obj):
+                assert isinstance(obj, Test)
+                return {'foo': 'bar'}
+
+        # This tests that the custom value is indented at the same level
+        # that a regular object would be. This is also testing that
+        # Encoder.default is only being called when we don't otherwise know
+        # how to encode something.
+        self.assertEqual(
+            '{\n    baz: {\n        foo: "bar",\n    },\n    quux: 4,\n}',
+            json5.dumps({'baz': Test(), 'quux': 4}, indent=4, cls=Encoder),
+        )
+
     def test_custom_strings(self):
         class MyStr(str):
             pass

Reply via email to