Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(44204)

Unified Diff: Objects/object.c

Issue 13411: Hashable memoryviews
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Objects/memoryobject.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -739,6 +739,21 @@ Py_hash_t
}
Py_hash_t
+_Py_HashBytes(unsigned char *p, Py_ssize_t len)
+{
+ register Py_uhash_t x;
+ register Py_ssize_t i;
+
+ x = (Py_uhash_t) *p << 7;
+ for (i = 0; i < len; i++)
+ x = (1000003U * x) ^ (Py_uhash_t) *p++;
+ x ^= (Py_uhash_t) len;
+ if (x == -1)
+ x = -2;
+ return x;
+}
+
+Py_hash_t
PyObject_HashNotImplemented(PyObject *v)
{
PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
« no previous file with comments | « Objects/memoryobject.c ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+