A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-May/147823.html below:

[Python-Dev] Guarantee the success of some object creation C API functions

[Python-Dev] Guarantee the success of some object creation C API functionsSerhiy Storchaka storchaka at gmail.com
Mon May 1 05:50:22 EDT 2017
I want to add promises to public C API functions that create trivial
instances of immutable basic types (integers 0 and 1, empty tuple,
string and bytes object) -- PyLong_FromLong(0), PyLong_FromLong(1),
PyTuple_New(0), PyUnicode_FromStringAndSize(NULL, 0),
PyUnicode_FromString(""), PyBytes_FromStringAndSize(NULL, 0),
PyBytes_FromString("") -- that they always succeed and never return
NULL. Currently they always or almost always succeed, but this is an
implementation detail. I want to make this promise official and more
strong, so that it is true even at very early stage of the interpreter
intitalization and at very late stage of the finalization. Also I want
to add private references to singletons that represent these values
(_PyLong_Zero, _PyTuple_Empty, etc) similar to Py_None and Py_True.
This could make some code clearer. For example see [1] and [2].

These promises add limitations for future changes of the interpreter,
but the official promise decreases the probability of unintentional
changes that break implicit properties.

Do I have the right to give such promises? Are there any reasons that
might prevent their implementation?

[1] https://bugs.python.org/issue29878
[2] https://bugs.python.org/issue30162
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4