[issue39620] PyObject_GetAttrString and tp_getattr do not agree

2021-06-22 Thread Petr Viktorin
Change by Petr Viktorin : -- nosy: +petr.viktorin ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39620] PyObject_GetAttrString and tp_getattr do not agree

2020-02-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was reverted because it is backward incompatible change. It breaks a code which assigns to the tp_getattr field without explicit type cast to getattrfunc. -- nosy: +serhiy.storchaka ___ Python tracker

[issue39620] PyObject_GetAttrString and tp_getattr do not agree

2020-02-12 Thread Andy Lester
Andy Lester added the comment: Do you know why it was reverted? (Granted, it was 15 years ago...) It looks like the original changeset is trying to address at least two different problems with non-const string literals. My ticket here is focusing only on getattrfunc and setattrfunc. The

[issue39620] PyObject_GetAttrString and tp_getattr do not agree

2020-02-12 Thread Ammar Askar
Ammar Askar added the comment: Note that there was an earlier attempt to make it const https://github.com/python/cpython/commit/af68c874a6803b4e90b616077a602c0593719a1d but this was reverted as part of https://github.com/python/cpython/commit/15e62742fad688b026ba80bf17d1345c4cbd423b

[issue39620] PyObject_GetAttrString and tp_getattr do not agree

2020-02-12 Thread Andy Lester
New submission from Andy Lester : PyObject_GetAttrString(PyObject *v, const char *name) typedef PyObject *(*getattrfunc)(PyObject *, char *) The outer PyObject_GetAttrString takes a const char *name, but then casts away the const when calling the underlying tp_getattr. This means that an