Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding required message to LockError broke backwards compatibility #3168

Closed
miketheman opened this issue Mar 1, 2024 · 1 comment
Closed

Comments

@miketheman
Copy link

miketheman commented Mar 1, 2024

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.

miketheman added a commit to miketheman/warehouse that referenced this issue Mar 1, 2024
Refs: redis/redis-py#3168

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman
Copy link
Author

Resolved by #3176

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant