[issue26767] Inconsistant error messages for failed attribute modification

2019-12-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Not all error messages contain an attribute name, an object type name and a 
reason.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26767] Inconsistant error messages for failed attribute modification

2019-12-20 Thread Batuhan


Batuhan  added the comment:

> I think it would be nice to unify error messages and make them more specific.

How can they can be more specific when they are unified?

--
nosy: +BTaskaya
versions: +Python 3.9 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26767] Inconsistant error messages for failed attribute modification

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26767] Inconsistant error messages for failed attribute modification

2016-04-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
priority: normal -> low

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26767] Inconsistant error messages for failed attribute modification

2016-04-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

>>> class I(int):
... @property
... def a(self): pass
... @property
... def b(self): pass
... @b.setter
... def b(self, value): pass
... @property
... def c(self): pass
... @c.deleter
... def c(self): pass
... 
>>> obj = I()
>>> del obj.numerator
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> del obj.to_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: to_bytes
>>> del obj.from_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: from_bytes
>>> del obj.a
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't delete attribute
>>> del obj.b
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't delete attribute
>>> del obj.y
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: y
>>> obj.numerator = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> obj.a = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't set attribute
>>> obj.c = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't set attribute
>>> 
>>> obj = 1
>>> del obj.numerator
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> del obj.to_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'to_bytes' is read-only
>>> del obj.from_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'from_bytes' is read-only
>>> del obj.y
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object has no attribute 'y'
>>> obj.numerator = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> obj.to_bytes = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'to_bytes' is read-only
>>> obj.from_bytes = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'from_bytes' is read-only
>>> obj.y = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object has no attribute 'y'

Different error messages are used in errors when try to modify non-existing or 
read-only attribute. This depends on the existing __dict__ and the way how the 
attribute is resolved.

* just the attribute name
* "'%.50s' object has no attribute '%U'"
* "'%.50s' object attribute '%U' is read-only"
* "attribute '%V' of '%.100s' objects is not writable"

I think it would be nice to unify error messages and make them more specific.

--
components: Interpreter Core
messages: 263464
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Inconsistant error messages for failed attribute modification
type: enhancement
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com