-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(stdlib/sqlite): Implement slice assignment for Blob #6039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(stdlib/sqlite): Implement slice assignment for Blob #6039
Conversation
Warning Rate limit exceeded@ever0de has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 13 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
5bdf19c
to
9f4111f
Compare
9f4111f
to
c776b96
Compare
cpython version: 3.12.5 import sqlite3
def setup_db_and_blob():
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE test (data BLOB)")
db.execute("INSERT INTO test (data) VALUES (?)", (b"A" * 50,))
db.commit()
blob = db.blobopen("test", "data", 1)
return db, blob
def test_scenario(description, code_to_run):
db, blob = setup_db_and_blob()
error_message = ""
error_type = ""
try:
exec(code_to_run)
except Exception as e:
error_type = type(e).__name__
error_message = str(e)
finally:
blob.close()
db.close()
print(f"--- {description} ---")
print(f"Code: {code_to_run}")
print(f"Result: {error_type}('{error_message}')\n")
test_scenario(
"Non-contiguous Buffer",
'blob[5:10] = memoryview(b"0123456789")[::2]'
)
# BufferError('memoryview: underlying buffer is not C-contiguous')
test_scenario(
"Step is Zero",
'blob[5:10:0] = b"12345"'
)
# ValueError('slice step cannot be zero')
test_scenario(
"Size Mismatch",
'blob[5:10] = b"a"'
)
# IndexError('Blob slice assignment is wrong size') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
reference
Summary by CodeRabbit