Staging
v0.5.1
https://github.com/python/cpython
Revision 4d0c1170ef1eb0d0acbbcc6da0fa5a7c6cba4a10 authored by Amaury Forgeot d'Arc on 02 April 2008, 00:25:14 UTC, committed by Amaury Forgeot d'Arc on 02 April 2008, 00:25:14 UTC
When cls is an ABCMeta, every call to isinstance(x, cls)
records type(x) in the cls._abc_cache of cls_abc_negative_cache.
So we clear these caches at the end of the test.

inspect.isabstract() is not the correct test for all ABCs, because there is no @abstractmethod in io.py (why?)
isinstance(cls, ABCMeta) would be more exact, but it fails with an infinite recursion.
So I used a hack to determine whether a class is an ABCMeta.

The true correction would be to turn cls._abc_cache &co into a WeakSet, as py3k does.
But classic classes are not weak referenceable...

Of course, this change should not be merged into the py3k branch.
1 parent b1ba750
History
Tip revision: 4d0c1170ef1eb0d0acbbcc6da0fa5a7c6cba4a10 authored by Amaury Forgeot d'Arc on 02 April 2008, 00:25:14 UTC
Correct the apparent refleak in test_io:
Tip revision: 4d0c117
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.hgtags -rw-r--r-- 3.3 KB
LICENSE -rw-r--r-- 13.4 KB
Makefile.pre.in -rw-r--r-- 36.7 KB
README -rw-r--r-- 55.0 KB
configure -rwxr-xr-x 642.5 KB
configure.in -rw-r--r-- 98.1 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 28.5 KB
setup.py -rw-r--r-- 73.9 KB

README

back to top