Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Feb 13, 2024

When starting a new release, the release manager has to manually edit some docs files to bump version numbers:

            'Doc/tutorial/interpreter.rst',
            'Doc/tutorial/stdlib.rst',
            'Doc/tutorial/stdlib2.rst',

Similar to the technique in #115024, we can use substitutions to replace a couple of these.

Also bump some missed 3.12 -> 3.13.


📚 Documentation preview 📚: https://cpython-previews--115416.org.readthedocs.build/

@hugovk hugovk changed the title Docs: Use substitutions instead of manual updates for versions Docs: Use substitutions instead of manual version updates Feb 13, 2024
@hugovk
Copy link
Member Author

hugovk commented Feb 13, 2024

I don't think we can use substitutions to replace the others?

Doc/tutorial/interpreter.rst

.. code-block:: text

   python3.13
.. code-block:: shell-session

   $ python3.13
   Python 3.13 (default, April 4 2023, 09:25:04)
   [GCC 10.2.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>>

Doc/tutorial/stdlib.rst

   >>> import os
   >>> os.getcwd()      # Return the current working directory
   'C:\\Python313'
   >>> os.chdir('/server/accesslogs')   # Change current working directory
   >>> os.system('mkdir today')   # Run the command mkdir in the system shell
   0

Doc/tutorial/stdlib2.rst

   >>> import weakref, gc
   >>> class A:
   ...     def __init__(self, value):
   ...         self.value = value
   ...     def __repr__(self):
   ...         return str(self.value)
   ...
   >>> a = A(10)                   # create a reference
   >>> d = weakref.WeakValueDictionary()
   >>> d['primary'] = a            # does not create a reference
   >>> d['primary']                # fetch the object if it is still alive
   10
   >>> del a                       # remove the one reference
   >>> gc.collect()                # run garbage collection right away
   0
   >>> d['primary']                # entry was automatically removed
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
       d['primary']                # entry was automatically removed
     File "C:/python313/lib/weakref.py", line 46, in __getitem__
       o = self.data[key]()
   KeyError: 'primary'

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Substitutions FTW

@hugovk hugovk merged commit 46245b0 into python:main Feb 14, 2024
@hugovk hugovk deleted the docs-auto-version branch February 14, 2024 06:55
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants