changeset 40233:6309128ff61f

py3: use __code__ instead of func_code to test if func is cachable Surprisingly, this fixes test-cache-abuse.t, which would generate a different revbranch cache if filtered set had no cache.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Oct 2018 11:01:38 +0200
parents d99a588d8515
children 3fc2ef49959c
files contrib/python3-whitelist mercurial/smartset.py
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/python3-whitelist	Sat Oct 13 10:58:06 2018 +0200
+++ b/contrib/python3-whitelist	Sat Oct 13 11:01:38 2018 +0200
@@ -48,6 +48,7 @@
 test-bundle2-multiple-changegroups.t
 test-bundle2-pushback.t
 test-bundle2-remote-changegroup.t
+test-cache-abuse.t
 test-cappedreader.py
 test-casecollision.t
 test-cat.t
--- a/mercurial/smartset.py	Sat Oct 13 10:58:06 2018 +0200
+++ b/mercurial/smartset.py	Sat Oct 13 11:01:38 2018 +0200
@@ -137,7 +137,7 @@
 
         This is part of the mandatory API for smartset."""
         # builtin cannot be cached. but do not needs to
-        if cache and util.safehasattr(condition, 'func_code'):
+        if cache and util.safehasattr(condition, '__code__'):
             condition = util.cachefunc(condition)
         return filteredset(self, condition, condrepr)