diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -989,7 +989,10 @@ class bundlepart(object): outdebug(ui, 'closing payload chunk') # abort current part payload yield _pack(_fpayloadsize, 0) - raise exc_info[0], exc_info[1], exc_info[2] + if sys.version_info[0] >= 3: + raise exc_info[0](exc_info[1]).with_traceback(exc_info[2]) + else: + exec("""raise exc_info[0], exc_info[1], exc_info[2]""") # end of payload outdebug(ui, 'closing payload chunk') yield _pack(_fpayloadsize, 0) diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -81,7 +81,7 @@ mercurial/archival.py: invalid syntax: invalid syntax (, line *) (glob) mercurial/bookmarks.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) mercurial/branchmap.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) - mercurial/bundle2.py: invalid syntax: invalid syntax (, line *) (glob) + mercurial/bundle2.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) mercurial/bundlerepo.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) mercurial/byterange.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) mercurial/changegroup.py: error importing: str expected, not bytes (error at encoding.py:*) (glob) @@ -141,7 +141,7 @@ mercurial/pushkey.py: error importing: getattr(): attribute name must be string (error at pycompat.py:*) (glob) mercurial/pvec.py: error importing: getattr(): attribute name must be string (error at pycompat.py:*) (glob) mercurial/registrar.py: error importing: getattr(): attribute name must be string (error at util.py:*) (glob) - mercurial/repair.py: error importing module: invalid syntax (bundle2.py, line *) (line *) (glob) + mercurial/repair.py: error importing: getattr(): attribute name must be string (error at util.py:*) (glob) mercurial/repoview.py: error importing: getattr(): attribute name must be string (error at util.py:*) (glob) mercurial/revlog.py: error importing: getattr(): attribute name must be string (error at util.py:*) (glob) mercurial/revset.py: error importing: getattr(): attribute name must be string (error at util.py:*) (glob) @@ -168,6 +168,6 @@ mercurial/verify.py: error importing: attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob) mercurial/win32.py: error importing module: No module named 'msvcrt' (line *) (glob) mercurial/windows.py: error importing module: No module named '_winreg' (line *) (glob) - mercurial/wireproto.py: error importing module: invalid syntax (bundle2.py, line *) (line *) (glob) + mercurial/wireproto.py: error importing module: a bytes-like object is required, not 'str' (line *) (glob) #endif