New submission from Bohuslav "Slavek" Kabrda:

When Python is compiled with COUNT_ALLOCS, some tests in test_gc and 
test_module fail. I'm attaching the patch that skips 3 of them and modifies 
assertions in one of them, so that the tests pass.

I'm however still unsure about one of the skipped tests, since I'm unsure 
whether I totally understand what's wrong there - 
test_gc_ordinary_module_at_shutdown.

My guess is that due to COUNT_ALLOCS causing immortal types, the "final_a" and 
"final_b" types don't get destroyed on line [1] as they do in builds without 
COUNT_ALLOCS. AFAICS they are only "un-immortalized" on this line and destroyed 
during the following loop [2]. The problem here is that the order of destroyed 
modules is not deterministic, so sometimes the builtins module gets destroyed 
before the "final_X" and there is no "print" function, which makes the __del__ 
functions from "final_X" fail. IMO the best thing to do is to just skip this 
test with COUNT_ALLOCS. But I may be wrong, I don't have a great insight into 
Python's GC and module unloading.


[1] http://hg.python.org/cpython/annotate/0f48843652b1/Python/import.c#l383
[2] http://hg.python.org/cpython/annotate/0f48843652b1/Python/import.c#l394

----------
messages: 202414
nosy: bkabrda
priority: normal
severity: normal
status: open
title: Test failures with COUNT_ALLOCS
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19527>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to