Taken from https://salsa.debian.org/med-team/insighttoolkit/-/blob/itk-4.y/debian/patches/python3.8.diff --- Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py +++ Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py @@ -293,7 +293,7 @@ class scopedef_t(declaration.declaration if self.name == '::': self._logger.debug( "preparing data structures for query optimizer - started") - start_time = time.clock() + start_time = time.perf_counter() self.clear_optimizer() @@ -327,7 +327,7 @@ class scopedef_t(declaration.declaration if self.name == '::': self._logger.debug(( "preparing data structures for query optimizer - " + - "done( %f seconds ). "), (time.clock() - start_time)) + "done( %f seconds ). "), (time.perf_counter() - start_time)) self._optimized = True @staticmethod @@ -475,7 +475,7 @@ class scopedef_t(declaration.declaration def _find_single(self, match_class, **keywds): """implementation details""" self._logger.debug('find single query execution - started') - start_time = time.clock() + start_time = time.perf_counter() norm_keywds = self.__normalize_args(**keywds) decl_matcher = self.__create_matcher(match_class, **norm_keywds) dtype = self.__findout_decl_type(match_class, **norm_keywds) @@ -484,13 +484,13 @@ class scopedef_t(declaration.declaration found = matcher.get_single(decl_matcher, decls, False) self._logger.debug( 'find single query execution - done( %f seconds )', - (time.clock() - start_time)) + (time.perf_counter() - start_time)) return found def _find_multiple(self, match_class, **keywds): """implementation details""" self._logger.debug('find all query execution - started') - start_time = time.clock() + start_time = time.perf_counter() norm_keywds = self.__normalize_args(**keywds) decl_matcher = self.__create_matcher(match_class, **norm_keywds) dtype = self.__findout_decl_type(match_class, **norm_keywds) @@ -502,7 +502,7 @@ class scopedef_t(declaration.declaration self._logger.debug('%d declaration(s) that match query', len(mfound)) self._logger.debug( 'find single query execution - done( %f seconds )', - (time.clock() - start_time)) + (time.perf_counter() - start_time)) if not mfound and not allow_empty: raise RuntimeError( "Multi declaration query returned 0 declarations.") --- Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py +++ Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py @@ -188,11 +188,11 @@ class file_cache_t(cache_base_t): cache_file_obj = open(file_name, 'rb') try: file_cache_t.logger.info('Loading cache file "%s".', file_name) - start_time = time.clock() + start_time = time.perf_counter() cache = pickle.load(cache_file_obj) file_cache_t.logger.debug( "Cache file has been loaded in %.1f secs", - (time.clock() - start_time)) + (time.perf_counter() - start_time)) file_cache_t.logger.debug( "Found cache in file: [%s] entries: %s", file_name, len(list(cache.keys()))) --- Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py +++ Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py @@ -316,11 +316,11 @@ class project_reader_t(object): namespaces.append(decls) self.logger.debug("Flushing cache... ") - start_time = time.clock() + start_time = time.perf_counter() self.__dcache.flush() self.logger.debug( "Cache has been flushed in %.1f secs", - (time.clock() - start_time)) + (time.perf_counter() - start_time)) answer = [] self.logger.debug("Joining namespaces ...") for file_nss in namespaces: