sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Inconsistency while reporting attribute errors #97

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
[1]
x = 1
print(x.b)

[2]
x = None
print(x.b)

[3]
class A:
    pass
x = A()
print(x.b)

[4]
x = []
print(x.b)

[5]
x = {}
print(x.b)

What is the expected output? What do you see instead?
[1] Seen: Error: 'int' object has no attribute 'b'
    OK

[2] Seen: TypeError: x.__getattr__ is not a function
    Expected: Error: 'NoneType' object has no attribute 'b'

[3] Seen: Error: object has no attribute b
    Expected: Error: 'A' object has no attribute 'b'

[4] Seen: <built-in method b of list object>        ????
    Expected: Error: 'list' object has no attribute 'b'

[5] Seen: <built-in method b of dict object>        ????
    Expected: Error: 'dict' object has no attribute 'b'

What version of the product are you using? On what operating system?
version 1.1.20130309-192522 (r697)
Linux / Firefox 19.0.2

Original issue reported on code.google.com by pedro.ro...@gmail.com on 9 Mar 2013 at 9:45