Patchwork py3: do not convert rust module/attribute names to bytes

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 17, 2019, 12:02 p.m.
Message ID <302e4706ab25b4d29d85.1566043338@mimosa>
Download mbox | patch
Permalink /patch/41322/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 17, 2019, 12:02 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1566005104 -32400
#      Sat Aug 17 10:25:04 2019 +0900
# Node ID 302e4706ab25b4d29d858f93ca2678a609e95570
# Parent  a3c360094c93509ee013ed7f4b7807c74b2d60a4
py3: do not convert rust module/attribute names to bytes

policy.import*() functions expect system strings.
Pulkit Goyal - Aug. 17, 2019, 1:23 p.m.
On Sat, Aug 17, 2019 at 3:09 PM Yuya Nishihara <yuya@tcha.org> wrote:
>
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1566005104 -32400
> #      Sat Aug 17 10:25:04 2019 +0900
> # Node ID 302e4706ab25b4d29d858f93ca2678a609e95570
> # Parent  a3c360094c93509ee013ed7f4b7807c74b2d60a4
> py3: do not convert rust module/attribute names to bytes
>
> policy.import*() functions expect system strings.

Queued this, many thanks!

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -25,7 +25,7 @@  from .utils import (
     stringutil,
 )
 
-rustmod = policy.importrust('filepatterns')
+rustmod = policy.importrust(r'filepatterns')
 
 allpatternkinds = ('re', 'glob', 'path', 'relglob', 'relpath', 'relre',
                    'rootglob',
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -270,8 +270,8 @@  class partialdiscovery(object):
                 sample.update(takefrom[:more])
         return sample
 
-partialdiscovery = policy.importrust('discovery',
-                                     member='PartialDiscovery',
+partialdiscovery = policy.importrust(r'discovery',
+                                     member=r'PartialDiscovery',
                                      default=partialdiscovery)
 
 def findcommonheads(ui, local, remote,
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -53,7 +53,7 @@  from .utils import (
     stringutil,
 )
 
-rustdirs = policy.importrust('dirstate', 'Dirs')
+rustdirs = policy.importrust(r'dirstate', r'Dirs')
 
 base85 = policy.importmod(r'base85')
 osutil = policy.importmod(r'osutil')