On 2 December 2015 at 01:50, Serhiy Storchaka <storch...@gmail.com> wrote: > On 25.11.15 08:39, Nick Coghlan wrote: >> So it looks to me like replicating the NULL-handling behaviour of the >> slots in the public Set* APIs was intentional, and it's just the >> documentation of that detail that was missed (since most folks >> presumably use the Del* convenience APIs instead). > > I'm not sure. This looks rather as implementation detail to me. There cases > found by you are the only cases in the core/stdlib that call > PyObject_SetAttr with third argument is NULL. Tests are passed after > replacing Set* functions with Del* functions in these cases and making Set* > functions to reject value is NULL. [1]
Which means at the very least, folks relying on the current behaviour are relying on untested functionality, and would be better of switching to the tested APIs regardless of what happens on the deprecation front. > Wouldn't be worth to deprecate deleting with Set* functions? Neither other > abstract Set* APIs, not concrete Set* APIs don't support deleting. Deleting > with Set* API can be unintentional and hide a bug. Since the behaviour is currently neither documented not tested, and it doesn't raise any new Python 2/3 migation issues, I don't personally mind deprecating the "delete via set" APIs for 3.6 - as you say, having "set this field/attribute to this value" occasionally mean "delete this field/attribute" if a pointer is NULL offers a surprising second way to do something that already has a more explicit spelling. Regards, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com