Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn any environment unpickling error into IOError #4048

Merged
merged 1 commit into from Oct 21, 2017

Conversation

jdemeyer
Copy link
Contributor

@jdemeyer jdemeyer commented Sep 8, 2017

Subject: allow graceful upgrading Sphinx-1.5 -> Sphinx-1.6

Feature or Bugfix

  • Bugfix

Purpose

The scenario is:

  1. build some docs with Sphinx-1.5
  2. upgrade to Sphinx-1.6
  3. rebuild the same docs

This gives:

Traceback (most recent call last):
[...]
  File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sphinx/environment/__init__.py", line 112, in load
    env = pickle.load(f)
AttributeError: 'module' object has no attribute 'WarningStream'

A simple solution is: wrap the pickle.load(f) call in try/except and change any exception to IOError. That IOError is then caught higher up, which allows the documentation to build with a message like

loading pickled environment... failed: 'module' object has no attribute 'WarningStream'

More generally, this pickle is not crucial to building the documentation. Therefore, it should not be a hard error if this pickle is somehow corrupted.

Copy link
Contributor

@stephenfin stephenfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a sane fix to me. Good work.

@tk0miya tk0miya added this to the 1.6.5 milestone Oct 21, 2017
@tk0miya tk0miya merged commit 2f78acb into sphinx-doc:master Oct 21, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants