You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
regrtest: capture stdout (-W) option is incompatible with refleak hunter (-R) #71290
The -R option of regrtest replaces sys.stdout with a io.StringIO object. Problem: the refleak are hunted after stdout is replaced, and so each print() increaes the total reference counter which is seen as a leak.
Example:
$ cat Lib/test/test_noop.py
"noop"
$ ./python -u -m test -R 3:3 -W test_noop
Run tests sequentially
0:00:00 [1/1] test_noop
Ran 0 tests in 0.000s
OK
beginning 6 repetitions
123456
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
.
(...)
test_noop leaked [9, 9, 9] references, sum=27
test_noop failed
1 test failed:
test_noop
Total duration: 0:00:01
Activity
vstinner commentedon May 24, 2016
The -R option of regrtest replaces sys.stdout with a io.StringIO object. Problem: the refleak are hunted after stdout is replaced, and so each print() increaes the total reference counter which is seen as a leak.
Example:
Ran 0 tests in 0.000s
OK
beginning 6 repetitions
123456
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
.
(...)
test_noop leaked [9, 9, 9] references, sum=27
test_noop failed
1 test failed:
test_noop
Total duration: 0:00:01
vstinner commentedon May 18, 2017
New changeset fcdd9b6 by Victor Stinner in branch 'master':
bpo-27103: regrtest disables -W if -R is used (bpo-1651)
fcdd9b6
vstinner commentedon May 18, 2017
It seems like Python 2.7 is not affected.
I will apply my workaround to 3.5, 3.6 and master, since Zachary created a buildbot testing 2.7, 3.5, 3.6 and master branches.
vstinner commentedon May 18, 2017
New changeset 2773add by Victor Stinner in branch '3.6':
bpo-27103: regrtest disables -W if -R is used (bpo-1651) (bpo-1656)
2773add
vstinner commentedon May 19, 2017
New changeset 9503dd1 by Victor Stinner in branch '3.5':
bpo-27103: regrtest disables -W if -R is used (bpo-1660)
9503dd1
vstinner commentedon Jun 28, 2017
While the root issue is not fixed, at least -W doesn't cause issues anymore with -R, so I consider that the "bug" was fixed ;-)