Skip to content

Crash when there a "._xxx.pth" on macOS #113356

Closed
@ronaldoussoren

Description

@ronaldoussoren

Bug report

Bug description:

See https://discuss.python.org/t/venv-not-function-properly-in-macos-within-an-exfat-disk/26145 for the original report.

MacOS creates "._" files with additional metadata when there is metadata (such as extended attributes) that the filesystem doesn't support natively.

To reproduce (I did this on macOS 13 to match the forum message, likely also happens on 14):

  1. Create a disk image with the exFAT format and mount this

  2. Create a virtual environment on this volume and active this

  3. Install setup tools (which ships with a PTH file name distutils-precedence.pth)

  4. Use the "Get Info" context menu in the finder for the PTH file and add a note to the metadata

    There should now be a ._distutils-precedence.pth file

    Alternatively: use xattr -w name value distutils-precedence.pth to write an extended attribute.

  5. Start "python"
    This should fail with a UnicodeDecodeError in site.py

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Labels

OS-mactype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions