Skip to content

Commit 21821b7

Browse files
committed
[GR-16894] Remove 'object.__getattr__'.
PullRequest: graalpython/891
2 parents 8b242d5 + b5c9ef0 commit 21821b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+349
-361
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_property.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -88,6 +88,13 @@ def prop_x(self, ax):
8888
X.prop_x.fset(self, ax)
8989

9090

91+
ERROR_FROM_GETTER = "ERROR FROM GETTER"
92+
class Z:
93+
@property
94+
def prop_x(self):
95+
raise AttributeError(ERROR_FROM_GETTER)
96+
97+
9198
def test_properties():
9299
c = C(10)
93100
assert c.prop_x == 10
@@ -114,3 +121,11 @@ def test_properties():
114121
assert not_found
115122

116123
assert X.prop_x is not Y.prop_x
124+
125+
126+
def test_property_error():
127+
try:
128+
Z().prop_x
129+
except BaseException as e:
130+
assert isinstance(e, AttributeError), "did not get AttributeError, was %s" % type(e)
131+
assert str(e) == ERROR_FROM_GETTER, "did not get expected error message; was %s" % str(e)

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport02.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport02'> SourceSection: [0,28]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport03.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport03'> SourceSection: [0,30]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport04.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport04'> SourceSection: [0,31]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport05.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport05'> SourceSection: [0,42]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: my_dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport06.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport06'> SourceSection: [0,44]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: my_dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport07.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ModuleRootNode Name: <module 'fromImport07'> SourceSection: [0,45]`from sys.path
1616
WriteNameNodeGen SourceSection: None
1717
Identifier: my_dirname
1818
EmptyNode SourceSection: None
19-
LookupAndCallBinaryNodeGen SourceSection: None
20-
Op: __getattribute__
21-
LookupAndCallBinaryNodeGen SourceSection: None
22-
Op: __getattr__
19+
GetAnyAttributeNodeGen SourceSection: None
20+
LookupAndCallBinaryNodeGen SourceSection: None
21+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport08.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ModuleRootNode Name: <module 'fromImport08'> SourceSection: [0,38]`from sys.path
1919
WriteNameNodeGen SourceSection: None
2020
Identifier: basename
2121
EmptyNode SourceSection: None
22-
LookupAndCallBinaryNodeGen SourceSection: None
23-
Op: __getattribute__
24-
LookupAndCallBinaryNodeGen SourceSection: None
25-
Op: __getattr__
22+
GetAnyAttributeNodeGen SourceSection: None
23+
LookupAndCallBinaryNodeGen SourceSection: None
24+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport09.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ModuleRootNode Name: <module 'fromImport09'> SourceSection: [0,40]`from sys.path
1919
WriteNameNodeGen SourceSection: None
2020
Identifier: basename
2121
EmptyNode SourceSection: None
22-
LookupAndCallBinaryNodeGen SourceSection: None
23-
Op: __getattribute__
24-
LookupAndCallBinaryNodeGen SourceSection: None
25-
Op: __getattr__
22+
GetAnyAttributeNodeGen SourceSection: None
23+
LookupAndCallBinaryNodeGen SourceSection: None
24+
Op: __getattribute__

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ImportTests/fromImport10.tast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ModuleRootNode Name: <module 'fromImport10'> SourceSection: [0,41]`from sys.path
1919
WriteNameNodeGen SourceSection: None
2020
Identifier: basename
2121
EmptyNode SourceSection: None
22-
LookupAndCallBinaryNodeGen SourceSection: None
23-
Op: __getattribute__
24-
LookupAndCallBinaryNodeGen SourceSection: None
25-
Op: __getattr__
22+
GetAnyAttributeNodeGen SourceSection: None
23+
LookupAndCallBinaryNodeGen SourceSection: None
24+
Op: __getattribute__

0 commit comments

Comments
 (0)