summaryrefslogtreecommitdiffstats
path: root/Lib/filecmp.py
Commit message (Expand)AuthorAgeFilesLines
* Removed deprecated use_statcache argument.Raymond Hettinger2004-12-051-11/+2
* SF bug #453515: filecmp.dircmp case sensitivity bugRaymond Hettinger2003-09-021-6/+6
* Module review:Raymond Hettinger2003-02-271-47/+22
* Add DeprecationWarning when use_statcache argument is suppliedAndrew M. Kuchling2003-02-061-4/+12
* [Bug #680494] filecmp.py uses obsolete statcache module.Andrew M. Kuchling2003-02-061-17/+9
* Replaced .keys() with dictionary iteratorsRaymond Hettinger2002-06-021-6/+6
* Replaced obsolete stat module constants with equivalent attributesRaymond Hettinger2002-06-011-5/+5
* Convert a pile of obvious "yes/no" functions to return bool.Tim Peters2002-04-041-4/+4
* more __all__ updatesSkip Montanaro2001-01-201-0/+2
* Whitespace normalization.Tim Peters2001-01-141-3/+3
* Update the code to better reflect recommended style:Fred Drake2000-12-121-2/+3
* Call of _cmp had wrong number of paramereters.Moshe Zadka2000-12-031-2/+2
* cmpfiles(): Added shallow and use_statcache parameters, with same meaningsFred Drake2000-07-031-14/+13
* Whoops! We just discovered that Gordon's revamp of this module wasGuido van Rossum2000-06-291-49/+310
* Fredrik Lundh:Guido van Rossum2000-03-281-10/+21
* More trivial comment -> docstring transformations by Ka-Ping Yee,Guido van Rossum2000-02-041-299/+38
* # module filecmpGuido van Rossum2000-02-031-38/+299
* New module by Moshe Zadka (submitted on Sept. 25). This unifies theGuido van Rossum1999-10-261-0/+57
for i in range(NLOCKS)] if create_deadlock: NTHREADS = NLOCKS else: NTHREADS = NLOCKS - 1 barrier = threading.Barrier(NTHREADS) results = [] def _acquire(lock): """Try to acquire the lock. Return True on success, False on deadlock.""" try: lock.acquire() except DeadlockError: return False else: return True def f(): a, b = pairs.pop() ra = _acquire(a) barrier.wait() rb = _acquire(b) results.append((ra, rb)) if rb: b.release() if ra: a.release() lock_tests.Bunch(f, NTHREADS).wait_for_finished() self.assertEqual(len(results), NTHREADS) return results def test_deadlock(self): results = self.run_deadlock_avoidance_test(True) # One of the threads detected a potential deadlock on its second # acquire() call. self.assertEqual(results.count((True, False)), 1) self.assertEqual(results.count((True, True)), len(results) - 1) def test_no_deadlock(self): results = self.run_deadlock_avoidance_test(False) self.assertEqual(results.count((True, False)), 0) self.assertEqual(results.count((True, True)), len(results)) class LifetimeTests(unittest.TestCase): def test_lock_lifetime(self): name = "xyzzy" self.assertNotIn(name, _bootstrap._module_locks) lock = _bootstrap._get_module_lock(name) self.assertIn(name, _bootstrap._module_locks) wr = weakref.ref(lock) del lock support.gc_collect() self.assertNotIn(name, _bootstrap._module_locks) self.assertIsNone(wr()) def test_all_locks(self): support.gc_collect() self.assertEqual(0, len(_bootstrap._module_locks), _bootstrap._module_locks) @support.reap_threads def test_main(): support.run_unittest(ModuleLockAsRLockTests, DeadlockAvoidanceTests, LifetimeTests) if __name__ == '__main__': test_main()