D3587: pathencode: fix importing hashlib on Python 3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sat May 19 00:51:54 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
I'm curious why PyImport_Import is returning NULL, but
PyImport_ImportModule bypasses some of the regular import path,
probably including demandimport, which I suspect is the issue here.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3587
AFFECTED FILES
mercurial/cext/pathencode.c
CHANGE DETAILS
diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -660,7 +660,7 @@
if (name == NULL)
return -1;
- hashlib = PyImport_Import(name);
+ hashlib = PyImport_ImportModule("hashlib");
Py_DECREF(name);
if (hashlib == NULL) {
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list