Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-jsonrpclib-pelix for
openSUSE:Factory checked in at 2026-06-22 17:28:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jsonrpclib-pelix (Old)
and /work/SRC/openSUSE:Factory/.python-jsonrpclib-pelix.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jsonrpclib-pelix"
Mon Jun 22 17:28:45 2026 rev:8 rq:1360758 version:1.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-jsonrpclib-pelix/python-jsonrpclib-pelix.changes
2026-03-30 18:32:15.209451684 +0200
+++
/work/SRC/openSUSE:Factory/.python-jsonrpclib-pelix.new.1956/python-jsonrpclib-pelix.changes
2026-06-22 17:29:40.754247082 +0200
@@ -1,0 +2,14 @@
+Sat Jun 20 17:59:07 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 1.1.0:
+ * Fixed access to error message in results
+ * Allow the request query ID to be set to 0 or empty string
+ * Allow the definition of a classes registry to restrict
+ dynamic imports
+ * Allow the definition of a maximum content length to reject
+ large requests
+ * Overall code review
+ * Disable `cjson` and `simplejson` tests on Python 3.15
+ * Added note on expected Pydantic test failure on Python 2.7
+
+-------------------------------------------------------------------
Old:
----
v1.0.0.tar.gz
New:
----
v1.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-jsonrpclib-pelix.spec ++++++
--- /var/tmp/diff_new_pack.0dwdpE/_old 2026-06-22 17:29:41.366268402 +0200
+++ /var/tmp/diff_new_pack.0dwdpE/_new 2026-06-22 17:29:41.370268541 +0200
@@ -17,7 +17,7 @@
Name: python-jsonrpclib-pelix
-Version: 1.0.0
+Version: 1.1.0
Release: 0
Summary: JSPN-RPC over HTTP Library for Pelix Remote Services
License: Apache-2.0
++++++ v1.0.0.tar.gz -> v1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/.github/workflows/build-24.04.yml
new/jsonrpclib-1.1.0/.github/workflows/build-24.04.yml
--- old/jsonrpclib-1.0.0/.github/workflows/build-24.04.yml 2025-11-09
18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/.github/workflows/build-24.04.yml 2026-05-30
21:55:18.000000000 +0200
@@ -5,11 +5,11 @@
on:
push:
- branches: [ "master" ]
+ branches: [ "main" ]
tags:
- '**'
pull_request:
- branches: [ "master" ]
+ branches: [ "main" ]
jobs:
build:
@@ -18,12 +18,12 @@
strategy:
fail-fast: false
matrix:
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14",
"3.15.0-alpha.1"]
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14",
"3.15.0-beta.1"]
steps:
- - uses: actions/[email protected]
+ - uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/[email protected]
+ uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/README.md
new/jsonrpclib-1.1.0/README.md
--- old/jsonrpclib-1.0.0/README.md 2025-11-09 18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/README.md 2026-05-30 21:55:18.000000000 +0200
@@ -2,8 +2,8 @@
[](https://pypi.python.org/pypi/jsonrpclib-pelix/)
[](https://pypi.python.org/pypi/jsonrpclib-pelix/)
-[](https://github.com/tcalmant/jsonrpclib/actions/workflows/build-24.04.yml)
-[](https://coveralls.io/r/tcalmant/jsonrpclib?branch=master)
+[](https://github.com/tcalmant/jsonrpclib/actions/workflows/build-24.04.yml)
+[](https://coveralls.io/r/tcalmant/jsonrpclib?branch=main)
This library is an implementation of the JSON-RPC specification.
It supports both the original 1.0 specification, as well as the new
@@ -105,7 +105,7 @@
The easiest way to do it is to add those lines at the beginning of your code:
```python
import logging
-logging.basiConfig()
+logging.basicConfig()
```
More information can be found in the
@@ -119,7 +119,7 @@
batch calls, class translation (if left on), etc.
**Note:** The import line is slightly different from the regular
-`SimpleXMLRPCServer`, since the `SimpleJSONRPCServer` is provided by th
+`SimpleXMLRPCServer`, since the `SimpleJSONRPCServer` is provided by the
`jsonrpclib` library.
```python
@@ -150,6 +150,37 @@
server.serve_forever()
```
+### Maximum request size
+
+The request handler now supports limiting the maximum accepted request body
+size through `MAX_REQUEST_SIZE`.
+
+The default value is `0`, which means **unlimited** and keeps the previous
+behavior.
+
+To enable a limit for a specific server, subclass
+`SimpleJSONRPCRequestHandler` and override `max_request_size`:
+
+```python
+from jsonrpclib.SimpleJSONRPCServer import (
+ SimpleJSONRPCRequestHandler,
+ SimpleJSONRPCServer,
+)
+
+
+class LimitedRequestHandler(SimpleJSONRPCRequestHandler):
+ # Limit request body to 1 MiB
+ max_request_size = 1024 * 1024
+
+
+server = SimpleJSONRPCServer(
+ ("localhost", 8080), requestHandler=LimitedRequestHandler
+)
+```
+
+When the limit is exceeded, the server responds with `HTTP 413`
+(`Request Entity Too Large`).
+
### Notification Thread Pool
By default, notification calls are handled in the request handling thread.
@@ -384,8 +415,7 @@
## Class Translation
-The library supports an *"automatic"* class translation process, although it
-is turned off by default.
+The library supports an *"automatic"* class translation process, turned on by
default.
This can be devastatingly slow if improperly used, so the following is just a
short list of things to keep in mind when using it.
@@ -482,6 +512,11 @@
pytest tests
```
+### A note on Python 2.7
+
+Running tests as is on Python 2.7 will fail as the `tests/test_pydantic.py`
uses
+type annotations and therefore raises a `SyntaxError`. This error can be
ignored.
+
## Why JSON-RPC?
In my opinion, there are several reasons to choose JSON over XML for RPC:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/docs/changelog.md
new/jsonrpclib-1.1.0/docs/changelog.md
--- old/jsonrpclib-1.0.0/docs/changelog.md 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/docs/changelog.md 2026-05-30 21:55:18.000000000
+0200
@@ -1,5 +1,16 @@
# Release Notes
+## 1.1
+
+:Release Date: 2026-05-30
+
+- Fixed access to error message in results
+- Allow the request query ID to be set to 0 or empty string
+- Allow the definition of a classes registry to restrict dynamic imports
+- Allow the definition of a maximum content length to reject large requests
+- Overall code review
+- Disable `cjson` and `simplejson` tests on Python 3.15
+
## 1.0
:Release Date: 2025-11-09
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/docs/installation.md
new/jsonrpclib-1.1.0/docs/installation.md
--- old/jsonrpclib-1.0.0/docs/installation.md 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/docs/installation.md 2026-05-30 21:55:18.000000000
+0200
@@ -2,7 +2,7 @@
## Requirements
-It supports `orjson`, `cjson` and `simplejson`, and looks for the parsers
+It supports `orjson`, `ujson`, `cjson` and `simplejson`, and looks for the
parsers
in that order (searching first for `orjson`, `ujson`, `cjson`, `simplejson` and
finally for the built-in `json`).
One of these must be installed to use this library, although if you have a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/docs/license.md
new/jsonrpclib-1.1.0/docs/license.md
--- old/jsonrpclib-1.0.0/docs/license.md 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/docs/license.md 2026-05-30 21:55:18.000000000
+0200
@@ -8,7 +8,7 @@
This snippet is added to the module-level documentation::
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/docs/server.md
new/jsonrpclib-1.1.0/docs/server.md
--- old/jsonrpclib-1.0.0/docs/server.md 2025-11-09 18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/docs/server.md 2026-05-30 21:55:18.000000000 +0200
@@ -24,6 +24,7 @@
To start protect the server with SSL, use the following snippet:
```python
+import ssl
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
# Setup the SSL socket
@@ -40,6 +41,36 @@
server.serve_forever()
```
+## Maximum Request Size
+
+The request handler supports limiting the maximum accepted request body size
+through `MAX_REQUEST_SIZE`.
+
+The default value is `0`, which means **unlimited** and therefore preserves
+the previous behavior.
+
+To configure a limit for one server, subclass
+`SimpleJSONRPCRequestHandler` and override `max_request_size`:
+
+```python
+from jsonrpclib.SimpleJSONRPCServer import (
+ SimpleJSONRPCRequestHandler,
+ SimpleJSONRPCServer,
+)
+
+
+class LimitedRequestHandler(SimpleJSONRPCRequestHandler):
+ # Limit request body to 1 MiB
+ max_request_size = 1024 * 1024
+
+
+server = SimpleJSONRPCServer(
+ ('localhost', 8080), requestHandler=LimitedRequestHandler)
+```
+
+When the limit is exceeded, the server responds with `HTTP 413`
+(`Request Entity Too Large`).
+
## A note on logging
`jsonrpclib-pelix` uses the `logging` module from the standard Python
@@ -73,7 +104,7 @@
pool.start()
# Setup the server
-server = SimpleJSONRPCServer(('localhost', 8080), config)
+server = SimpleJSONRPCServer(('localhost', 8080))
server.set_notification_pool(pool)
# Register methods
@@ -104,17 +135,17 @@
from jsonrpclib.threadpool import ThreadPool
# Setup the notification and request pools
-nofif_pool = ThreadPool(max_threads=10, min_threads=0)
+notification_pool = ThreadPool(max_threads=10, min_threads=0)
request_pool = ThreadPool(max_threads=50, min_threads=10)
# Don't forget to start them
-nofif_pool.start()
+notification_pool.start()
request_pool.start()
# Setup the server
server = PooledJSONRPCServer(
- ('localhost', 8080), config, thread_pool=request_pool)
-server.set_notification_pool(nofif_pool)
+ ('localhost', 8080), thread_pool=request_pool)
+server.set_notification_pool(notification_pool)
# Register methods
server.register_function(pow)
@@ -126,7 +157,7 @@
finally:
# Stop the thread pools (let threads finish their current task)
request_pool.stop()
- nofif_pool.stop()
+ notification_pool.stop()
server.set_notification_pool(None)
```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/SimpleJSONRPCServer.py
new/jsonrpclib-1.1.0/jsonrpclib/SimpleJSONRPCServer.py
--- old/jsonrpclib-1.0.0/jsonrpclib/SimpleJSONRPCServer.py 2025-11-09
18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/SimpleJSONRPCServer.py 2026-05-30
21:55:18.000000000 +0200
@@ -5,13 +5,13 @@
CGI request handler.
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
@@ -90,6 +90,9 @@
# Prepare the logger
_logger = logging.getLogger(__name__)
+# Maximum size of a JSON-RPC request body (0 means unlimited)
+MAX_REQUEST_SIZE = 0
+
#
------------------------------------------------------------------------------
@@ -457,9 +460,16 @@
HTTP request handler.
The server that receives the requests must have a json_config member,
- containing a JSONRPClib Config instance
+ containing a JSONRPClib Config instance.
+
+ Override ``max_request_size`` in a subclass to change the limit per
+ server instance without affecting the module-level default.
"""
+ # Maximum accepted Content-Length (in bytes). Override in a subclass to
+ # adjust the limit for a specific server.
+ max_request_size = MAX_REQUEST_SIZE
+
def do_POST(self):
"""
Handles POST requests
@@ -475,6 +485,23 @@
# Read the request body
max_chunk_size = 10 * 1024 * 1024
size_remaining = int(self.headers["content-length"])
+
+ # Refuse requests exceeding the size limit before reading the body
+ if self.max_request_size and size_remaining >
self.max_request_size:
+ fault = Fault(
+ -32600,
+ "Request too large.",
+ config=config,
+ )
+ response = utils.to_bytes(fault.response())
+ self.send_response(413)
+ self.send_header("Content-type", config.content_type)
+ self.send_header("Content-length", str(len(response)))
+ self.send_header("Connection", "close")
+ self.end_headers()
+ self.wfile.write(response)
+ return
+
chunks = []
while size_remaining:
chunk_size = min(size_remaining, max_chunk_size)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/__init__.py
new/jsonrpclib-1.1.0/jsonrpclib/__init__.py
--- old/jsonrpclib-1.0.0/jsonrpclib/__init__.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/__init__.py 2026-05-30 21:55:18.000000000
+0200
@@ -4,13 +4,13 @@
Aliases to ease access to jsonrpclib classes
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/config.py
new/jsonrpclib-1.1.0/jsonrpclib/config.py
--- old/jsonrpclib-1.0.0/jsonrpclib/config.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/config.py 2026-05-30 21:55:18.000000000
+0200
@@ -3,13 +3,13 @@
"""
The configuration module.
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/history.py
new/jsonrpclib-1.1.0/jsonrpclib/history.py
--- old/jsonrpclib-1.0.0/jsonrpclib/history.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/history.py 2026-05-30 21:55:18.000000000
+0200
@@ -4,13 +4,13 @@
The history module.
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
"""
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/jsonclass.py
new/jsonrpclib-1.1.0/jsonrpclib/jsonclass.py
--- old/jsonrpclib-1.0.0/jsonrpclib/jsonclass.py 2025-11-09
18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/jsonclass.py 2026-05-30
21:55:18.000000000 +0200
@@ -4,13 +4,13 @@
The serialization module
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
@@ -243,11 +243,11 @@
# List, set or tuple
elif isinstance(obj, utils.ITERABLE_TYPES):
# This comes from a JSON parser, so it can only be a list...
- return [load(entry) for entry in obj]
+ return [load(entry, classes) for entry in obj]
# Otherwise, it's a dict type
elif "__jsonclass__" not in obj:
- return {key: load(value) for key, value in obj.items()}
+ return {key: load(value, classes) for key, value in obj.items()}
# It's a dictionary, and it has a __jsonclass__
orig_module_name = obj["__jsonclass__"][0]
@@ -273,8 +273,21 @@
raise TranslationError(
"Unknown class or module {0}.".format(json_module_parts[0])
)
+ elif classes:
+ # A classes registry is provided: refuse dynamic imports to prevent
+ # arbitrary deserialization. Check full name first, then short name.
+ json_class = classes.get(json_module_clean)
+ if json_class is None:
+ json_class = classes.get(json_module_parts[-1])
+ if json_class is None:
+ raise TranslationError(
+ "Class {0} is not registered. Dynamic class loading is "
+ "disabled when a class registry is provided.".format(
+ orig_module_name
+ )
+ )
else:
- # Module + class
+ # No classes registry: allow dynamic import for backward compatibility
json_class_name = json_module_parts.pop()
json_module_tree = ".".join(json_module_parts)
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/jsonlib.py
new/jsonrpclib-1.1.0/jsonrpclib/jsonlib.py
--- old/jsonrpclib-1.0.0/jsonrpclib/jsonlib.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/jsonlib.py 2026-05-30 21:55:18.000000000
+0200
@@ -5,13 +5,13 @@
provides a single interface for all
:authors: Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/jsonrpc.py
new/jsonrpclib-1.1.0/jsonrpclib/jsonrpc.py
--- old/jsonrpclib-1.0.0/jsonrpclib/jsonrpc.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/jsonrpc.py 2026-05-30 21:55:18.000000000
+0200
@@ -36,13 +36,13 @@
See https://github.com/tcalmant/jsonrpclib for more info.
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -100,7 +100,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
@@ -1130,7 +1130,7 @@
if not isinstance(method, utils.STRING_TYPES):
raise ValueError("Method name must be a string.")
- if not self.id:
+ if self.id is None:
# Generate a request ID
self.id = str(uuid.uuid4())
@@ -1297,7 +1297,7 @@
:param version: JSON-RPC version
:param notify: If True, this is a notification request
:param config: A JSONRPClib Config instance
- :return: A JSON-RPC dictionary
+ :return: The string representation of a JSON-RPC dictionary
"""
# Prepare the dictionary
request = dump(
@@ -1402,7 +1402,7 @@
elif isinstance(result["error"], dict) and len(result["error"]) == 1:
# Error with a single entry ('reason', ...): use its content
- error_key = result["error"].keys()[0]
+ error_key = next(iter(result["error"]))
raise ProtocolError(result["error"][error_key])
else:
@@ -1422,7 +1422,7 @@
# Not a list: not a batch call
return False
elif len(request) < 1:
- # Only one request: not a batch call
+ # Empty batch: consider invalid
return False
elif not isinstance(request[0], utils.DictType):
# One of the requests is not a dictionary, i.e. a JSON Object
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/threadpool.py
new/jsonrpclib-1.1.0/jsonrpclib/threadpool.py
--- old/jsonrpclib-1.0.0/jsonrpclib/threadpool.py 2025-11-09
18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/threadpool.py 2026-05-30
21:55:18.000000000 +0200
@@ -4,13 +4,13 @@
Cached thread pool, inspired from Pelix/iPOPO Thread Pool
:author: Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
@@ -114,7 +114,6 @@
:param timeout: Wait timeout (in seconds)
:return: True if the event as been set, else False
"""
- # The 'or' part is for Python 2.6
result = self.__event.wait(timeout)
# pylint: disable=E0702
# Pylint seems to miss the "is None" check below
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/jsonrpclib/utils.py
new/jsonrpclib-1.1.0/jsonrpclib/utils.py
--- old/jsonrpclib-1.0.0/jsonrpclib/utils.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/jsonrpclib/utils.py 2026-05-30 21:55:18.000000000
+0200
@@ -4,13 +4,13 @@
Utility methods, for compatibility between Python version
:author: Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
#
------------------------------------------------------------------------------
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/pyproject.toml
new/jsonrpclib-1.1.0/pyproject.toml
--- old/jsonrpclib-1.0.0/pyproject.toml 2025-11-09 18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/pyproject.toml 2026-05-30 21:55:18.000000000 +0200
@@ -7,10 +7,9 @@
[project]
name = "jsonrpclib-pelix"
-version = "1.0.0"
+version = "1.1.0"
authors = [
- { name="Thomas Calmant", email="[email protected]" },
- { name="Josh Marshall" }
+ { name="Thomas Calmant", email="[email protected]" }
]
description = """\
JSON-RPC v2.0 client and server for Python 2.7 and Python 3.6+ \
@@ -34,6 +33,7 @@
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
+ "Programming Language :: Python :: 3.15",
]
license = "Apache-2.0"
license-files = ["LICENSE"]
@@ -55,3 +55,6 @@
[tool.ruff]
line-length = 80
+
+[tool.ruff.lint]
+extend-select = ["I"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/run_tests.sh
new/jsonrpclib-1.1.0/run_tests.sh
--- old/jsonrpclib-1.0.0/run_tests.sh 2025-11-09 18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/run_tests.sh 2026-05-30 21:55:18.000000000 +0200
@@ -80,6 +80,17 @@
fi
}
+python_before_3_15() {
+ if [ -z "$UV" ]
+ then
+ python3 -c 'import sys; exit(sys.version_info[:2] >= (3, 15))'
>/dev/null 2>&1
+ return $?
+ else
+ uv run python -c 'import sys; exit(sys.version_info[:2] >= (3, 15))'
>/dev/null 2>&1
+ return $?
+ fi
+}
+
echo "Installing dependencies..."
run_pip_install pytest coverage || exit 1
export COVERAGE_PROCESS_START=".coveragerc"
@@ -104,11 +115,17 @@
echo "uJson tests..."
run_lib_tests ujson ujson || exit 1
-echo "cJson tests..."
-run_lib_tests cjson python-cjson || exit 1
+if python_before_3_15
+then
+ echo "cJson tests..."
+ run_lib_tests cjson python-cjson || exit 1
+
+ echo "simplejson tests..."
+ run_lib_tests simplejson simplejson || exit 1
+else
+ echo "Ignoring cjson and simplejson tests: Python 3.15+ is not supported."
+fi
-echo "simplejson tests..."
-run_lib_tests simplejson simplejson || exit 1
echo "Combine results..."
run_coverage combine || exit $?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/setup.py
new/jsonrpclib-1.1.0/setup.py
--- old/jsonrpclib-1.0.0/setup.py 2025-11-09 18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/setup.py 2026-05-30 21:55:18.000000000 +0200
@@ -4,13 +4,13 @@
Installation script
:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2025, Thomas Calmant
+:copyright: Copyright 2026, Thomas Calmant
:license: Apache License 2.0
-:version: 1.0.0
+:version: 1.1.0
..
- Copyright 2025 Thomas Calmant
+ Copyright 2026 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
"""
# Module version
-__version_info__ = (1, 0, 0)
+__version_info__ = (1, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/tests/test_headers.py
new/jsonrpclib-1.1.0/tests/test_headers.py
--- old/jsonrpclib-1.0.0/tests/test_headers.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/tests/test_headers.py 2026-05-30 21:55:18.000000000
+0200
@@ -11,18 +11,22 @@
import re
import socket
import sys
+import threading
import unittest
-import jsonrpclib
try:
# Python 2
from StringIO import StringIO
-
except ImportError:
# Python 3
from io import StringIO
# JSON-RPC library
+import jsonrpclib
+from jsonrpclib.SimpleJSONRPCServer import (
+ SimpleJSONRPCRequestHandler,
+ SimpleJSONRPCServer,
+)
from jsonrpclib.utils import from_bytes
# Tests utilities
@@ -292,3 +296,60 @@
self.assertEqual(headers1["x-level-1"], "1")
self.assertTrue("x-level-2" in headers2)
self.assertEqual(headers2["x-level-2"], "2")
+
+ def test_content_length_too_large(self):
+ """
+ Tests that requests with a Content-Length exceeding MAX_REQUEST_SIZE
+ are rejected with HTTP 413 before the body is read.
+ """
+ # Use an explicit, non-zero limit so the check is always active.
+ _LIMIT = 1024
+
+ class _LimitedHandler(SimpleJSONRPCRequestHandler):
+ max_request_size = _LIMIT
+
+ # Silence per-request log lines during the test
+ def log_request(self, code="-", size="-"):
+ pass
+
+ srv = SimpleJSONRPCServer(
+ (HOST, 0), requestHandler=_LimitedHandler, logRequests=False
+ )
+ srv_thread = threading.Thread(target=srv.serve_forever)
+ srv_thread.daemon = True
+ srv_thread.start()
+
+ try:
+ port = srv.socket.getsockname()[1]
+ body = b'{"jsonrpc":"2.0","method":"ping","id":"1"}'
+ oversized_length = _LIMIT + 1
+ raw_request = (
+ "POST / HTTP/1.0\r\n"
+ "Host: {host}\r\n"
+ "Content-Type: application/json-rpc\r\n"
+ "Content-Length: {length}\r\n"
+ "\r\n"
+ ).format(host=HOST, length=oversized_length).encode("utf-8") + body
+
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.settimeout(5)
+ try:
+ sock.connect((HOST, port))
+ sock.sendall(raw_request)
+ # Read until end of HTTP headers
+ response = b""
+ while b"\r\n\r\n" not in response:
+ chunk = sock.recv(4096)
+ if not chunk:
+ break
+ response += chunk
+ finally:
+ sock.close()
+
+ # The server must reject with HTTP 413 Request Entity Too Large
+ status_line = response.split(b"\r\n")[0]
+ self.assertIn(b"413", status_line)
+ finally:
+ srv.shutdown()
+ srv.server_close()
+ srv_thread.join(5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/tests/test_internal.py
new/jsonrpclib-1.1.0/tests/test_internal.py
--- old/jsonrpclib-1.0.0/tests/test_internal.py 2025-11-09 18:22:13.000000000
+0100
+++ new/jsonrpclib-1.1.0/tests/test_internal.py 2026-05-30 21:55:18.000000000
+0200
@@ -179,3 +179,47 @@
)
self.assertRaises(jsonrpclib.TransportError, badserver.foo)
+
+
+#
------------------------------------------------------------------------------
+
+
+class CheckForErrorsTests(unittest.TestCase):
+ """
+ Tests for the check_for_errors function
+ """
+
+ def test_single_key_error(self):
+ """
+ Tests check_for_errors with a single-key error dict (non-standard
+ format, e.g. from jabsorb). Verifies the fix for dict.keys()[0]
+ which is incompatible with Python 3.
+ """
+ from jsonrpclib.jsonrpc import check_for_errors
+
+ result = {
+ "jsonrpc": "2.0",
+ "id": "1",
+ "error": {"reason": "something went wrong"},
+ }
+ with self.assertRaises(jsonrpclib.ProtocolError) as ctx:
+ check_for_errors(result)
+ self.assertIn("something went wrong", str(ctx.exception))
+
+
+class PayloadTests(unittest.TestCase):
+ """
+ Tests for the Payload class
+ """
+
+ def test_request_rpcid_zero(self):
+ """
+ Tests that rpcid=0 is preserved and not overwritten.
+ Verifies the fix for 'if not self.id' (falsy check) vs
+ 'if self.id is None'.
+ """
+ from jsonrpclib.jsonrpc import Payload
+
+ payload = Payload(rpcid=0, version=2.0)
+ request = payload.request("test_method")
+ self.assertEqual(request["id"], 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jsonrpclib-1.0.0/tests/test_jsonclass.py
new/jsonrpclib-1.1.0/tests/test_jsonclass.py
--- old/jsonrpclib-1.0.0/tests/test_jsonclass.py 2025-11-09
18:22:13.000000000 +0100
+++ new/jsonrpclib-1.1.0/tests/test_jsonclass.py 2026-05-30
21:55:18.000000000 +0200
@@ -35,7 +35,7 @@
# JSON-RPC library
-from jsonrpclib.jsonclass import dump, load
+from jsonrpclib.jsonclass import dump, load, TranslationError
import jsonrpclib.config
@@ -385,3 +385,11 @@
result = load(serialized)
self.assertIsInstance(result, Decimal)
self.assertEqual(result, d_dec)
+
+ def test_load_unknown_module(self):
+ """
+ Tests that loading a __jsonclass__ pointing to a non-existent module
+ raises TranslationError
+ """
+ obj = {"__jsonclass__": ["nonexistent_module_xyz.SomeClass", []]}
+ self.assertRaises(TranslationError, load, obj)