On Wed, 19 Jun 2013 17:49:02 +0200 Victor Stinner <victor.stin...@gmail.com> wrote:
> 2013/6/19 Antoine Pitrou <solip...@pitrou.net>: > > On Wed, 19 Jun 2013 17:24:21 +0200 > >> >> Drawback: the caller has to check if the result is 0, or handle the > >> >> error. > >> > > >> > Or you can just call Py_FatalError() if the domain is invalid. > >> > >> I don't like Py_FatalError(), especially when Python is embedded. It's > >> safer to return -1 and expect the caller to check for the error case. > > > > I don't think you need to check for errors. The domain is always one of > > the existing constants, i.e. it should be hard-coded in the source, not > > computed. > > Imagine that PyMem_GetBlockAllocator() is part of the stable ABI and > that a new domain is added to Python 3.5. An application is written > for Python 3.5 and is run with Python 3.4: how would the application > notice that PyMem_GetBlockAllocator() does not know the new domain? That's a good question. I don't know why guidelines Martin used when designing the stable ABI, but I would expect important high-level functions to end there, not memory allocation debugging. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com