Skip to content
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

Hashable memoryviews #57620

Closed
pitrou opened this issue Nov 15, 2011 · 10 comments
Closed

Hashable memoryviews #57620

pitrou opened this issue Nov 15, 2011 · 10 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@pitrou
Copy link
Member

pitrou commented Nov 15, 2011

BPO 13411
Nosy @ncoghlan, @pitrou, @vstinner, @skrah, @meadori, @ericsnowcurrently
Files
  • memhash.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-01-25.17:44:39.654>
    created_at = <Date 2011-11-15.22:20:43.048>
    labels = ['interpreter-core', 'type-feature']
    title = 'Hashable memoryviews'
    updated_at = <Date 2012-01-25.17:44:39.654>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2012-01-25.17:44:39.654>
    actor = 'skrah'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-01-25.17:44:39.654>
    closer = 'skrah'
    components = ['Interpreter Core']
    creation = <Date 2011-11-15.22:20:43.048>
    creator = 'pitrou'
    dependencies = []
    files = ['23697']
    hgrepos = []
    issue_num = 13411
    keywords = ['patch']
    message_count = 10.0
    messages = ['147714', '147811', '147812', '147813', '147814', '147815', '148080', '148082', '151451', '151955']
    nosy_count = 8.0
    nosy_names = ['ncoghlan', 'pitrou', 'vstinner', 'skrah', 'meador.inge', 'neologix', 'python-dev', 'eric.snow']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13411'
    versions = ['Python 3.3']

    @pitrou
    Copy link
    Member Author

    pitrou commented Nov 15, 2011

    This patch allows hashing of memoryviews, as discussed on python-dev.

    @pitrou pitrou added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Nov 15, 2011
    @vstinner
    Copy link
    Member

    Does memory_hash() reject non-contiguous memory?

    _Py_HashBytes() might be reused by unicode_hash() for PyUnicode_1BYTE_KIND.

    @vstinner
    Copy link
    Member

    Except these two minor nits, the patch looks good to me.

    @pitrou
    Copy link
    Member Author

    pitrou commented Nov 17, 2011

    Does memory_hash() reject non-contiguous memory?

    It should, since it checks the strides array.

    _Py_HashBytes() might be reused by unicode_hash() for PyUnicode_1BYTE_KIND.

    I don't really see how unicode hashing should be related to bytes
    hashing (even though apparently an (outdated?) test checks for that).

    @neologix
    Copy link
    Mannequin

    neologix mannequin commented Nov 17, 2011

    I'm not sure that the "register" storage class specifier is still relevant with modern compilers: I'm pretty sure gcc ignores it unless -O0, and I think I've read somewhere Microsoft's compiler ignores it too.

    @pitrou
    Copy link
    Member Author

    pitrou commented Nov 17, 2011

    I'm not sure that the "register" storage class specifier is still
    relevant with modern compilers: I'm pretty sure gcc ignores it unless
    -O0, and I think I've read somewhere Microsoft's compiler ignores it
    too.

    I don't think so either. I was lazily moving the original code, but I
    could remove those bits.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 21, 2011

    New changeset 215690b782f8 by Antoine Pitrou in branch 'default':
    Issue bpo-13411: memoryview objects are now hashable when the underlying object is hashable.
    http://hg.python.org/cpython/rev/215690b782f8

    @pitrou
    Copy link
    Member Author

    pitrou commented Nov 21, 2011

    Fixed, thanks.

    @pitrou pitrou closed this as completed Nov 21, 2011
    @skrah skrah mannequin reopened this Jan 17, 2012
    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jan 17, 2012

    Reopening as a reminder that it isn't fixed yet in http://hg.python.org/features/pep-3118 .

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jan 25, 2012

    @skrah skrah mannequin closed this as completed Jan 25, 2012
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants