Issue1597
Created on 2007-12-11 23:41 by gvanrossum, last changed 2007-12-12 20:33 by theller. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg58476 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2007-12-11 23:41 | |
In debug mode, on my Ubuntu Linux box, this fails on the last iteration: $ ./python Lib/test/regrtest.py -R:20 test_ctypes test_ctypes beginning 25 repetitions 1234567890123456789012345 ........................test test_ctypes failed -- Traceback (most recent call last): File "/usr/local/google/home/guido/python/py3kd/Lib/ctypes/test/test_values.py", line 18, in test_an_integer self.failUnlessEqual(x*2, ctdll.get_an_integer()) AssertionError: 2818572288 != -1476395008 1 test failed: test_ctypes [104230 refs] $ Also, when using -R:19, I get some random leaks reported of 33 or -33 references leaked. Does this test use threads? It seems to have a race condition. |
|||
msg58503 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2007-12-12 17:46 | |
Thanks! (I agree with Eric Smith that this is mysterious for the innocent bystander.) Also, what about the -33/+33 leaks? I suppose these are harmless, but it would be better if the test reliably didn't report leaks... |
|||
msg58505 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2007-12-12 20:11 | |
Guido van Rossum schrieb: > Thanks! (I agree with Eric Smith that this is mysterious for the > innocent bystander.) I have added a comment. > Also, what about the -33/+33 leaks? I suppose these are harmless, but > it would be better if the test reliably didn't report leaks... I am using my own definition of leaking: a test is leaking if references grow without bounds ;-). Ok, I found that the test in charge is Lib/ctypes/test/test_loading.py, LoaderTest.test_find. This test uses the ctypes.util.find_library function, which contains several calls to os.popen(...).read(). The minimal code reporting the -33/+33 leaks that I found is simply this: os.popen('ls').read() Is there a problem in "os.popen(...)", or do I something wrong here? |
|||
msg58506 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2007-12-12 20:26 | |
> The minimal code reporting the -33/+33 leaks that I found is simply this: > > os.popen('ls').read() > > Is there a problem in "os.popen(...)", or do I something wrong here? Try this instead: p = os.popen('ls') try: x = p.read() finally: p.close() IOW close the pipe explicitly. That should make the code execute in a more reproducible fashion. I've fixed this in ctypes/util.py now: r59477. |
|||
msg58507 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2007-12-12 20:33 | |
> more reproducible fashion. I've fixed this in ctypes/util.py now: > r59477. Cool! And the 'leak' is gone. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2007-12-12 20:33:51 | theller | set | messages: + msg58507 |
2007-12-12 20:26:14 | gvanrossum | set | messages: + msg58506 |
2007-12-12 20:11:39 | theller | set | messages: + msg58505 |
2007-12-12 17:46:44 | gvanrossum | set | status: open -> closed resolution: fixed messages: + msg58503 |
2007-12-11 23:41:07 | gvanrossum | create |