Patchwork D12599: doc: use an absolute path in sys.path to work around a python DLL loading bug

login
register
mail settings
Submitter phabricator
Date May 3, 2022, 2:07 a.m.
Message ID <differential-rev-PHID-DREV-3bziyj4wu2th5f3dqeze-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50948/
State New
Headers show

Comments

phabricator - May 3, 2022, 2:07 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This bug[1] was causing the zstd entry under "Available Compression Engines" to
  be omitted from the documentation for some versions of python3.  I could
  upgrade, but past upgrades have broken venvs and clobbered installed packages.
  It's a trivial workaround, so there's no sense in leaving this subtle issue.  It
  was flushed out by changing the module policy here from 'allow' to 'c', and
  seeing this error:
  
    ImportError: DLL load failed while importing parsers: The parameter is incorrect.
  
  [1] https://github.com/python/cpython/issues/87271

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS




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

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -21,7 +21,7 @@ 
 # available. Relax C module requirements.
 os.environ['HGMODULEPOLICY'] = 'allow'
 # import from the live mercurial repo
-sys.path.insert(0, "..")
+sys.path.insert(0, os.path.abspath(".."))
 from mercurial import demandimport
 
 demandimport.enable()