Issue 1512942: Improves an error message from setattr (original) (raw)
Issue1512942
This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/43556
classification
Title: | Improves an error message from setattr | ||
---|---|---|---|
Type: | Stage: | ||
Components: | Interpreter Core | Versions: | Python 2.5 |
process
Status: | closed | Resolution: | rejected |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | arigo, belopolsky, collinwinter | |
Priority: | low | Keywords: | patch |
Created on 2006-06-26 19:47 by belopolsky, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
object-setattr.patch | belopolsky,2006-06-26 19:47 | Diff against svn revision 47103 |
Messages (4) | ||
---|---|---|
msg50530 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2006-06-26 19:47 |
Fixes Bugs item #1506776 | ||
msg50531 - (view) | Author: Armin Rigo (arigo) * ![]() |
Date: 2006-06-28 10:36 |
Logged In: YES user_id=4771 The error message can still be wrong. For example, in the following situation: class X(object): __slots__ = ['a'] X().b = 5 Then the original message -- no attribute 'b' -- was correct. With this patch Python now wrongly tells you that 'X' object has only read-only attributes. | ||
msg50532 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2006-06-29 18:07 |
Logged In: YES user_id=835142 I did not think of the that case. It looks like there is no easy way to distinguish the slots and no slots case in PyObject_GenericSetAttr. I think the proper fix will involve not filling tp_setattro with PyObject_GenericSetAttr in the presence of slots, but use a function that is optimized for that case. Can anyone suggest a simpler fix? | ||
msg50533 - (view) | Author: Collin Winter (collinwinter) * ![]() |
Date: 2007-03-09 03:30 |
Since no-one has been able to come up with a simple fix or a better error message, and since the referenced bug report was closed eight months ago, I'm closing this patch, too. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:18 | admin | set | github: 43556 |
2006-06-26 19:47:07 | belopolsky | create |