Commit Graph

1031 Commits

Author SHA1 Message Date
Miss Islington (bot) ea164309de
bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)
(cherry picked from commit 02134dae44)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-06-28 22:36:04 -07:00
Zachary Ware ca5649c4c1
[3.8] bpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros (GH-16607) (GH-19727)
Adds a short description of `PyDoc_STRVAR` and `PyDoc_STR` to "Useful macros" section of C-API docs.

Currently, there is [one lone mention](https://docs.python.org/3/c-api/module.html?highlight=pydoc_strvarGH-c.PyModuleDef) in the C-API reference, despite the fact that `PyDoc_STRVAR` is ubiquitous to `Modules/`.

Additionally, this properly uses `c:macro` within `Doc/c-api/module.rst` to link.
(cherry picked from commit b54e46c)

Authored-by: Brad Solomon <brad.solomon.1124@gmail.com>
2020-04-26 21:45:05 -05:00
Miss Islington (bot) da1fe768e5
bpo-39973: Fix the docs for PyObject_GenericSetDict() (GH-19026)
PyObject_GenericSetDict() takes three arguments, not two.
(cherry picked from commit a45b695b9f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-03-17 01:25:34 -07:00
Karthikeyan Singaravelan d3af92ecc2
[3.8] Doc: Fix grammar in PyErr_ResourceWarning (GH-18879) (GH-18976)
(cherry picked from commit fdcd53f)

Co-authored-by: Daniel Hahler <git@thequod.de>
2020-03-13 21:02:38 +05:30
Miss Islington (bot) 1827fc30f4
bpo-39778: Add clarification about tp_traverse and ownership (GH-18754)
Automerge-Triggered-By: @pablogsal
(cherry picked from commit 6df421fe87)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-02 19:04:13 -08:00
Miss Islington (bot) c3536b7942
Doc: int -> int or Py_ssize_t (GH-18663)
(cherry picked from commit 57c7a0bdf4)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-02-25 22:11:16 -08:00
Miss Islington (bot) 9ce361d3bb
fix(doc): set correct RST syntax for c:function (GH-18589)
The current content is not rendered since the syntax is not correct.
(cherry picked from commit d4d17fd2cf)

Co-authored-by: Julien Danjou <julien@danjou.info>
2020-02-21 02:54:00 -08:00
Miss Islington (bot) 3f8d181446
bpo-38374: Remove weakref.ReferenceError from docs (GH-18452)
Reflecting changes to the code, removed weakref.ReferenceError from weakref.rst and exceptions.rst.

Issue submitter provided evidence that the `weakref.ReferenceError` alias for `ReferenceError` was removed from the code in 2007.  Working with @gvanrossum at PyCascades CPython sprint we looked at the code and confirmed that `weakref.ReferenceError` was no longer in `weakref.py`.

Based on that analysis I removed references `weakref.ReferenceError` from the two documents where it was still being referenced: `weakref.rst` and `exceptions.rst`.

https://bugs.python.org/issue38374
(cherry picked from commit 4eb9f4313c)

Co-authored-by: Roger Hurwitz <rogerhurwitz@gmail.com>
2020-02-10 23:02:01 -08:00
Miss Islington (bot) 526523c193
bpo-39153: Clarify C API *SetItem refcounting semantics (GH-18220)
Some of the *SetItem methods in the C API steal a reference to the
given value. This annotates the better behaved ones to assure the
reader that these are not the ones with the inconsistent behaviour.

* 📜🤖 Added by blurb_it.

* make docs consistent with signature

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit e1e80002e2)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2020-01-29 03:29:35 -08:00
Miss Islington (bot) 41b3e87930 PyLong_AsLongLong() docs should say 'long long' (GH-18082) (GH-18110)
(cherry picked from commit 47be7d0108)

Co-authored-by: Keith Erskine <toastie604@gmail.com>

Co-authored-by: Keith Erskine <toastie604@gmail.com>
2020-01-21 19:22:21 +00:00
Miss Islington (bot) 20c990229e
bpo-39161: Document multi-phase init modules under Py_NewInterpreter() (GH-17896)
\+ this also adds a stronger warning against sharing objects between (sub-)interpreters.

https://bugs.python.org/issue39161
(cherry picked from commit 6c5d661342)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2020-01-09 04:27:35 -08:00
Terry Jan Reedy df647f3340
[3.8] bpo-39136: Fixed typos (GH-17720)
funtion -> function; configuraton -> configuration; defintitions -> definitions;
focusses -> focuses; necesarily -> necessarily; follwing -> following;
Excape -> Escape,

(cherry picked from commit 6c7bb38ff2)
2019-12-28 19:05:15 -05:00
Miss Islington (bot) ff67612fa3
Fix the miscellaneous typo (GH-17700)
A character "i" is omitted.
(cherry picked from commit 527f9de6ef)

Co-authored-by: cocoatomo <cocoatomo77@gmail.com>
2019-12-25 07:45:52 -08:00
Miss Islington (bot) e9039f32b3 Minor C API documentation improvements. (GH-17697)
The added parentheses around the PyIter_Next assignment suppress the following warning which gcc throws without:
```
warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
```
The other change is a typo fix
(cherry picked from commit 5c7ed7550e)

Co-authored-by: William Ayd <william.ayd@icloud.com>
2019-12-24 22:35:01 -06:00
Miss Islington (bot) c93d68bbb9
bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540)
(cherry picked from commit b8cbe74c34)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-12-09 11:22:30 -08:00
Miss Islington (bot) 86d9933cc6
bpo-38892: Improve docs for audit event (GH-17361)
(cherry picked from commit e563a155be)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-11-26 09:14:48 -08:00
Miss Islington (bot) c5fe339b27
Fixed an incorrect sentence in the docs (GH-17205)
Fixed an incorrect sentence in Doc/c-api/mapping.rst I fell on
while translating the file.

skip issue

Automerge-Triggered-By: @csabella
(cherry picked from commit 06ca2a2be9)

Co-authored-by: Aveheuzed <a.masson555@ntymail.com>
2019-11-20 17:26:30 -08:00
Miss Islington (bot) 7a5d4c7a86
bpo-38816: Add notes in the C-API docs about fork in subinterpreters. (GH-17176)
The C-API docs are a bit sparse on the interplay between C `fork()` and the CPython runtime.  This change adds some more information on the subject.

https://bugs.python.org/issue38816
(cherry picked from commit 73cdb0c6b2)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2019-11-15 13:36:49 -08:00
Miss Islington (bot) 1270d2cf1d
[3.8] bpo-38159: Clarify documentation of PyState_AddModule (GH-16101) (GH-17026)
This was never intented to be called manually from PyInit_*.

Also, clarify PyState_RemoveModule return value.
(cherry picked from commit 9bc94eca0c)


Co-authored-by: Petr Viktorin <encukou@gmail.com>


https://bugs.python.org/issue38159



Automerge-Triggered-By: @encukou
2019-11-05 05:35:56 -08:00
Serhiy Storchaka 2c921c65e9
[3.8] bpo-38600: NULL -> ``NULL``. (GH-17001) (GH-17003)
Also fix some other formatting.
(cherry picked from commit e835b31d2b)
2019-10-30 22:44:55 +02:00
Serhiy Storchaka f2ba17be2a
[3.8] bpo-38600: Change the mark up of NULL in the C API documentation. (GH-16950) (GH-16999)
Replace all *NULL* with ``NULL``.
(cherry picked from commit 25fc088607)
2019-10-30 21:36:33 +02:00
Miss Skeleton (bot) 11f0f11c48
bpo-38434: Fixes some audit event documentation (GH-16932)
(cherry picked from commit 894e30ce0b)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-10-26 13:09:35 -07:00
Miss Skeleton (bot) 4992dc6610
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
(cherry picked from commit d898d20e8c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-26 13:06:34 -07:00
Miss Islington (bot) d49f096cc4
bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)
PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no
longer return PyStatus: they cannot fail anymore.
(cherry picked from commit 8462a4936b)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-10-01 03:26:04 -07:00
Victor Stinner bdace21b76 bpo-38304: Remove PyConfig.struct_size (GH-16500)
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.
2019-10-01 08:46:42 +10:00
Miss Islington (bot) c9ed9e6fc7
bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)
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 fb4ae152a9)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-29 16:58:57 -07:00
Victor Stinner 6e128382b3
bpo-38304: Add PyConfig.struct_size (GH-16451) (GH-16453)
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 441b10cf28)
2019-09-28 04:50:43 +02:00
Miss Islington (bot) 14ddca726a
bpo-38206: Clarify tp_dealloc requirements for heap allocated types. (GH-16248)
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 5faff977ad)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2019-09-27 04:18:24 -07:00
Victor Stinner 96c8475362
[3.8] bpo-38234: Backport init path config changes from master (GH-16423)
* 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 1ce152a42e)

* bpo-38234: Add tests for Python init path config (GH-16358)


(cherry picked from commit bb6bf7d342)

* 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 52ad33abbf)

* 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 221fd84703)

* 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 00508a7407)

* 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 8bf39b606e)

* bpo-38234: Complete init config documentation (GH-16404)


(cherry picked from commit 88feaecd46)

* 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 49d99f01e6)

* 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 12f2f177fc)
2019-09-26 16:17:34 +02:00
Victor Stinner c5c642565e
bpo-38236: Dump path config at first import error (GH-16300) (GH-16332)
Python now dumps path configuration if it fails to import the Python
codecs of the filesystem and stdio encodings.

(cherry picked from commit fcdb027234)
2019-09-23 15:59:00 +02:00
Miss Islington (bot) b65be6cd3d bpo-38158: Removing nonexistant member "doc" from PyType_Spec documentation (GH-16142) (GH-16154)
(cherry picked from commit 8b31a11a69)

Co-authored-by: t k <tahia.khan@utoronto.ca>
2019-09-15 08:00:44 +01:00
Miss Islington (bot) 4556b1d35c
bpo-29986: Doc: Delete tip to raise TypeError from tp_richcompare. (GH-16095)
(cherry picked from commit 375a3e2bdb)

Co-authored-by: Julien Palard <julien@palard.fr>
2019-09-13 06:14:42 -07:00
Miss Islington (bot) 4145f62759
Emphasize the need to always call PySequence_Fast. (GH-11140)
(cherry picked from commit 57b7dbc46e)

Co-authored-by: Matti Picus <matti.picus@gmail.com>
2019-09-12 09:26:17 -07:00
Miss Islington (bot) 2f01cf6187
bpo-37363: Document internal audit events (GH-14663)
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 ed4b3216e5)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 06:20:26 -07:00
Miss Islington (bot) 535863e3f5
bpo-26868: Fix example usage of PyModule_AddObject. (GH-15725)
* 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 224b8aaa7e)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2019-09-12 05:26:46 -07:00
Stéphane Wirtel 965e53a9de
[3.8] bpo-37698: Update doc of PyBuffer_ToContiguous (GH-14992) (GH-15999)
https://bugs.python.org/issue37698
(cherry picked from commit 15f5a7527b)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-09-11 19:36:00 +02:00
Miss Islington (bot) 4cab7eb9e1 bpo-37750: Add doc of PyBuffer_FromContiguous (GH-15988) (GH-15990)
https://bugs.python.org/issue37750

Automerge-Triggered-By: @matrixise
(cherry picked from commit 5a56ce4a0e)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-09-11 19:09:57 +02:00
Miss Islington (bot) e0dd713370
bpo-38103: fix conflicting labels in the docs. (GH-15906)
(cherry picked from commit 2d8d597bb8)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2019-09-11 05:28:06 -07:00
Miss Islington (bot) 78c3949407
Docs: Small tweaks to c-api/introGH-Include_Files (GH-14698)
(cherry picked from commit b6dafe5139)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-09-10 09:38:07 -07:00
Miss Islington (bot) 4bd1d05ee2
Fix typos mostly in comments, docs and test names (GH-15209)
(cherry picked from commit 39d87b5471)

Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-08-30 13:42:54 -07:00
Nick Coghlan 6ca030765d
[3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (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 5dbe0f59b7)
2019-08-26 00:41:47 +10:00
Miss Islington (bot) 9cbdce3917
bpo-36763, doc: Add links in the new C API init doc (GH-15433)
(cherry picked from commit 1beb7c3de9)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-23 10:05:59 -07:00
Miss Islington (bot) a6427cb2a2
bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)
(cherry picked from commit 3842f2997f)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-23 09:24:42 -07:00
Miss Islington (bot) 375f35be06 bpo-36487: Make C-API docs clear about what the main interpreter is. (gh-15080)
(cherry picked from commit 854d0a4b98) (gh-12666)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2019-08-02 11:49:38 -06:00
Miss Islington (bot) 29a3a33d99
bpo-34101: Add doc of PyBuffer_GetPointer (GH-14994)
(cherry picked from commit 1b29af83bc)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-07-31 08:04:31 -07:00
Miss Islington (bot) 69372eea08
Remove trailing .0 from version changed note (GH-14987)
(cherry picked from commit 17a058ed6f)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
2019-07-28 04:48:26 -07:00
Miss Islington (bot) 35d36dacd4
Docs: Correct formatting of a multiline code block (GH-13806)
(cherry picked from commit bd26a4466b)

Co-authored-by: Joseph Fox-Rabinovitz <madphysicist@users.noreply.github.com>
2019-07-17 01:32:53 -07:00
Miss Islington (bot) 7a430109b9 bpo-37590: Remove redundant docs of PyEval_EvalFrameEx (GH-14765)
(cherry picked from commit 40d2226a69)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-07-14 10:53:18 +02:00
Miss Islington (bot) ad3720359f bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14624)
0 is a legal index.
(cherry picked from commit f8709e804d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-06 17:54:56 -04:00
Miss Islington (bot) cf294c48e4
closes bpo-37508: Fix name of type in memory.rst. (GH-14604)
(cherry picked from commit 39a5d17a7f)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-07-05 21:09:57 -07:00