Patchwork [STABLE] sslutil: fsencode path returned by certifi (issue6132)

login
register
mail settings
Submitter Augie Fackler
Date May 8, 2019, 8:13 p.m.
Message ID <ce5f1232631ffd86d283.1557346416@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/39986/
State Accepted
Headers show

Comments

Augie Fackler - May 8, 2019, 8:13 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1557346190 14400
#      Wed May 08 16:09:50 2019 -0400
# Branch stable
# Node ID ce5f1232631ffd86d283e0087cf29b19a5bb039a
# Parent  e45c6b153e5157be5518f671b22f99fbab52e792
sslutil: fsencode path returned by certifi (issue6132)

By inspection, this is the only codepath that could be returning a
string instead of a bytes on Python 3.
Yuya Nishihara - May 8, 2019, 11:02 p.m.
On Wed, 08 May 2019 16:13:36 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1557346190 14400
> #      Wed May 08 16:09:50 2019 -0400
> # Branch stable
> # Node ID ce5f1232631ffd86d283e0087cf29b19a5bb039a
> # Parent  e45c6b153e5157be5518f671b22f99fbab52e792
> sslutil: fsencode path returned by certifi (issue6132)

Queued for stable, thanks.

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -722,7 +722,7 @@  def _defaultcacerts(ui):
         certs = certifi.where()
         if os.path.exists(certs):
             ui.debug('using ca certificates from certifi\n')
-            return certs
+            return pycompat.fsencode(certs)
     except (ImportError, AttributeError):
         pass