# HG changeset patch # User Augie Fackler # Date 2018-05-19 00:42:04 # Node ID 92ac9cf78dba7765b39e32e1380bfa5e51a44ff5 # Parent c0f8fa74d8c2f4096ba5794e74efa5ea98a0b549 pathencode: fix importing hashlib on Python 3 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. Differential Revision: https://phab.mercurial-scm.org/D3587 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 @@ static int sha1hash(char hash[20], const if (name == NULL) return -1; - hashlib = PyImport_Import(name); + hashlib = PyImport_ImportModule("hashlib"); Py_DECREF(name); if (hashlib == NULL) {