test_win32api.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:CodeReader 作者: jasonrbr 项目源码 文件源码
def test1(self):
        # This used to leave a stale exception behind.
        def reg_operation():
            hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, self.key_name)
            x = 3/0 # or a statement like: raise 'error'
        # do the test
        try:
            try:
                try:
                    reg_operation()
                except:
                    1/0 # Force exception
            finally:
                win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER, self.key_name)
        except ZeroDivisionError:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号