Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DumpError: strings must be utf-8 decodable #843

Open
jaraco opened this issue Nov 13, 2022 · 2 comments
Open

DumpError: strings must be utf-8 decodable #843

jaraco opened this issue Nov 13, 2022 · 2 comments

Comments

@jaraco
Copy link

jaraco commented Nov 13, 2022

In pypa/distutils#183, I've stumbled onto an issue with xdist. In that issue, distutils/setuptools are moving from a stdout-based logging system to the Python logging framework. As a result, the quiet() context, which suppresses writes to sys.stdout no longer has the effect of suppressing logs.

One of the things that setuptools is logging is a filename containing surrogate escapes. It logs the name so the user can identify which filename was failing.

With pytest-xdist, however, the test fails with an INTERNALERROR in gateway_base.

A minimal test is to run pytest -n auto on the following:

def test_log_non_utf8():
    __import__('logging').getLogger().warn(
        'föö'.encode('latin-1').decode('utf-8', errors='surrogateescape')
    )
    __import__('pytest').fail('failing to emit messages')

That test seems legitimate and capturing behavior that provides value to the user. The issue doesn't occur without pytest-xdist.

My instinct is that pytest-xdist shouldn't be putting constraints on the allowed outputs for logging. Can something be done to be more lenient about legitimate non-encodeable values being passed? If the encoding is only an internal implementation detail between worker and supervisor, it should serialize any strings in a way that they're deserialized with fidelity to the original.

jaraco added a commit to pypa/setuptools that referenced this issue Nov 13, 2022
@RonnyPfannschmidt
Copy link
Member

xdist uses stdout/stdin as communication channels both locally and via ssh, currently there is no way to work around that

@RonnyPfannschmidt
Copy link
Member

i think we need to move this issue to execnet, as the real issue is about its serializer

clrpackages pushed a commit to clearlinux-pkgs/pypi-setuptools that referenced this issue Nov 22, 2022
…version 65.6.0

Anderson Bravalheri (6):
      Fix misspelling in docs/userguide/development_mode.rst
      Highlight in docs: 'attr' directive needs MANIFEST.in config / SCM plugin
      Ensure pyproject.toml accepts UTF-8 in maintainers
      Minor stylistic change
      Minor stylistic change
      Minor stylistic change

Jason R. Coombs (39):
      Remove docstring in distutils
      Prefer partition for splitting a string.
      Remove readme
      Prefer relative imports for better portability.
      No need to save 'threshold' on the instance.
      Use monkeypatch to set log and threshold.
      Extract fixture for capturing logs in _util modules.
      Expand 'logs' fixture to support features needed by LoggingSilencer.
      Consolidate fixture for capturing logs. Removes LoggingSilencer.
      Prefer capsys to test.support.captured*
      Fix broken test
      Prefer caplog to mocking the logging interface.
      GHA pretty env (#67)
      or maybe not
      Remove setting of dll_libraries in Mingw32CCompiler. One call superseded the other, and the result was redundant with what happens in the parent call.
      Short circuit when MSC version is not found.
      Prefer partition to find.
      Work with ints uniformally.
      Replace if/else with a lookup.
      Move lookup out of the function
      Prefer regex search to string manipulation.
      Use RangeMap to define the ranges in one place.
      Use try/except when assigning msc_ver.
      👹 Feed the hobgoblins (delint).
      Re-paste RangeMap with newlines restored (unsure what made them disappear).
      Pin pytest to <7.2. Workaround for pypa/distutils#186.
      In TempdirManager, use pathlib and more_itertools to more simply write the text.
      Rewrite init/for/append loop as comprehension and if/else as tertiary statement.
      Pin mypy to '<0.990' due to realpython/pytest-mypy#141
      Remove the hyperlink for the Python versions badge. The PyPI badge is a better anchor for the hyperlink.
      Apply explicit_package_bases for mypy and unpin the version. Ref python/mypy#14057.
      Replace bespoke logging facility with logging module, available since Python 2.3.
      Avoid use of the distutils.log module.
      Log to the root logger, as that's the one Setuptools patches/validates.
      ⚫ Fade to black.
      Skip test under xdist as it fails after migrating to Python logging. Ref pypa/distutils#183. Workaround for pytest/pytest-xdist#843.
      Skip an additional test under xdist. Ref pypa/distutils#183. Expanded workaround for pytest-dev/pytest-xdist#843.
      Update changelog.
      Bump version: 65.5.1 → 65.6.0

Sviatoslav Sydorenko (8):
      Make the `check` job a central gate in the CI
      Allow skipping `integration-test` unconditionally
      Upload accurate coverage flags from unit tests job
      Use job id as a coverage flag
      Report coverage from Cygwin jobs
      Explicitly point Codecov at `coverage.xml`
      Use an absolute path for codecov uploads
      Add a test for maintainers w/ international emails

Zach Burnett (1):
      rename `.readthedocs.yml` to `.readthedocs.yaml` (RTD docs indicate that `.readthedocs.yml` will be deprecated) (#68)

shripadbadithe (1):
      Fix typo in docs/userguide/development_mode.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants