Patchwork D11732: compat: don't rely on cpython-specific builtins manipulation

login
register
mail settings
Submitter phabricator
Date Nov. 3, 2021, 11:37 a.m.
Message ID <differential-rev-PHID-DREV-7kkg2ies3xosunfrsfkn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50057/
State Superseded
Headers show

Comments

phabricator - Nov. 3, 2021, 11:37 a.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pierre Augier signaled on the mailing list that this fails on Pypy and pointed
  out the correct solution.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -44,6 +44,7 @@ 
     FileNotFoundError = OSError
 
 else:
+    import builtins
     import concurrent.futures as futures
     import http.cookiejar as cookielib
     import http.client as httplib
@@ -55,7 +56,7 @@ 
     def future_set_exception_info(f, exc_info):
         f.set_exception(exc_info[0])
 
-    FileNotFoundError = __builtins__['FileNotFoundError']
+    FileNotFoundError = builtins.FileNotFoundError
 
 
 def identity(a):