~ubuntu-branches/debian/sid/pylint/sid

« back to all changes in this revision

Viewing changes to test/input/func_break_or_return_in_try_finally.py

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-03-28 12:57:48 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100328125748-fblfc09naepbjhnx
Tags: 0.20.0-1
* New upstream release
  - thanks to Michael Richters for the report; Closes: #475939
* debian/copyright
  - updated upstream and packaging copyright years
* debian/control
  - bump Depends on python-logilab-common to '>= 0.49.0'
  - bump Depends on python-logilab-astng to '>= 0.20.0'
  - bump Standards-Version to 3.8.4 (no changes needed)
  - dropped XB-Python-Version
  - added python-logilab-common to b-d-i to have 'pytest' available
  - added python-logilab-astng to b-d-i, needed to run tests
* debian/rules
  - also delete *.pyo files (generated by tests running with -OO)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'Exeptions may be silently swallowed'
 
2
 
 
3
__revision__ = None
 
4
 
 
5
def insidious_break_and_return():
 
6
    """I found you !"""
 
7
    for i in range(0, -5, -1):
 
8
        my_var = 0
 
9
        print i
 
10
        try:
 
11
            my_var += 1.0/i
 
12
            if i < -3:
 
13
                break # :D
 
14
            else:
 
15
                return my_var # :D
 
16
        finally:
 
17
            if i > -2:
 
18
                break # :(
 
19
            else:
 
20
                return my_var # :(
 
21
    return None
 
22
 
 
23
def break_and_return():
 
24
    """I found you !"""
 
25
    for i in range(0, -5, -1):
 
26
        my_var = 0
 
27
        if i:
 
28
            break # :D
 
29
        try:
 
30
            my_var += 1.0/i
 
31
        finally:
 
32
            for i in xrange(2):
 
33
                if True:
 
34
                    break # :D
 
35
            else:
 
36
                def strange():
 
37
                    """why not ?"""
 
38
                    if True:
 
39
                        return my_var # :D
 
40
                strange()
 
41
        if i:
 
42
            break # :D
 
43
        else:
 
44
            return # :D