Skip to content

Sphinx 7.2.0 problems with pathlib.Path instead of string paths #11605

@tronical

Description

@tronical

Describe the bug

When using breathe with the 7.2.0 release, we get this error:

      File "/Users/simon/.local/share/virtualenvs/docs-SEK-9aTg/lib/python3.11/site-packages/breathe/project.py", line 116, in __init__
        self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))
                                                  ^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'PosixPath' object has no attribute 'rstrip'
    The full traceback has been saved in /var/folders/x6/97fjm0c540s7yn9zlv7fp9k00000gn/T/sphinx-err-sbf8ny4n.log, if you want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error message can be provided next time.
    A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

I suspect that breathe relied on doctreedir being a string, and now it's a PosixPath.

If you believe that this is in error and that breathe should be changed instead to not rely on this, let me know and I'll file an issue there :)

How to Reproduce

$ echo "Test" > index.rst
$ echo "extensions = ['breathe']" > conf.py
$ sphinx-build -M html . _build
Running Sphinx v7.2.0

Exception occurred:
  File "/Users/simon/.local/share/virtualenvs/fob-HUh8Hd7H/lib/python3.11/site-packages/breathe/project.py", line 116, in __init__
    self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))
                                              ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'rstrip'
The full traceback has been saved in /var/folders/x6/97fjm0c540s7yn9zlv7fp9k00000gn/T/sphinx-err-0d2v5eaa.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Environment Information

Platform:              darwin; (macOS-13.5-x86_64-i386-64bit)
Python version:        3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)])
Python implementation: CPython
Sphinx version:        7.2.0
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.16.1

Sphinx extensions

['breathe']

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions