当前位置: 首页>>代码示例>>Python>>正文


Python gc.DEBUG_LEAK属性代码示例

本文整理汇总了Python中gc.DEBUG_LEAK属性的典型用法代码示例。如果您正苦于以下问题:Python gc.DEBUG_LEAK属性的具体用法?Python gc.DEBUG_LEAK怎么用?Python gc.DEBUG_LEAK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gc的用法示例。


在下文中一共展示了gc.DEBUG_LEAK属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: argp_add_default_args

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:22,代码来源:startup.py

示例2: test_main

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:test_gc.py

示例3: test_main

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:22,代码来源:test_gc.py

示例4: test

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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() 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:23,代码来源:test_gc.py

示例5: test_main

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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() 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:25,代码来源:test_gc.py

示例6: test_debug_stats

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_gc.py

示例7: test_get_debug

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:test_gc.py

示例8: test_debug_stats

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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) 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:8,代码来源:test_gc.py

示例9: test_get_debug

# 需要导入模块: import gc [as 别名]
# 或者: from gc import DEBUG_LEAK [as 别名]
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)) 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:7,代码来源:test_gc.py


注:本文中的gc.DEBUG_LEAK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。