summaryrefslogtreecommitdiff
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42451: Indicate that PyTuple_GetItem does not support negative indices ↵Yasser A2020-11-301-1/+1
| | | | (GH-23529)
* bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441)Serhiy Storchaka2020-11-221-4/+4
|
* bpo-42412: Fix possible leaks and check arguments in ↵Serhiy Storchaka2020-11-211-2/+4
| | | | | | | | PyType_FromModuleAndSpec() (GH-23410) * There were leaks if Py_tp_bases is used more than once or if some call is failed before setting tp_bases. * There was a crash if the bases argument or the Py_tp_bases slot is not a tuple. * The documentation was not accurate.
* bpo-42085: Add documentation for Py_TPFLAGS_HAVE_AM_SEND (GH-23374)Vladimir Matveev2020-11-181-0/+8
| | | | | Updated docs to include `Py_TPFLAGS_HAVE_AM_SEND`. News section should not be necessary. Automerge-Triggered-By: GH:asvetlov
* bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)Victor Stinner2020-11-181-6/+2
| | | | | | | | | This change partically reverts commit ad3252bad905d41635bcbb4b76db30d570cf0087 and the commit fe2978b3b940fe2478335e3a2ca5ad22338cdf9c. Many third party C extension modules rely on the ability of using Py_TYPE() to set an object type: "Py_TYPE(obj) = type;" or to set an object type using: "Py_SIZE(obj) = size;".
* bpo-41832: Restore note about NULL in PyType_Slot.pfunc (GH-23243)Hai Shi2020-11-141-0/+2
|
* bpo-42294: Grammar fixes in doc glossary strong/weak refs (GH-23227)kj2020-11-111-1/+1
|
* bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931)Hai Shi2020-11-101-2/+4
| | | | | | | PyType_GetSlot() can now accept static types. Co-Authored-By: Petr Viktorin <encukou@gmail.com> Automerge-Triggered-By: GH:encukou
* bpo-42260: Fix _PyConfig_Read() if compute_path_config=0 (GH-23220)Victor Stinner2020-11-102-17/+57
| | | | | | | | | | | | | | | | | | | Fix _PyConfig_Read() if compute_path_config=0: use values set by Py_SetPath(), Py_SetPythonHome() and Py_SetProgramName(). Add compute_path_config parameter to _PyConfig_InitPathConfig(). The following functions now return NULL if called before Py_Initialize(): * Py_GetExecPrefix() * Py_GetPath() * Py_GetPrefix() * Py_GetProgramFullPath() * Py_GetProgramName() * Py_GetPythonHome() These functions no longer automatically computes the Python Path Configuration. Moreover, Py_SetPath() no longer computes program_full_path.
* bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values ↵Vladimir Matveev2020-11-101-0/+16
| | | | (#22780)
* bpo-42171: Add PEP573-related items to the limited API (GH-23009)Petr Viktorin2020-11-101-2/+4
|
* bpo-42294: Add borrowed/strong reference to doc glossary (GH-23206)Victor Stinner2020-11-098-20/+39
| | | | | | Add "borrowed reference" and "strong reference" to the documentation glossary. Enhance also Py_INCREF() and Py_NewRef() documentation.
* bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)Hai Shi2020-11-061-2/+4
|
* bpo-42260: PyConfig_Read() only parses argv once (GH-23168)Victor Stinner2020-11-051-92/+104
| | | | | | | | | | | | The PyConfig_Read() function now only parses PyConfig.argv arguments once: PyConfig.parse_argv is set to 2 after arguments are parsed. Since Python arguments are strippped from PyConfig.argv, parsing arguments twice would parse the application options as Python options. * Rework the PyConfig documentation. * Fix _testinternalcapi.set_config() error handling. * SetConfigTests no longer needs parse_argv=0 when restoring the old configuration.
* bpo-42262: Add Py_NewRef() and Py_XNewRef() (GH-23152)Victor Stinner2020-11-051-0/+31
| | | | Added Py_NewRef() and Py_XNewRef() functions to increment the reference count of an object and return the object.
* bpo-42260: Add _PyInterpreterState_SetConfig() (GH-23158)Victor Stinner2020-11-051-0/+2
| | | | | | | | * Inline _PyInterpreterState_SetConfig(): replace it with _PyConfig_Copy(). * Add _PyErr_SetFromPyStatus() * Add _PyInterpreterState_GetConfigCopy() * Add a new _PyInterpreterState_SetConfig() function. * Add an unit which gets, modifies, and sets the config.
* bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)Victor Stinner2020-11-041-14/+90
| | | | | Added PyModule_AddObjectRef() function: similar to PyModule_AddObjectRef() but don't steal a reference to the value on success.
* bpo-42236: Enhance init and encoding documentation (GH-23109)Victor Stinner2020-11-026-183/+521
| | | | | | | | | | | | | | | | | | | | | Enhance the documentation of the Python startup, filesystem encoding and error handling, locale encoding. Add a new "Python UTF-8 Mode" section. * Add "locale encoding" and "filesystem encoding and error handler" to the glossary * Remove documentation from Include/cpython/initconfig.h: move it to Doc/c-api/init_config.rst. * Doc/c-api/init_config.rst: * Document command line options and environment variables * Document default values. * Add a new "Python UTF-8 Mode" section in Doc/library/os.rst. * Add warnings to Py_DecodeLocale() and Py_EncodeLocale() docs. * Document how Python selects the filesystem encoding and error handler at a single place: PyConfig.filesystem_encoding and PyConfig.filesystem_errors. * PyConfig: move orig_argv member at the right place.
* bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086)Victor Stinner2020-11-011-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the nl_langinfo(CODESET) function returns an empty string, Python now uses UTF-8 as the filesystem encoding. In May 2010 (commit b744ba1d14c5487576c95d0311e357b707600b47), I modified Python to log a warning and use UTF-8 as the filesystem encoding (instead of None) if nl_langinfo(CODESET) returns an empty string. In August 2020 (commit 94908bbc1503df830d1d615e7b57744ae1b41079), I modified Python startup to fail with a fatal error and a specific error message if nl_langinfo(CODESET) returns an empty string. The intent was to prevent guessing the encoding and also investigate user configuration where this case happens. In 10 years (2010 to 2020), I saw zero user report about the error message related to nl_langinfo(CODESET) returning an empty string. Today, UTF-8 became the defacto standard and it's safe to make the assumption that the user expects UTF-8. For example, nl_langinfo(CODESET) can return an empty string on macOS if the LC_CTYPE locale is not supported, and UTF-8 is the default encoding on macOS. While this change is likely to not affect anyone in practice, it should make UTF-8 lover happy ;-) Rewrite also the documentation explaining how Python selects the filesystem encoding and error handler.
* bpo-41192: Add documentation of undocumented audit events (GH-21308)Saiyang Gou2020-10-201-0/+2
|
* bpo-41784: make PyUnicode_AsUTF8AndSize part of the limited API (GH-22252)Alex Gaynor2020-10-191-0/+3
|
* bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677)Vladimir Matveev2020-10-131-0/+4
|
* Delete PyGen_Send (#22663)Vladimir Matveev2020-10-121-10/+0
|
* Fix .. code-block :: directives in decimal.rst (GH-22571)Anthony Sottile2020-10-111-3/+3
|
* bpo-41756: Add PyIter_Send function (#22443)Vladimir Matveev2020-10-092-5/+14
|
* bpo-41802: Document 'PyDict_DelItem' can raise a 'KeyError' (GH-22291)Campbell Barton2020-10-021-4/+6
|
* bpo-41842: Add codecs.unregister() function (GH-22360)Hai Shi2020-09-281-0/+8
| | | | Add codecs.unregister() and PyCodec_Unregister() functions to unregister a codec search function.
* bpo-30155: Add macros to get tzinfo from datetime instances (GH-21633)Zackery Spytz2020-09-231-0/+11
| | | | Add PyDateTime_DATE_GET_TZINFO() and PyDateTime_TIME_GET_TZINFO() macros.
* bpo-41756: Introduce PyGen_Send C API (GH-22196)Vladimir Matveev2020-09-181-0/+15
| | | | | | | | | | | | | The new API allows to efficiently send values into native generators and coroutines avoiding use of StopIteration exceptions to signal returns. ceval loop now uses this method instead of the old "private" _PyGen_Send C API. This translates to 1.6x increased performance of 'await' calls in micro-benchmarks. Aside from CPython core improvements, this new API will also allow Cython to generate more efficient code, benefiting high-performance IO libraries like uvloop.
* Note the buffer slots can be set with PyType_Spec with the unlimited API. ↵Benjamin Peterson2020-09-011-1/+10
| | | | | (GH-22031) Follow up to f7c4e236429606e1c982cacf24e10fc86ef4462f.
* bpo-38787: Clarify docs for PyType_GetModule and warn against common mistake ↵Petr Viktorin2020-08-271-1/+11
| | | | (GH-20215)
* bpo-40204, doc: Fix syntax of C variables (GH-21846)Victor Stinner2020-08-1318-103/+103
| | | | | | | | | | | | | | | For example, fix the following Sphinx 3 errors: Doc/c-api/buffer.rst:102: WARNING: Error in declarator or parameters Invalid C declaration: Expected identifier in nested name. [error at 5] void \*obj -----^ Doc/c-api/arg.rst:130: WARNING: Unparseable C cross-reference: 'PyObject*' Invalid C declaration: Expected end of definition. [error at 8] PyObject* --------^ The modified documentation is compatible with Sphinx 2 and Sphinx 3.
* bpo-40204: Fix duplicates in the documentation (GH-21857)Victor Stinner2020-08-132-26/+13
| | | | | | | | | Fix two Sphinx 3 issues: Doc/c-api/buffer.rst:304: WARNING: Duplicate C declaration, also defined in 'c-api/buffer'. Declaration is 'PyBUF_ND'. Doc/c-api/unicode.rst:1603: WARNING: Duplicate C declaration, also defined in 'c-api/unicode'. Declaration is 'PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)'.
* bpo-41324 Add a minimal decimal capsule API (#21519)Stefan Krah2020-08-102-0/+232
|
* bpo-41098: Doc: Add missing deprecated directives (GH-21162)Inada Naoki2020-08-071-0/+10
| | | | PyUnicodeEncodeError_Create has been deprecated with `Py_DEPRECATED` macro. But it was not documented.
* bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)Inada Naoki2020-08-051-9/+30
| | | See PEP 623 for detail.
* bpo-41211: Doc: Fix PyLong_FromUnicodeObject (GH-21325)Inada Naoki2020-07-051-3/+1
| | | It doesn't use PyUnicode_EncodeDecimal. It uses a private API instead.
* Doc: Minor fix to init config C API documentation (GH-21198)tomerv2020-07-011-2/+2
| | | Co-authored-by: Tomer Vromen <tomer.vromen@intel.com>
* bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)Inada Naoki2020-06-301-14/+0
|
* bpo-23427: Add sys.orig_argv attribute (GH-20729)Victor Stinner2020-06-301-0/+21
| | | | | | | Add sys.orig_argv attribute: the list of the original command line arguments passed to the Python executable. Rename also PyConfig._orig_argv to PyConfig.orig_argv and document it.
* bpo-41123: Remove PyLong_FromUnicode() (GH-21204)Inada Naoki2020-06-291-11/+0
|
* bpo-41103: Remove old buffer protocol support (#21117)Inada Naoki2020-06-262-56/+0
| | | They are deprecated since Python 3.0.
* bpo-40943: PY_SSIZE_T_CLEAN required for '#' formats (GH-20784)Victor Stinner2020-06-191-19/+17
| | | | | | | The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() "#" formats: "es#", "et#", "s#", "u#", "y#", "z#", "U#" and "Z#". See the PEP 353. Update _testcapi.test_buildvalue_issue38913().
* bpo-36020: Require vsnprintf() to build Python (GH-20899)Victor Stinner2020-06-161-7/+3
| | | | | | | | The C99 functions snprintf() and vsnprintf() are now required to build Python. PyOS_snprintf() and PyOS_vsnprintf() no longer call Py_FatalError(). Previously, they called Py_FatalError() on a buffer overflow on platforms which don't provide vsnprintf().
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-111-10/+0
| | | This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
* bpo-40854: PYTHONPLATLIBDIR env var added to 3.9 (GH-20735)Victor Stinner2020-06-081-1/+1
|
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721)Victor Stinner2020-06-081-0/+9
| | | | | | | | | | | | Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv().
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Sandro Mani2020-06-081-0/+9
| | | | (GH-20605)
* bpo-40839: PyDict_GetItem() requires the GIL (GH-20580)Victor Stinner2020-06-021-0/+4
| | | | Calling PyDict_GetItem() without GIL held had been allowed for historical reason. It is no longer allowed.
* bpo-40792: Make the result of PyNumber_Index() always having exact type int. ↵Serhiy Storchaka2020-05-281-0/+4
| | | | | | | | | | | | (GH-20443) Previously, the result could have been an instance of a subclass of int. Also revert bpo-26202 and make attributes start, stop and step of the range object having exact type int. Add private function _PyNumber_Index() which preserves the old behavior of PyNumber_Index() for performance to use it in the conversion functions like PyLong_AsLong().