diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -242,7 +242,8 @@ def _pushbundle2(pushop): replyhandlers = [] for partgen in bundle2partsgenerators: ret = partgen(pushop, bundler) - replyhandlers.append(ret) + if callable(ret): + replyhandlers.append(ret) # do not push if nothing to push if bundler.nbparts <= 1: return diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t --- a/tests/test-bundle2.t +++ b/tests/test-bundle2.t @@ -957,7 +957,6 @@ Setting up > if reason == 'race': > # 20 Bytes of crap > bundler.newpart('b2x:check:heads', data='01234567890123456789') - > return lambda op: None > > @bundle2.parthandler("test:abort") > def handleabort(op, part):