compat: don't rely on cpython-specific builtins manipulation
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 03 Nov 2021 12:35:57 +0100
changeset 48298 6ffcaba7d122
parent 48297 9ebc10ad4a04
child 48299 1a420a13eeea
compat: don't rely on cpython-specific builtins manipulation Pierre Augier signaled on the mailing list that this fails on Pypy and pointed out the correct solution. Differential Revision: https://phab.mercurial-scm.org/D11732
mercurial/pycompat.py
--- a/mercurial/pycompat.py	Wed Nov 03 17:06:01 2021 +0100
+++ b/mercurial/pycompat.py	Wed Nov 03 12:35:57 2021 +0100
@@ -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):