/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/decorators.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
           ]
24
24
 
25
25
 
26
 
import sys
27
 
 
28
 
from bzrlib import trace
 
26
from . import trace
29
27
 
30
28
 
31
29
def _get_parameters(func):
105
103
    try:
106
104
        result = unbound(%(passed_params)s)
107
105
    except:
108
 
        import sys
109
 
        exc_info = sys.exc_info()
110
106
        try:
111
107
            self.unlock()
112
108
        finally:
113
 
            try:
114
 
                raise exc_info[0], exc_info[1], exc_info[2]
115
 
            finally:
116
 
                del exc_info
 
109
            raise
117
110
    else:
118
111
        self.unlock()
119
112
        return result
128
121
 
129
122
    scope = dict(defaults_dict)
130
123
    scope['unbound'] = unbound
131
 
    exec func_def in scope
 
124
    exec(func_def, scope)
132
125
    read_locked = scope['read_locked']
133
126
 
134
127
    read_locked.__doc__ = unbound.__doc__
154
147
        try:
155
148
            result = unbound(self, *args, **kwargs)
156
149
        except:
157
 
            import sys
158
 
            exc_info = sys.exc_info()
159
150
            try:
160
151
                self.unlock()
161
152
            finally:
162
 
                try:
163
 
                    raise exc_info[0], exc_info[1], exc_info[2]
164
 
                finally:
165
 
                    del exc_info
 
153
                raise
166
154
        else:
167
155
            self.unlock()
168
156
            return result
179
167
    try:
180
168
        result = unbound(%(passed_params)s)
181
169
    except:
182
 
        import sys
183
 
        exc_info = sys.exc_info()
184
170
        try:
185
171
            self.unlock()
186
172
        finally:
187
 
            try:
188
 
                raise exc_info[0], exc_info[1], exc_info[2]
189
 
            finally:
190
 
                del exc_info
 
173
            raise
191
174
    else:
192
175
        self.unlock()
193
176
        return result
202
185
 
203
186
    scope = dict(defaults_dict)
204
187
    scope['unbound'] = unbound
205
 
    exec func_def in scope
 
188
    exec(func_def, scope)
206
189
    write_locked = scope['write_locked']
207
190
 
208
191
    write_locked.__doc__ = unbound.__doc__
217
200
        try:
218
201
            result = unbound(self, *args, **kwargs)
219
202
        except:
220
 
            exc_info = sys.exc_info()
221
203
            try:
222
204
                self.unlock()
223
205
            finally:
224
 
                try:
225
 
                    raise exc_info[0], exc_info[1], exc_info[2]
226
 
                finally:
227
 
                    del exc_info
 
206
                raise
228
207
        else:
229
208
            self.unlock()
230
209
            return result
322
301
    69
323
302
 
324
303
    """
325
 
    if isinstance(attrname_or_fn, basestring):
 
304
    if isinstance(attrname_or_fn, str):
326
305
        attrname = attrname_or_fn
327
306
        return _CachedPropertyForAttr(attrname)
328
307
    else: