summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* bpo-11233: Create availability directive for documentation (GH-9692)Cheryl Sabella2018-10-122-8/+18
| | | | | | Replace "Availability: xxx" with ".. availability:: xxx" in the doc. Original patch by Georg Brandl. Co-Authored-By: Georg Brandl <georg@python.org>
* bpo-31370: Remove references to threadless builds (#8805)Zackery Spytz2018-09-291-8/+8
| | | Support for threadless builds was removed in a6a4dc81.
* bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)Yury Selivanov2018-09-211-10/+29
|
* Revert "bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)" (GH-9187)Victor Stinner2018-09-111-6/+0
| | | This reverts commit 886483e2b9bbabf60ab769683269b873381dd5ee.
* bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)Victor Stinner2018-09-071-0/+6
| | | | | | | | | * Add %T format to PyUnicode_FromFormatV(), and so to PyUnicode_FromFormat() and PyErr_Format(), to format an object type name: equivalent to "%s" with Py_TYPE(obj)->tp_name. * Replace Py_TYPE(obj)->tp_name with %T format in unicodeobject.c. * Add unit test on %T format. * Rename unicode_fromformat_write_cstr() to unicode_fromformat_write_utf8(), to make the intent more explicit.
* bpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)Victor Stinner2018-08-291-4/+11
| | | | | | | Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding on Windows if Py_LegacyWindowsFSEncodingFlag is zero. pymain_read_conf() now sets Py_LegacyWindowsFSEncodingFlag in its loop, but restore its value at exit.
* bpo-12743: Delete comment from marshal.rst (GH-8457)Berker Peksag2018-07-271-14/+10
| | | | | | Also, update the list of exceptions that may raised by PyMarshal_* functions. We usually don't document exceptions raised by a function, but in this case most of them were already documented in C API and standard library documentation.
* bpo-33892: Doc: Use gender neutral words (GH-7770)Andrés Delfino2018-06-181-1/+1
|
* bpo-17045: Improve C-API doc for PyTypeObject. (gh-7413)Eric Snow2018-06-141-129/+1175
| | | The existing doc had a number of info gaps and was a little hard to use. This patch provides several quick-reference tables as well as examples.
* bpo-33592: Document the C API in PEP 567 (contextvars) (GH-7033)Elvis Pranskevichus2018-05-222-1/+126
|
* bpo-5945: Improve mappings and sequences C API docs. (GH-7029)Serhiy Storchaka2018-05-224-68/+93
|
* bpo-33583: Add note in PyObject_GC_Resize() doc (GH-7021)INADA Naoki2018-05-211-1/+1
|
* Fix C API docs: PyCapsule_Import always set an exception on failure. (GH-6967)Serhiy Storchaka2018-05-181-2/+9
|
* bpo-33195: Doc: Deprecate Py_UNICODE in c-api/arg (GH-6329)INADA Naoki2018-04-041-5/+22
| | | | Py_UNICODE is deprecated since Python 3.3. But the deprecation is missed in the c-api/arg document.
* bpo-33126: Document PyBuffer_ToContiguous() (#6292)Antoine Pitrou2018-03-281-3/+9
|
* bpo-33042: Fix pre-initialization sys module configuration (GH-6157)Nick Coghlan2018-03-252-3/+15
| | | | | | | | | - new test case for pre-initialization of sys.warnoptions and sys._xoptions - restored ability to call these APIs prior to Py_Initialize - updated the docs for the affected APIs to make it clear they can be called before Py_Initialize - also enhanced the existing embedding test cases to check for expected settings in the sys module
* bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)Marcel Plch2018-03-171-3/+9
| | | | | Multi-phase initialized modules allow m_traverse to be called while the module is still being initialized, so module authors may need to account for that.
* bpo-32500: Correct the documentation for PySequence_Size() and ↵Zackery Spytz2018-02-201-3/+2
| | | | | PySequence_Length() (GH-5767) Dropped the part that says: "For objects that do not provide sequence protocol".
* Make formatting of some return codes conforming to the general style. (#5587)Serhiy Storchaka2018-02-093-13/+13
|
* bpo-20891: Py_Initialize() now creates the GIL (#4700)Victor Stinner2018-01-291-40/+23
| | | | The GIL is no longer created "on demand" to fix a race condition when PyGILState_Ensure() is called in a non-Python thread.
* Document the error return of PyLong_As* APIs. (#5396)Gregory P. Smith2018-01-291-0/+34
| | | | | | Document the error return of PyLong_As* APIs. A frequent Python C API usage error is neglecting to check the return value and/or PyErr_Occurred().
* Fix PyTrace_RETURN documentation (GH-5384)Xiang Zhang2018-01-281-1/+1
| | | It will be triggered when propagating an exception.
* bpo-32649: Add C API docs for per-opcode tracing & profiling (GH-5360)Xiang Zhang2018-01-281-9/+20
| | | | Updating the C API docs was missed when the per-opcode tracing & profiling support was initially added.
* bpo-32687: Fix wrong meaning of args for PyTrace_LINE/CALL in documentation ↵Xiang Zhang2018-01-281-2/+2
| | | | | | (#5361)
* bpo-10381: Add timezone to datetime C API (#5032)Paul Ganssle2018-01-241-11/+35
| | | | | | | | | | | | | | | | | | * Add timezone to datetime C API * Add documentation for timezone C API macros * Add dedicated tests for datetime type check macros * Remove superfluous C API test * Drop support for TimeZoneType in datetime C API * Expose UTC singleton to the datetime C API * Update datetime C-API documentation to include links * Add reference count information for timezone constructors
* bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (#4056)Pablo Galindo2018-01-241-5/+6
|
* bpo-29240: PyUnicode_DecodeLocale() uses UTF-8 on Android (#5272)Victor Stinner2018-01-221-4/+7
| | | | | | | | PyUnicode_DecodeLocaleAndSize(), PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale() now use always use the UTF-8 encoding on Android, instead of the current locale encoding. On Android API 19, mbstowcs() and wcstombs() are broken and cannot be used.
* bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)Victor Stinner2018-01-152-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify locale.localeconv(), time.tzname, os.strerror() and other functions to ignore the UTF-8 Mode: always use the current locale encoding. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or encoding error, they return the position of the error and an error message which are used to raise Unicode errors in PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale(). * Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx(). * PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all cases, especially for the strict error handler. * Add _Py_DecodeUTF8Ex(): return more information on decoding error and supports the strict error handler. * Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex(). * Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx(). * Ignore the UTF-8 mode to encode/decode localeconv(), strerror() and time zone name. * Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use the "current" locale. * Remove _PyUnicode_DecodeCurrentLocale(), _PyUnicode_DecodeCurrentLocaleAndSize() and _PyUnicode_EncodeCurrentLocale().
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-151-1/+1
| | | | arguments. (#4746)
* bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)Victor Stinner2017-12-131-2/+11
| | | | | | | | | | | | | | | | | | | | | | * Add -X utf8 command line option, PYTHONUTF8 environment variable and a new sys.flags.utf8_mode flag. * If the LC_CTYPE locale is "C" at startup: enable automatically the UTF-8 mode. * Add _winapi.GetACP(). encodings._alias_mbcs() now calls _winapi.GetACP() to get the ANSI code page * locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8 mode. As a side effect, open() now uses the UTF-8 encoding by default in this mode. * Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding in the UTF-8 Mode. * Update subprocess._args_from_interpreter_flags() to handle -X utf8 * Skip some tests relying on the current locale if the UTF-8 mode is enabled. * Add test_utf8mode.py. * _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to return also the length (number of wide characters). * pymain_get_global_config() and pymain_set_global_config() now always copy flag values, rather than only copying if the new value is greater than the old value.
* bpo-32241: Add the const qualifire to declarations of umodifiable strings. ↵Serhiy Storchaka2017-12-121-2/+2
| | | | (#4748)
* Revert "bpo-32197: Try to fix a compiler error on OS X introduced in ↵Victor Stinner2017-12-041-3/+2
| | | | | | | | | | | | | | | | | | | | | | | bpo-32030. (#4681)" (#4694) * Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)" This reverts commit 13badcbc60cdbfae1dba1683fd2fae9d70717143. Re-apply commits: * "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)" commit af5a895073c24637c094772b27526b94a12ec897. * "bpo-32030: Fix config_get_program_name() on macOS (#4669)" commit e23c06e2b03452c9aaf0dae52296c85e572f9bcd. * "bpo-32030: Add Python/pathconfig.c (#4668)" commit 0ea395ae964c9cd0f499e2ef0d0030c971201220. * "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)" commit ebac19dad6263141d5db0a2c923efe049dba99d2. * "bpo-32030: Fix Py_GetPath(): init program_name (#4665)" commit 9ac3d8882712c9675c3d2f9f84af6b5729575cde. * Fix compilation error on macOS
* bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)Serhiy Storchaka2017-12-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | * Revert "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)" This reverts commit af5a895073c24637c094772b27526b94a12ec897. * Revert "bpo-32030: Fix config_get_program_name() on macOS (#4669)" This reverts commit e23c06e2b03452c9aaf0dae52296c85e572f9bcd. * Revert "bpo-32030: Add Python/pathconfig.c (#4668)" This reverts commit 0ea395ae964c9cd0f499e2ef0d0030c971201220. * Revert "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)" This reverts commit ebac19dad6263141d5db0a2c923efe049dba99d2. * Revert "bpo-32030: Fix Py_GetPath(): init program_name (#4665)" This reverts commit 9ac3d8882712c9675c3d2f9f84af6b5729575cde.
* bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)Victor Stinner2017-12-021-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | _PyPathConfig_Init() now also initialize home and program_name: * Rename existing _PyPathConfig_Init() to _PyPathConfig_Calculate(). Add a new _PyPathConfig_Init() function in pathconfig.c which handles the _Py_path_config variable and call _PyPathConfig_Calculate(). * Add home and program_name fields to _PyPathConfig.home * _PyPathConfig_Init() now initialize home and program_name from main_config * Py_SetProgramName(), Py_SetPythonHome() and Py_GetPythonHome() now calls Py_FatalError() on failure, instead of silently ignoring failures. * config_init_home() now gets directly _Py_path_config.home to only get the value set by Py_SetPythonHome(), or NULL if Py_SetPythonHome() was not called. * config_get_program_name() now gets directly _Py_path_config.program_name to only get the value set by Py_SetProgramName(), or NULL if Py_SetProgramName() was not called. * pymain_init_python() doesn't call Py_SetProgramName() anymore, _PyPathConfig_Init() now always sets the program name * Call _PyMainInterpreterConfig_Read() in pymain_parse_cmdline_envvars_impl() to control the memory allocator * C API documentation: it's no more safe to call Py_GetProgramName() before Py_Initialize().
* bpo-20891: Fix PyGILState_Ensure() (#4650)Victor Stinner2017-11-301-2/+3
| | | | | | | When PyGILState_Ensure() is called in a non-Python thread before PyEval_InitThreads(), only call PyEval_InitThreads() after calling PyThreadState_New() to fix a crash. Add an unit test in test_embed.
* bpo-32030: Rework memory allocators (#4625)Victor Stinner2017-11-291-9/+38
| | | | | | | | | | | | | | | | | | | | * Fix _PyMem_SetupAllocators("debug"): always restore allocators to the defaults, rather than only caling _PyMem_SetupDebugHooks(). * Add _PyMem_SetDefaultAllocator() helper to set the "default" allocator. * Add _PyMem_GetAllocatorsName(): get the name of the allocators * main() now uses debug hooks on memory allocators if Py_DEBUG is defined, rather than calling directly malloc() * Document default memory allocators in C API documentation * _Py_InitializeCore() now fails with a fatal user error if PYTHONMALLOC value is an unknown memory allocator, instead of failing with a fatal internal error. * Add new tests on the PYTHONMALLOC environment variable * Add support.with_pymalloc() * Add the _testcapi.WITH_PYMALLOC constant and expose it as support.with_pymalloc(). * sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so replace it with support.with_pymalloc(). * pythoninfo: add _testcapi collector for pymem
* bpo-32124: Document C functions safe before init (#4540)Victor Stinner2017-11-241-3/+212
| | | | Explicitly document C functions and C variables that can be set before Py_Initialize().
* bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160)xdegaye2017-11-121-1/+2
|
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-081-1/+1
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* bpo-29179: Document the Py_UNUSED macro (#4341)Petr Viktorin2017-11-081-0/+7
| | | | | | Py_UNUSED has a public name, and is used in the wild outside CPython, but was not documented. Rectify that. The macro was added in bpo-19976 and referenced in bpo-26179.
* bpo-31338: C API intro: add missing versionadded (#4339)Victor Stinner2017-11-081-0/+10
|
* Docs: Mention that Py_UNREACHABLE was added in 3.7 (#4337)Petr Viktorin2017-11-081-0/+2
| | | The macro was added for bpo-31338 in commit b2e5794870eb4728ddfaafc0f79a40299576434f
* bpo-31678: Fix typo in PyDateTime_DELTA_GET_MICROSECONDS (GH-3869)Phobosmir2017-11-041-1/+1
|
* bpo-23699: Use a macro to reduce boilerplate code in rich comparison ↵stratakis2017-11-021-0/+16
| | | | functions (GH-793)
* bpo-20064: Document PyObject_Malloc() (#4199)Victor Stinner2017-10-311-1/+64
| | | | | | | | | | Document the following functions: * PyObject_Malloc() * PyObject_Calloc() * PyObject_Realloc() * PyObject_Free() Fix also PyMem_RawFree() documentation.
* Fix wording about Py_tss_NEEDS_INIT in docs (GH-4096)Masayuki Yamamoto2017-10-241-1/+1
| | | | Make more sense to replace the word "default value" with "initializer" for Py_tss_NEEDS_INIT.
* bpo-31754: Fix type of 'itemsize' in PyBuffer_FillContiguousStrides (GH-3993)vyas452017-10-151-1/+1
|
* bpo-27867: Add a porting guide for PySlice_GetIndicesEx(). (#1973)Serhiy Storchaka2017-10-081-1/+17
|
* bpo-28280: Make PyMapping_Keys(), PyMapping_Values() and PyMapping_Items() ↵Oren Milman2017-10-081-6/+15
| | | | always return a list (#3840)
* Document Py_GETENV() (#3890)Barry Warsaw2017-10-061-0/+5
|