Objects/hash

Source   Edit  

Procs

proc `==`(obj1, obj2: PyObject): bool {.inline, cdecl, ...raises: [DictError],
                                        tags: [RootEffect], forbids: [].}
inner usage for dictobject.
Warning: remember wrap around handleHashExc to handle exception
Source   Edit  
proc hash(obj: PyObject): Hash {....raises: [DictError], tags: [RootEffect],
                                 forbids: [].}
inner usage for dictobject.
Warning: remember wrap around handleHashExc to handle exception
Source   Edit  
proc PyObject_Eq(obj1, obj2: PyObject; exc: var PyBaseErrorObject): bool {.
    ...raises: [], tags: [RootEffect], forbids: [].}
XXX: CPython doesn't define such a function, it uses richcompare (e.g. _Py_BaseObject_RichCompare)
Note: __eq__ is not required to return a bool, so this calls PyObject on result
Source   Edit  
proc PyObject_Hash(obj: PyObject): PyObject {....raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  
proc PyObject_Hash(obj: PyObject; exc: var PyBaseErrorObject): Hash {.
    ...raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
proc rawEq(obj1, obj2: PyObject): bool {....raises: [], tags: [], forbids: [].}
for type.__eq__ Source   Edit  
proc rawHash(obj: PyObject): Hash {....raises: [], tags: [], forbids: [].}
for type.__hash__ Source   Edit  
proc unhashable(obj: PyObject): PyTypeErrorObject {....raises: [],
    tags: [RootEffect], forbids: [].}
Source   Edit  

Templates

template handleHashExc(body)
return exception Source   Edit  
template handleHashExc(handleExc; body)
to handle exception from hash Source   Edit