Skip to content

sandbox/_mounter: Remove default mutable arguments stderr/out

Benjamin Schubert requested to merge bschubert/fix-mutable-args into master

Description

stderr and stdout were passed as default arguments and would therefore retain the first value they had when the module was imported, which means they wouldn't get overriden by the pytest capture of stderr/out.

This also meant that depending how the mounter was imported, if the stdout/err was patched at that moment, and the file closed, we would get an error.

The bug can be reproduced by running: tox -e pyXX -- tests/integration/cmake.py on master, and seeing that it is now fixed.

https://gitlab.com/BuildStream/buildstream/-/jobs/278968753 is an example of the problem

Changes proposed in this merge request:

  • Don't use sys.stderr and sys.stdout as default arguments

Merge request reports