Skip to content

bpo-43651: Fix EncodingWarning in test_io #25097

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

Merged
merged 3 commits into from
Apr 1, 2021

Conversation

methane
Copy link
Member

@methane methane commented Mar 30, 2021

@methane
Copy link
Member Author

methane commented Mar 31, 2021

This PR can be simplified after #25103 is merged.

@methane
Copy link
Member Author

methane commented Mar 31, 2021

#25103 did not help OpenWrapper(). I don't think we should allow encoding="locale" in binmode only for test_io.

with self.open(os_helper.TESTFN, mode) as fp:
self.assertRaises(exc, fp.read)
self.assertRaises(exc, fp.readline)
with self.open(os_helper.TESTFN, "w", encoding="ascii") as fp:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to replace all "ascii" with "utf-8". Come on, ASCII is now legacy!

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@methane methane merged commit 58cffba into python:master Apr 1, 2021
@methane methane deleted the fix-encodingwarning-io branch April 1, 2021 02:25
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD Non-Debug 3.x has failed when building commit 58cffba.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/172/builds/124) and take a look at the build logs.
  4. Check if the failure is related to this commit (58cffba) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/172/builds/124

Failed tests:

  • test_asyncio

Failed subtests:

  • test_stdin_stdout - test.test_asyncio.test_subprocess.SubprocessMultiLoopWatcherTests
  • test_negative_lookahead - test.test_peg_generator.test_c_parser.TestCParser

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

406 tests OK.

10 slowest tests:

  • test_smtpnet: 6 min 6 sec
  • test_peg_generator: 4 min 44 sec
  • test_nntplib: 4 min 31 sec
  • test_concurrent_futures: 2 min 42 sec
  • test_asyncio: 2 min 16 sec
  • test_multiprocessing_forkserver: 2 min 5 sec
  • test_multiprocessing_spawn: 2 min 2 sec
  • test_urllib2: 2 min 1 sec
  • test_tokenize: 1 min 39 sec
  • test_unparse: 1 min 25 sec

1 test failed:
test_asyncio

20 tests skipped:
test_dbm_gnu test_devpoll test_epoll test_idle test_ioctl
test_msilib test_ossaudiodev test_readline test_spwd
test_startfile test_tcl test_tix test_tk test_ttk_guionly
test_ttk_textonly test_turtle test_winconsoleio test_winreg
test_winsound test_zipfile64

2 re-run tests:
test_asyncio test_peg_generator

Total duration: 18 min 28 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_asyncio/test_subprocess.py", line 126, in run
    exitcode = await proc.wait()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/subprocess.py", line 134, in wait
    return await self._transport._wait()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/base_subprocess.py", line 235, in _wait
    return await waiter
asyncio.exceptions.CancelledError


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_peg_generator/test_c_parser.py", line 160, in test_negative_lookahead
    self.run_test(grammar_source, test_source)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_peg_generator/test_c_parser.py", line 90, in run_test
    self.build_extension(grammar_source)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_peg_generator/test_c_parser.py", line 87, in build_extension
    generate_parser_c_extension(grammar, Path(self.tmp_path))
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Tools/peg_generator/pegen/testutil.py", line 104, in generate_parser_c_extension
    compile_c_extension(str(source), build_dir=str(path))
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Tools/peg_generator/pegen/build.py", line 93, in compile_c_extension
    cmd.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/command/build_ext.py", line 529, in build_extension
    objects = self.compiler.compile(sources,
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/cc' failed with exit code -9


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/unixccompiler.py", line 117, in _compile
    self.spawn(compiler_so + cc_args + [src, '-o', obj] +
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/ccompiler.py", line 910, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/distutils/spawn.py", line 87, in spawn
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/usr/bin/cc' failed with exit code -9


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_asyncio/test_subprocess.py", line 131, in test_stdin_stdout
    exitcode, stdout = self.loop.run_until_complete(task)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/tasks.py", line 460, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/tasks.py", line 458, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants