Patchwork D8272: archive: fix crash when archiving to gzip file with Python 3.8.2+

login
register
mail settings
Submitter phabricator
Date March 10, 2020, 8:21 p.m.
Message ID <differential-rev-PHID-DREV-nwoyvx2qyuzv3atccow7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45676/
State Superseded
Headers show

Comments

phabricator - March 10, 2020, 8:21 p.m.
ludovicchabant created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8272

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS




To: ludovicchabant, #hg-reviewers
Cc: mercurial-devel
phabricator - March 10, 2020, 8:22 p.m.
ludovicchabant added a comment.


  It does seem brittle to me to override some Python internal method anyway? Can we get rid of this altogether?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8272/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8272

To: ludovicchabant, #hg-reviewers
Cc: mercurial-devel
phabricator - March 11, 2020, 1:42 a.m.
marmoute added a comment.


  In D8272#123252 <https://phab.mercurial-scm.org/D8272#123252>, @ludovicchabant wrote:
  
  > The `_write_gzip_header` function is now getting passed the compression level in the latest Python release.
  > It does seem brittle to me to override some Python internal method anyway? Can we get rid of this altogether?
  
  F500229: indeed.gif <https://phab.mercurial-scm.org/F500229>
  
  https://www.mercurial-scm.org/repo/hg-committed/rev/b7ca03dff14c

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8272/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8272

To: ludovicchabant, #hg-reviewers
Cc: marmoute, mercurial-devel

Patch

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -146,7 +146,7 @@ 
                 self.timestamp = timestamp
             gzip.GzipFile.__init__(self, *args, **kw)
 
-        def _write_gzip_header(self):
+        def _write_gzip_header(self, *args, **kwargs):
             self.fileobj.write(b'\037\213')  # magic header
             self.fileobj.write(b'\010')  # compression method
             fname = self.name