Skip to content

EncodingWarning raised on Py 3.11+ #950

@freakboy3742

Description

@freakboy3742

Python 3.10 introduced the -X warn_default_encoding option as part of PEP597. This option issues an EncodingWarning when a locale-specific default is encoding is used when opening files. This is a useful option to turn on (especially in test suites) if you interact with user-supplied files.

Python 3.11 modified setuptools.run() to make an encoding argument required if subprocess.run() is invoked in text mode. As of 8.0.3, setuptools_scm doesn't provide an encoding argument when invoking run, although there are other environmental hints that UTF-8 encoding should be used.

We encountered this in a test suite because we have -X warn_default_encoding enabled, and we also run pytest in "warnings-as-errors" mode. See [beeware/briefcase#1474] for the way this manifests.

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