Skip to content

fix: replace buffer with memoryview for compatibility#289

Merged
ekzhu merged 1 commit intoekzhu:masterfrom
bhimrazy:fix/F821-undefined-buffer
Nov 16, 2025
Merged

fix: replace buffer with memoryview for compatibility#289
ekzhu merged 1 commit intoekzhu:masterfrom
bhimrazy:fix/F821-undefined-buffer

Conversation

@bhimrazy
Copy link
Copy Markdown
Contributor

@bhimrazy bhimrazy commented Nov 16, 2025

What does this PR do?

This PR fixes F821 undefined buffer by replacing buffer with memoryview for compatibility.

Checklist

  • Are unit tests passing?
  • [N/A] Documentation added/updated for all public APIs?
  • [N/A] Is this a breaking change? If yes, add "[BREAKING]" to the PR title.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes Python 3 compatibility issues by replacing the obsolete buffer() builtin (which only existed in Python 2) with memoryview(), the Python 3 equivalent. This resolves the F821 "undefined buffer" linting error.

  • Replaces all occurrences of buffer() with memoryview() in deserialization methods
  • Removes the F821 ignore rule from pyproject.toml now that the issue is fixed

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pyproject.toml Removes the F821 linting ignore rule now that buffer is fixed
datasketch/lean_minhash.py Replaces buffer() with memoryview() in deserialize and setstate methods
datasketch/hyperloglog.py Replaces buffer() with memoryview() in deserialize and setstate methods
datasketch/b_bit_minhash.py Replaces buffer() with memoryview() in setstate method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ekzhu ekzhu merged commit 1555005 into ekzhu:master Nov 16, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants