summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)Miss Islington (bot)2019-10-011-25/+10
| | | | | | | PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore. (cherry picked from commit 8462a4936b3a551dc546a6adea04a70b0a07ca67) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38304: Remove PyConfig.struct_size (GH-16500)Victor Stinner2019-09-301-36/+3
| | | | | For now, we'll rely on the fact that the config structures aren't covered by the stable ABI. We may revisit this in the future if we further explore the idea of offering a stable embedding API.
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Miss Islington (bot)2019-09-291-1/+7
| | | | | | | | | | | | Fix warnings options priority: PyConfig.warnoptions has the highest priority, as stated in the PEP 587. * Document options order in PyConfig.warnoptions documentation. * Make PyWideStringList_INIT macro private: replace "Py" prefix with "_Py". * test_embed: add test_init_warnoptions(). (cherry picked from commit fb4ae152a9930f0e00cae8b2807f534058cf341a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38304: Add PyConfig.struct_size (GH-16451) (GH-16453)Victor Stinner2019-09-281-5/+39
| | | | | | | | | | | | | | | | | | | Add a new struct_size field to PyPreConfig and PyConfig structures to allow to modify these structures in the future without breaking the backward compatibility. * Replace private _config_version field with public struct_size field in PyPreConfig and PyConfig. * Public PyPreConfig_InitIsolatedConfig() and PyPreConfig_InitPythonConfig() return type becomes PyStatus, instead of void. * Internal _PyConfig_InitCompatConfig(), _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(), _PyPreConfig_InitFromPreConfig() return type becomes PyStatus, instead of void. * Remove _Py_CONFIG_VERSION * Update the Initialization Configuration documentation. (cherry picked from commit 441b10cf2855955c86565f8d59e72c2efc0f0a57)
* bpo-38206: Clarify tp_dealloc requirements for heap allocated types. (GH-16248)Miss Islington (bot)2019-09-272-5/+22
| | | | | | | | | | | | | | As mentioned in the bpo ticket, this mistake came up on two reviews: - https://github.com/python/cpython/pull/16127GH-pullrequestreview-288312751 - https://github.com/python/cpython/pull/16071GH-pullrequestreview-287819525 Would be nice to have it documented in a more permanent place than 3.8's whatsnew entry. https://bugs.python.org/issue38206 Automerge-Triggered-By: @encukou (cherry picked from commit 5faff977adbe089e1f91a5916ccb2160a22dd292) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* [3.8] bpo-38234: Backport init path config changes from master (GH-16423)Victor Stinner2019-09-262-30/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-38234: Py_SetPath() uses the program full path (GH-16357) Py_SetPath() now sets sys.executable to the program full path (Py_GetProgramFullPath()), rather than to the program name (Py_GetProgramName()). Fix also memory leaks in pathconfig_set_from_config(). (cherry picked from commit 1ce152a42eaa917d7763bce93f1e1ca72530d7ca) * bpo-38234: Add tests for Python init path config (GH-16358) (cherry picked from commit bb6bf7d342b4503a6227fd209fac934905b6a1aa) * bpo-38234: test_embed: test pyvenv.cfg and pybuilddir.txt (GH-16366) Add test_init_pybuilddir() and test_init_pyvenv_cfg() to test_embed to test pyvenv.cfg and pybuilddir.txt configuration files. Fix sysconfig._generate_posix_vars(): pybuilddir.txt uses UTF-8 encoding, not ASCII. (cherry picked from commit 52ad33abbfb6637d74932617c7013bae0ccf6e32) * bpo-38234: Cleanup getpath.c (GH-16367) * search_for_prefix() directly calls reduce() if found is greater than 0. * Add calculate_pybuilddir() subfunction. * search_for_prefix(): add path string buffer for readability. * Fix some error handling code paths: release resources on error. * calculate_read_pyenv(): rename tmpbuffer to filename. * test.pythoninfo now also logs windows.dll_path (cherry picked from commit 221fd84703c545408bbb4a6e0b58459651331f5c) * bpo-38234: Fix test_embed pathconfig tests (GH-16390) bpo-38234: On macOS and FreeBSD, the temporary directory can be symbolic link. For example, /tmp can be a symbolic link to /var/tmp. Call realpath() to resolve all symbolic links. (cherry picked from commit 00508a7407d7d300b487532e2271534b20e378a7) * bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402) * Add test_embed.test_init_setpath_config(): test Py_SetPath() with PyConfig. * test_init_setpath() and test_init_setpythonhome() no longer call Py_SetProgramName(), but use the default program name. * _PyPathConfig: isolated, site_import and base_executable fields are now only available on Windows. * If executable is set explicitly in the configuration, ignore calculated base_executable: _PyConfig_InitPathConfig() copies executable to base_executable. * Complete path config documentation. (cherry picked from commit 8bf39b606ef7b02c0279a80789f3c4824b0da5e9) * bpo-38234: Complete init config documentation (GH-16404) (cherry picked from commit 88feaecd46a8f427e30ef7ad8cfcddfe392a2402) * bpo-38234: Fix test_embed.test_init_setpath_config() on FreeBSD (GH-16406) Explicitly preinitializes with a Python preconfiguration to avoid Py_SetPath() implicit preinitialization with a compat preconfiguration. Fix also test_init_setpath() and test_init_setpythonhome() on macOS: use self.test_exe as the executable (and base_executable), rather than shutil.which('python3'). (cherry picked from commit 49d99f01e6e51acec5ca57a02e857f0796bc418b) * bpo-38234: Py_Initialize() sets global path configuration (GH-16421) * Py_InitializeFromConfig() now writes PyConfig path configuration to the global path configuration (_Py_path_config). * Add test_embed.test_get_pathconfig(). * Fix typo in _PyWideStringList_Join(). (cherry picked from commit 12f2f177fc483723406d7917194e7f655a20631b)
* bpo-38236: Dump path config at first import error (GH-16300) (GH-16332)Victor Stinner2019-09-231-1/+11
| | | | | | Python now dumps path configuration if it fails to import the Python codecs of the filesystem and stdio encodings. (cherry picked from commit fcdb027234566c4d506d6d753c7d5638490fb088)
* bpo-38158: Removing nonexistant member "doc" from PyType_Spec documentation ↵Miss Islington (bot)2019-09-151-4/+0
| | | | | | | (GH-16142) (GH-16154) (cherry picked from commit 8b31a11a698cb5aa9b439b349c8de4e388846f73) Co-authored-by: t k <tahia.khan@utoronto.ca>
* bpo-29986: Doc: Delete tip to raise TypeError from tp_richcompare. (GH-16095)Miss Islington (bot)2019-09-131-6/+0
| | | | | (cherry picked from commit 375a3e2bdbeb4dce69aba4b5bc90f55fe27e81b4) Co-authored-by: Julien Palard <julien@palard.fr>
* Emphasize the need to always call PySequence_Fast. (GH-11140)Miss Islington (bot)2019-09-121-7/+14
| | | | | (cherry picked from commit 57b7dbc46e71269d855e644d30826d33eedee2a1) Co-authored-by: Matti Picus <matti.picus@gmail.com>
* bpo-37363: Document internal audit events (GH-14663)Miss Islington (bot)2019-09-121-1/+6
| | | | | | | | | | Three internal cpython events were not documented, yet. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue37363 (cherry picked from commit ed4b3216e59df4806e5ef63b3357fc577a9443d7) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-26868: Fix example usage of PyModule_AddObject. (GH-15725)Miss Islington (bot)2019-09-121-1/+16
| | | | | | | | | | | | | | | | | | * Add a note to the PyModule_AddObject docs. * Correct example usages of PyModule_AddObject. * Whitespace. * Clean up wording. * 📜🤖 Added by blurb_it. * First code review. * Add < 0 in the tests with PyModule_AddObject (cherry picked from commit 224b8aaa7e8f67f748e8b7b6a4a77a25f6554651) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* [3.8] bpo-37698: Update doc of PyBuffer_ToContiguous (GH-14992) (GH-15999)Stéphane Wirtel2019-09-111-2/+2
| | | | | | https://bugs.python.org/issue37698 (cherry picked from commit 15f5a7527b87e11fcf23069c147fd4cb7d42cfb0) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-37750: Add doc of PyBuffer_FromContiguous (GH-15988) (GH-15990)Miss Islington (bot)2019-09-111-0/+7
| | | | | | | | https://bugs.python.org/issue37750 Automerge-Triggered-By: @matrixise (cherry picked from commit 5a56ce4a0e820fefcd598b94715a7ff7e199858d) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-38103: fix conflicting labels in the docs. (GH-15906)Miss Islington (bot)2019-09-111-2/+2
| | | | | (cherry picked from commit 2d8d597bb8f882a7677db5a2739df0e617098634) Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* Docs: Small tweaks to c-api/introGH-Include_Files (GH-14698)Miss Islington (bot)2019-09-101-7/+9
| | | | | (cherry picked from commit b6dafe51399f5c6313a00529118a6052b466942f) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* Fix typos mostly in comments, docs and test names (GH-15209)Miss Islington (bot)2019-08-301-1/+1
| | | | | (cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2) Co-authored-by: Min ho Kim <minho42@gmail.com>
* [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details ↵Nick Coghlan2019-08-251-3/+0
| | | | | | | | | | | | | | | | | | | (GH-15491) - drop TargetScopeError in favour of raising SyntaxError directly as per the updated PEP 572 - comprehension iteration variables are explicitly local, but named expression targets in comprehensions are nonlocal or global. Raise SyntaxError as specified in PEP 572 - named expression targets in the outermost iterable of a comprehension have an ambiguous target scope. Avoid resolving that question now by raising SyntaxError. PEP 572 originally required this only for cases where the bound name conflicts with the iteration variable in the comprehension, but CPython can't easily restrict the exception to that case (as it doesn't know the target variable names when visiting the outermost iterator expression) (cherry picked from commit 5dbe0f59b7a4f39c7c606b48056bc29e406ebf78)
* bpo-36763, doc: Add links in the new C API init doc (GH-15433)Miss Islington (bot)2019-08-232-0/+4
| | | | | (cherry picked from commit 1beb7c3de9c3d0e802e4267a11d937e8f024d661) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)Miss Islington (bot)2019-08-231-2/+6
| | | | | (cherry picked from commit 3842f2997fbd4dc840986aad2bb94656815e243b) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36487: Make C-API docs clear about what the main interpreter is. (gh-15080)Miss Islington (bot)2019-08-021-4/+12
| | | | | (cherry picked from commit 854d0a4b98b13629252e21edaf2b785b429e5135) (gh-12666) Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
* bpo-34101: Add doc of PyBuffer_GetPointer (GH-14994)Miss Islington (bot)2019-07-311-0/+6
| | | | | (cherry picked from commit 1b29af83bc17e773b0c0d117f5fe1018fde46b0d) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* Remove trailing .0 from version changed note (GH-14987)Miss Islington (bot)2019-07-281-1/+1
| | | | | (cherry picked from commit 17a058ed6ffa7f56c0920d15d214ad080e7eef86) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* Docs: Correct formatting of a multiline code block (GH-13806)Miss Islington (bot)2019-07-171-2/+4
| | | | | (cherry picked from commit bd26a4466b507e196fc9a5e4a6cb7cd6d39f85aa) Co-authored-by: Joseph Fox-Rabinovitz <madphysicist@users.noreply.github.com>
* bpo-37590: Remove redundant docs of PyEval_EvalFrameEx (GH-14765)Miss Islington (bot)2019-07-141-6/+6
| | | | | (cherry picked from commit 40d2226a69aed6252023d365731bd4ed39dc1a4f) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14624)Miss Islington (bot)2019-07-061-3/+3
| | | | | | 0 is a legal index. (cherry picked from commit f8709e804d16ec5d44b1d2f00d59a0f78df7b792) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* closes bpo-37508: Fix name of type in memory.rst. (GH-14604)Miss Islington (bot)2019-07-061-1/+1
| | | | | (cherry picked from commit 39a5d17a7f1387582eb484422df450bc09a5543e) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-37441: Fix wrong PyErr_SetImportErrorSubclass signature in doc (GH-14453)Miss Islington (bot)2019-07-031-1/+1
| | | | | (cherry picked from commit aeecf380660ea459d85bb5f59d76bb54f757b5be) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)Miss Islington (bot)2019-07-011-0/+7
| | | | | (cherry picked from commit 36242fd871d0f0977e720d4fae5700774bd8c09a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set ↵Miss Islington (bot)2019-07-011-10/+11
| | | | | | | | PyCode_New as a compatibility wrapper (GH-13959) (#14505) Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper (cherry picked from commit 4a2edc34a405150d0b23ecfdcb401e7cf59f4650) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-37432: Doc: Fix signature of PyObject_Del() (GH-14430)Miss Islington (bot)2019-06-281-1/+1
| | | | | (cherry picked from commit b4bee03087a3c70cb040e2ce569c828860ed8e87) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-37390: Add audit event table to documentations (GH-14406)Miss Islington (bot)2019-06-272-5/+1
| | | | | | Also updates some (unreleased) event names to be consistent with the others. (cherry picked from commit 44f91c388a6f4da9ed3300df32ca290b8aa104ea) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-37342: Fix the incorrect nb_index's type in typeobj documentation (GH-14241)Miss Islington (bot)2019-06-201-1/+1
| | | | | | It was listed as `binaryfunc`. It should be `unaryfunc`. (cherry picked from commit bc5caf88ca19b4c8cb9bc912c832b4807a515a60) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-37194: Complete PyObject_CallXXX() docs (GH-14156) (GH-14157)Victor Stinner2019-06-171-7/+15
| | | | | | Mention explicitly that PyObject_CallXXX() functions raise an exception an failure. (cherry picked from commit 1ce2656f13e726b3b99d4c968926908cff1f460a)
* bpo-28805: document METH_FASTCALL (GH-14079)Miss Islington (bot)2019-06-161-12/+51
| | | | | (cherry picked from commit 5600b5e1b24a3491e83f1b3038a7ea047a34c0bf) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* [3.8] bpo-37253: Document PyCompilerFlags.cf_feature_version (GH-14019) ↵Victor Stinner2019-06-131-4/+15
| | | | | | | | | (GH-14038) * Update PyCompilerFlags structure documentation. * Document the new cf_feature_version field in the Changes in the C API section of the What's New in Python 3.8 doc. (cherry picked from commit 2c9b498759f4fc74da82a0a96d059d666fa73f16)
* [3.8] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() ↵Zackery Spytz2019-06-071-2/+4
| | | | | | | (GH-13860) (GH-13891) (cherry picked from commit dc2476500d91082f0c907772c83a044bf49af279) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-36974: document PEP 590 (GH-13450)Jeroen Demeyer2019-06-022-122/+276
|
* bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)Serhiy Storchaka2019-06-012-1/+11
|
* bpo-36842: Pass positional only parameters to code_new audit hook (GH-13707)Pablo Galindo2019-06-011-1/+1
|
* bpo-37122: Make co->co_argcount represent the total number of positonal ↵Pablo Galindo2019-06-011-0/+2
| | | | arguments in the code object (GH-13726)
* Document changes for PyCode_New regarding PEP570 (GH-13706)Pablo Galindo2019-05-311-0/+3
|
* bpo-32388: Remove cross-version binary compatibility requirement in tp_flags ↵Antoine Pitrou2019-05-291-0/+5
| | | | | | | | (GH-4944) It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags. This will reduce the risk of running out of bits in the 32-bit tp_flags value.
* bpo-36540: Documentation for PEP570 - Python positional only arguments (#13202)Pablo Galindo2019-05-281-1/+1
| | | | | | | | | | | | | | | | | | * bpo-36540: Documentation for PEP570 - Python positional only arguments * fixup! bpo-36540: Documentation for PEP570 - Python positional only arguments * Update reference for compound statements * Apply suggestions from Carol Co-Authored-By: Carol Willing <carolcode@willingconsulting.com> * Update Doc/tutorial/controlflow.rst Co-Authored-By: Carol Willing <carolcode@willingconsulting.com> * Add extra bullet point and minor edits
* bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)Zackery Spytz2019-05-281-0/+12
|
* bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)Jeroen Demeyer2019-05-281-0/+26
| | | Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-273-0/+1026
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* Support Py_UNUSED() on clang (GH-13544)Victor Stinner2019-05-241-1/+1
|
* Fix typo: decription -> description (GH-13543)Xtreak2019-05-241-1/+1
|
* bpo-34626: Document creating heap types from the C-API (GH-9154)Petr Viktorin2019-05-242-17/+127
| | | | | | | bpo-34626: Document creating heap types from the C-API Add missing descriptions of PEP384's PyType_Spec and PyType_Slot, along with some introductory prose.