Skip to content

Race condition in pathlib on 3.14t #139001

@Liam-DeVoe

Description

@Liam-DeVoe

Bug report

Bug description:

(First noticed here and again here).

path.is_dir() seems to have a race condition under the free-threading build of 3.14:

E           and: '/home/runner/work/pytest-run-parallel/pytest-run-parallel/.tox/3.14t/lib/python3.14t/site-packages/hypothesis/database.py:455: in fetch'
E           and: '    if not kp.is_dir():'
E           and: '           ^^^^^^^^^^^'
E           and: '/opt/hostedtoolcache/Python/3.14.0-rc.2/x64-freethreaded/lib/python3.14t/pathlib/__init__.py:684: in is_dir'
E           and: '    return os.path.isdir(self)'
E           and: '           ^^^^^^^^^^^^^^^^^^^'
E           and: '<frozen genericpath>:51: in isdir'
E           and: '    ???'
E           and: '/opt/hostedtoolcache/Python/3.14.0-rc.2/x64-freethreaded/lib/python3.14t/pathlib/__init__.py:191: in __fspath__'
E           and: '    return str(self)'
E           and: '           ^^^^^^^^^'
E           and: '/opt/hostedtoolcache/Python/3.14.0-rc.2/x64-freethreaded/lib/python3.14t/pathlib/__init__.py:257: in __str__'
E           and: '    self._str = self._format_parsed_parts(self.drive, self.root,'
E           and: '                                          ^^^^^^^^^^'
E           and: '/opt/hostedtoolcache/Python/3.14.0-rc.2/x64-freethreaded/lib/python3.14t/pathlib/__init__.py:352: in drive'
E           and: '    self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path)'
E           and: '                                                                ^^^^^^^^^^^^^^'
E           and: '_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
E           and: ''
E           and: "self = PosixPath('/home/runner/work/pytest-run-parallel/pytest-run-parallel/.hypothesis/examples/f4ec64430b7f30d4')"
E           and: ''
E           and: '    @property'
E           and: '    def _raw_path(self):'
E           and: '        paths = self._raw_paths'
E           and: '        if len(paths) == 1:'
E           and: '            return paths[0]'
E           and: '        elif paths:'
E           and: '            # Join path segments from the initializer.'
E           and: '>           path = self.parser.join(*paths)'
E           and: '                   ^^^^^^^^^^^^^^^^^^^^^^^^'
E           and: "E           TypeError: join() missing 1 required positional argument: 'a'"

I can only reproduce this on 3.14t, not 3.14. Full CI logs: https://github.com/Liam-DeVoe/pytest-run-parallel/actions/runs/17775999693/job/50523739550?pr=2.

I don't have an isolated reproduction, but the CI here can be run to produce this error every ~20 iterations, if that's helpful: Liam-DeVoe/pytest-run-parallel#2.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-free-threadingtopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions