Skip to content

ENH: use PYTHONWARNDEFAULTENCODING=1 to fix optional encoding warnings in Python 3.10+ #24115

@Zac-HD

Description

@Zac-HD

Under Python 3.11, though for some reason I haven't investigated not 3.10,

import numpy.testing

triggers the following EncodingWarning

$ python -X warn_default_encoding demo.py
numpy/testing/_private/utils.py:1251: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.run(cmd, capture_output=True, text=True)

It would be great if Numpy added this to CI and fixed however many errors that turns up; with Pytest 7.4.0 and later running clean it's now reasonably practical to do so.

You may want a two-stage approach where you fix all the current cases in Numpy first (like HypothesisWorks/hypothesis#3619), and then revisit enforcing it in CI once upstream projects have cleaned up their own warnings (like HypothesisWorks/hypothesis#3691, where I hit this issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    sprintableIssue fits the time-frame and setting of a sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions