Menu

#366 Docutils circular dependency-fails to import

closed-fixed
nobody
None
5
2020-03-03
2019-07-22
No

I'm not 100% sure how this is possible, but as of the 0.15 release yesterday, docutils is broken (in my codebase) due to a circular dependency.

Minimal example:

# this works:
from docutils import utils
from docutils import nodes

# However, this does not
from docutils import nodes

This is due to a circular dependency introduced in version 0.15: docutils.nodes is dependent on docutils.utils which is in turn dependent on docutils.nodes. Depending on the import order your code uses, it could explode at runtime.

Related

Bugs: #459

Discussion

  • Peter

    Peter - 2019-07-23

    Looks like this is breaking tools calling docutil too, e.g. https://bugs.launchpad.net/doc8/+bug/1837515 (fails on Python 2.7 but worked on Python 3 - possibly with some other package version differences)

     
  • engelbert gruber

    fixable: by putting import docutils.utilsinto the function astext

    would be release 0.15.1 then

     
  • Gabriel Albacarys

    Friend of mine pointed out to me that this seems to only break in 2.7.x, he tried in 3.6 and the import seemed to work.

     
  • Günter Milde

    Günter Milde - 2019-07-23
    • status: open --> closed-fixed
     
  • Günter Milde

    Günter Milde - 2019-07-23

    Fixed in [r8294] (by moving the definition of unescape() to nodes).
    Thank you for reporting.

     

    Related

    Commit: [r8294]


Log in to post a comment.