diff --git a/langkit/templates/python_api/module_py.mako b/langkit/templates/python_api/module_py.mako index 4b12894c5..2c9f6a316 100644 --- a/langkit/templates/python_api/module_py.mako +++ b/langkit/templates/python_api/module_py.mako @@ -149,6 +149,12 @@ class AnalysisContext(object): _destroy_analysis_context(self._c_value) super(AnalysisContext, self).__init__() + def __eq__(self, other): + return self._c_value == other._c_value + + def __hash__(self): + return hash(self._c_value) + def get_from_file(self, filename, charset=None, reparse=False, with_trivia=False): ${py_doc('langkit.get_unit_from_file', 8)} @@ -224,6 +230,12 @@ class AnalysisUnit(object): _unit_decref(self._c_value) super(AnalysisUnit, self).__init__() + def __eq__(self, other): + return self._c_value == other._c_value + + def __hash__(self): + return hash(self._c_value) + def reparse(self, buffer=None, charset=None): ${py_doc('langkit.unit_reparse_generic', 8)} if buffer is None: