GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix sphinx deprecation warning about env.note_versionchange() by pablogsal · Pull Request #13236 · python/cpython

Conversation

@pablogsal

@pablogsal pablogsal commented May 10, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The warning:

/home/pablogsal/github/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead.
  env.note_versionchange('deprecated', version[0], node, self.lineno)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal pablogsal added skip issue skip news labels May 10, 2019
@pablogsal pablogsal self-assigned this May 10, 2019
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 10, 2019
@bedevere-bot bedevere-bot added the awaiting core review label May 10, 2019
@pablogsal pablogsal added the DO-NOT-MERGE label May 10, 2019
@pablogsal
Fix sphinx deprecation warning about env.note_versionchange()
6947483
@pablogsal pablogsal removed the DO-NOT-MERGE label May 10, 2019
@pablogsal
pablogsal force-pushed the sphinx_warning branch from 2d9f94d to 6947483 Compare May 10, 2019 18:50
@pablogsal
pablogsal merged commit 960bb88 into python:master May 10, 2019
@bedevere-bot bedevere-bot removed the awaiting core review label May 10, 2019
@pablogsal
pablogsal deleted the sphinx_warning branch May 10, 2019 21:58
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Dec 2, 2020
mcepl @bmwiedemann
Update python36 to version 3.6.12 / rev 4 via SR 852415
c38825c
https://build.opensuse.org/request/show/852415
by user mcepl + dimstar_suse
- Add CVE-2020-27619-no-eval-http-content.patch fixing
  CVE-2020-27619 (bsc#1178009), where Lib/test/multibytecodec_support
  calls eval() on content retrieved via HTTP.
- Add patch sphnix-update-removed-function.patch to no longer call
  a now removed function (gh#python/cpython#13236). As
  a consequence, no longer pin Sphinx version.
- Pin Sphinx version to fix doc subpackage
- Change setuptools and pip version numbers according to new wheels
- Add ignore_pip_deprec_warn.patch to switch of persistently
  failing test.
- Replace bundled wheels for pip and setuptools with the updated ones
  (bsc#1176262 CVE-2019-20916).
- Handful of changes to make python36 compatible with SLE15 and SLE12
  (jsc#ECO-2799, jsc#SLE-13738)
- Rebase bpo23395-PyErr_SetInterrupt-signal.patch
- Fix build with RP
@mcepl

mcepl commented Dec 5, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@pablogsal I think this is suboptimal solution, because it makes Python dependent on the latest version of Sphinx unnecessarily. It is very easy to make something like this:

--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -231,10 +231,14 @@ class DeprecatedRemoved(Directive):
                                    translatable=False)
             node.append(para)
         env = self.state.document.settings.env
-        env.note_versionchange('deprecated', version[0], node, self.lineno)
+        # new method
+        if hasattr(env, 'get_domain'):
+            env.get_domain('changeset').note_changeset(node)
+        # deprecated pre-Sphinx-2 method
+        else:
+            env.note_versionchange('deprecated', version[0], node, self.lineno)
         return [node] + messages
 
-
 # Support for including Misc/NEWS
 
 issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)')
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Dec 5, 2020

Copy link
Copy Markdown
Member Author

@pablogsal I think this is suboptimal solution, because it makes Python dependent on the latest version of Sphinx unnecessarily. It is very easy to make something like this:

--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -231,10 +231,14 @@ class DeprecatedRemoved(Directive):
                                    translatable=False)
             node.append(para)
         env = self.state.document.settings.env
-        env.note_versionchange('deprecated', version[0], node, self.lineno)
+        # new method
+        if hasattr(env, 'get_domain'):
+            env.get_domain('changeset').note_changeset(node)
+        # deprecated pre-Sphinx-2 method
+        else:
+            env.note_versionchange('deprecated', version[0], node, self.lineno)
         return [node] + messages
 
-
 # Support for including Misc/NEWS
 
 issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)')

Thanks for pointing that out! Would you like to submit a PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcepl mcepl mentioned this pull request Dec 5, 2020
bpo-42579: Make workaround for various versions of Sphinx more robust #23662
Merged
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Dec 7, 2020
mcepl @bmwiedemann
Update python36 to version 3.6.12 / rev 5 via SR 853314
407bdf7
https://build.opensuse.org/request/show/853314
by user mcepl + dimstar_suse
- (bsc#1179630) Update sphinx-update-removed-function.patch to
  work with all versions of Sphinx (not binding the Python
  documentation build to the latest verison of Sphinx). Updated
  version mentioned on gh#python/cpython#13236.
- Add CVE-2020-27619-no-eval-http-content.patch fixing
  CVE-2020-27619 (bsc#1178009), where Lib/test/multibytecodec_support
  calls eval() on content retrieved via HTTP.
- Add patch sphinx-update-removed-function.patch to no longer call
  a now removed function (gh#python/cpython#13236). As
  a consequence, no longer pin Sphinx version.
- Pin Sphinx version to fix doc subpackage
- Change setuptools and pip version numbers according to new wheels
- Add ignore_pip_deprec_warn.patch to switch of persistently
  failing test.
- Replace bundled wheels for pip and se
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Dec 7, 2020
mcepl @bmwiedemann
Update python39 to version 3.9.0 / rev 8 via SR 853313
e88bbbb
https://build.opensuse.org/request/show/853313
by user mcepl + dimstar_suse
- Add patch sphinx-update-removed-function.patch to no longer call
  a now removed function and to make documentation build independent of
  the Sphinx version (bsc#1179630, gh#python/cpython#13236).
pablogsal pushed a commit that referenced this pull request Dec 7, 2020
@mcepl
bpo-42579: Make workaround for various versions of Sphinx more robust (…
b63a620
…GH-23662)

The solution in gh##13236 is too strict because it
effectively requires the use of Sphinx >= 2.0. It is not too difficult to
make the same solution more robust so it works with all normal versions
of Sphinx.
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Dec 8, 2020
mcepl @bmwiedemann
Update python36 to version 3.6.12 / rev 5 via SR 853314
6057cc7
https://build.opensuse.org/request/show/853314
by user mcepl + dimstar_suse
- (bsc#1179630) Update sphinx-update-removed-function.patch to
  work with all versions of Sphinx (not binding the Python
  documentation build to the latest verison of Sphinx). Updated
  version mentioned on gh#python/cpython#13236.
- Add CVE-2020-27619-no-eval-http-content.patch fixing
  CVE-2020-27619 (bsc#1178009), where Lib/test/multibytecodec_support
  calls eval() on content retrieved via HTTP.
- Add patch sphinx-update-removed-function.patch to no longer call
  a now removed function (gh#python/cpython#13236). As
  a consequence, no longer pin Sphinx version.
- Pin Sphinx version to fix doc subpackage
- Change setuptools and pip version numbers according to new wheels
- Add ignore_pip_deprec_warn.patch to switch of persistently
  failing test.
- Replace bundled wheels for pip and se
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Dec 18, 2020
mcepl @bmwiedemann
Update python36 to version 3.6.12 / rev 8 via SR 856737
d9a18cf
https://build.opensuse.org/request/show/856737
by user mcepl + dimstar_suse
- Adjust sphinx-update-removed-function.patch
- (bsc#1179630) Update sphinx-update-removed-function.patch to
  work with all versions of Sphinx (not binding the Python
  documentation build to the latest verison of Sphinx). Updated
  version mentioned on gh#python/cpython#13236.
- Add CVE-2020-27619-no-eval-http-content.patch fixing
  CVE-2020-27619 (bsc#1178009), where Lib/test/multibytecodec_support
  calls eval() on content retrieved via HTTP.
- Add patch sphinx-update-removed-function.patch to no longer call
  a now removed function (gh#python/cpython#13236). As
  a consequence, no longer pin Sphinx version.
- Pin Sphinx version to fix doc subpackage
- Change setuptools and pip version numbers according to new
  wheels (bsc#1179756).
- Add ignore_pip_deprec_warn.patch to switch of persi
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
@mcepl @adorilson
bpo-42579: Make workaround for various versions of Sphinx more robust (…
40a3299
…pythonGH-23662)

The solution in gh#python#13236 is too strict because it
effectively requires the use of Sphinx >= 2.0. It is not too difficult to
make the same solution more robust so it works with all normal versions
of Sphinx.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@pablogsal pablogsal

Labels

skip issue skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@pablogsal @mcepl @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.