Skip to content

Adding required message to LockError broke backwards compatibility #3168

Closed
@miketheman

Description

@miketheman

Version: redis-py 5.0.2

Description: The newly-introduced __init__() on LockError required a message and fails without it.

Previously, once could raise LockError() successfully.
Making message a required positional argument fails existing code.

Here's a simple mockup reproduction:

from redis.exceptions import LockError
try:
    raise LockError()
except LockError:
    print("LockError raised")

(obviously that's not real code, but demonstrates LockError with no message)

With the changes introduced in #3023 - specifically https://github.com/redis/redis-py/pull/3023/files#diff-38992dc598ce0eba5aba9cfd91541d9e61aaaf92387e88b5905685f7b3ffa129R85-R87

The same code raises:

TypeError: LockError.__init__() missing 1 required positional argument: 'message'

It's easy enough to fix on my end by adding a message, but it wasn't a backwards-compatible change and broke stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions