Python gc.DEBUG_LEAK Examples
The following are 15
code examples of gc.DEBUG_LEAK().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gc
, or try the search function
.
Example #1
Source File: startup.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 6 votes |
def argp_add_default_args(parser, default_root=''): """ Add standard arguments to a new :py:class:`argparse.ArgumentParser` instance. Used to add the utilities argparse options to the wrapper for display. :param parser: The parser to add arguments to. :type parser: :py:class:`argparse.ArgumentParser` :param str default_root: The default root logger to specify. """ parser.add_argument('-v', '--version', action='version', version=parser.prog + ' Version: ' + version.version) log_group = parser.add_argument_group('logging options') log_group.add_argument('-L', '--log', dest='loglvl', type=str.upper, choices=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL'), help='set the logging level') log_group.add_argument('--logger', default=default_root, help='specify the root logger') gc_group = parser.add_argument_group('garbage collector options') gc_group.add_argument('--gc-debug-leak', action='store_const', const=gc.DEBUG_LEAK, default=0, help='set the DEBUG_LEAK flag') gc_group.add_argument('--gc-debug-stats', action='store_const', const=gc.DEBUG_STATS, default=0, help='set the DEBUG_STATS flag') return parser
Example #2
Source File: test_gc.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #3
Source File: test_gc.py From BinderFilter with MIT License | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #4
Source File: test_gc.py From oss-ftp with MIT License | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #5
Source File: test_gc.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests, GCCallbackTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print("restoring automatic collection") # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #6
Source File: test_gc.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests, GCCallbackTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print("restoring automatic collection") # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #7
Source File: test_gc.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #8
Source File: test_gc.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_main(): enabled = gc.isenabled() gc.disable() assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests, GCCallbackTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print("restoring automatic collection") # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #9
Source File: test_gc.py From medicare-demo with Apache License 2.0 | 6 votes |
def test(): if verbose: print "disabling automatic collection" enabled = gc.isenabled() gc.disable() verify(not gc.isenabled()) debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: test_all() finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() verify(gc.isenabled()) if not enabled: gc.disable()
Example #10
Source File: test_gc.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_main(): enabled = gc.isenabled() try: gc.disable() assert not gc.isenabled() except NotImplementedError: pass debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #11
Source File: test_gc.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_main(): enabled = gc.isenabled() try: gc.disable() assert not gc.isenabled() except NotImplementedError: pass debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: gc.collect() # Delete 2nd generation garbage run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default if verbose: print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() assert gc.isenabled() if not enabled: gc.disable()
Example #12
Source File: test_gc.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_debug_stats(self): self.assertEqual(1,gc.DEBUG_STATS) self.assertEqual(2,gc.DEBUG_COLLECTABLE) self.assertEqual(4,gc.DEBUG_UNCOLLECTABLE) self.assertEqual(8,gc.DEBUG_INSTANCES) self.assertEqual(16,gc.DEBUG_OBJECTS) self.assertEqual(32,gc.DEBUG_SAVEALL) self.assertEqual(62,gc.DEBUG_LEAK)
Example #13
Source File: test_gc.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_get_debug(self): state = [0,gc.DEBUG_STATS,gc.DEBUG_COLLECTABLE,gc.DEBUG_UNCOLLECTABLE,gc.DEBUG_INSTANCES,gc.DEBUG_OBJECTS,gc.DEBUG_SAVEALL,gc.DEBUG_LEAK] result = gc.get_debug() if result not in state: self.fail("Returned value of getdebug method is not valid value:" + str(result))
Example #14
Source File: test_gc.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_debug_stats(self): self.assertEqual(1,gc.DEBUG_STATS) self.assertEqual(2,gc.DEBUG_COLLECTABLE) self.assertEqual(4,gc.DEBUG_UNCOLLECTABLE) self.assertEqual(32,gc.DEBUG_SAVEALL) self.assertEqual(38,gc.DEBUG_LEAK)
Example #15
Source File: test_gc.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_get_debug(self): state = [0,gc.DEBUG_STATS,gc.DEBUG_COLLECTABLE,gc.DEBUG_UNCOLLECTABLE,gc.DEBUG_SAVEALL,gc.DEBUG_LEAK] result = gc.get_debug() if result not in state: self.fail("Returned value of getdebug method is not valid value:" + str(result))