mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
(cherry picked from commit 4fefae6a1d9fbc6df174d53222ceba9208691b65) GitOrigin-RevId: d6e65ace1378765be246fe09a86d2bff133855df
26 lines
367 B
Python
26 lines
367 B
Python
class A:
|
|
def __init__(self, z):
|
|
self.z = z
|
|
|
|
def foo(self, x):
|
|
y = 2 * x + self.z
|
|
return 1 + y
|
|
|
|
|
|
def zoo(x):
|
|
y = int((x - 2) / (x - 1))
|
|
|
|
return A(y)
|
|
|
|
print(zoo(2).foo(2))
|
|
|
|
try:
|
|
try:
|
|
print(zoo(1).foo(2)) #we got ZeroDivision here
|
|
finally:
|
|
print(zoo(0).foo(4))
|
|
except:
|
|
pass
|
|
|
|
a = zoo(-1)
|
|
print(a.foo(2)) |