From 13c82b0ac61b7ccedd11420c8aec898020a86319 Mon Sep 17 00:00:00 2001 From: Petya Slavova Date: Thu, 17 Apr 2025 11:49:16 +0300 Subject: [PATCH] Removing 'charset' and 'errors' inputs from the Redis initialization arguments - deprecated 3 years ago. --- docs/advanced_features.rst | 4 ++-- redis/client.py | 17 ----------------- redis/cluster.py | 2 -- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/docs/advanced_features.rst b/docs/advanced_features.rst index 0ed3e1ff34..603e728e84 100644 --- a/docs/advanced_features.rst +++ b/docs/advanced_features.rst @@ -384,13 +384,13 @@ run_in_thread. A PubSub object adheres to the same encoding semantics as the client instance it was created from. Any channel or pattern that's unicode will -be encoded using the charset specified on the client before being sent +be encoded using the encoding specified on the client before being sent to Redis. If the client's decode_responses flag is set the False (the default), the 'channel', 'pattern' and 'data' values in message dictionaries will be byte strings (str on Python 2, bytes on Python 3). If the client's decode_responses is True, then the 'channel', 'pattern' and 'data' values will be automatically decoded to unicode strings using -the client's charset. +the client's encoding. PubSub objects remember what channels and patterns they are subscribed to. In the event of a disconnection such as a network error or timeout, diff --git a/redis/client.py b/redis/client.py index e9435d33ef..fda927507a 100755 --- a/redis/client.py +++ b/redis/client.py @@ -2,7 +2,6 @@ import re import threading import time -import warnings from itertools import chain from typing import ( TYPE_CHECKING, @@ -203,8 +202,6 @@ def __init__( unix_socket_path: Optional[str] = None, encoding: str = "utf-8", encoding_errors: str = "strict", - charset: Optional[str] = None, - errors: Optional[str] = None, decode_responses: bool = False, retry_on_timeout: bool = False, retry_on_error: Optional[List[Type[Exception]]] = None, @@ -256,20 +253,6 @@ def __init__( else: self._event_dispatcher = event_dispatcher if not connection_pool: - if charset is not None: - warnings.warn( - DeprecationWarning( - '"charset" is deprecated. Use "encoding" instead' - ) - ) - encoding = charset - if errors is not None: - warnings.warn( - DeprecationWarning( - '"errors" is deprecated. Use "encoding_errors" instead' - ) - ) - encoding_errors = errors if not retry_on_error: retry_on_error = [] if retry_on_timeout is True: diff --git a/redis/cluster.py b/redis/cluster.py index 4ec03ac98f..39b454babe 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -142,7 +142,6 @@ def parse_cluster_myshardid(resp, **options): SLOT_ID = "slot-id" REDIS_ALLOWED_KEYS = ( - "charset", "connection_class", "connection_pool", "connection_pool_class", @@ -152,7 +151,6 @@ def parse_cluster_myshardid(resp, **options): "decode_responses", "encoding", "encoding_errors", - "errors", "host", "lib_name", "lib_version",