diff --git a/hggit/__init__.py b/hggit/__init__.py
index dfc11a0ef2a56dc7671bd9990f3f898291029fdb_aGdnaXQvX19pbml0X18ucHk=..672cd1c822b2f40dbaa9ebbb51975e8be349e242_aGdnaXQvX19pbml0X18ucHk= 100644
--- a/hggit/__init__.py
+++ b/hggit/__init__.py
@@ -307,7 +307,7 @@
             revs = opts.get('onlyheads', opts.get('revs'))
         r, c, cleanup = repo.githandler.getremotechanges(other, revs)
         # ugh. This is ugly even by mercurial API compatibility standards
-        if 'onlyheads' not in orig.func_code.co_varnames:
+        if 'onlyheads' not in orig.__code__.co_varnames:
             cleanup = None
         return r, c, cleanup
     return orig(ui, repo, other, *args, **opts)