Commit graph

1142 commits

Author SHA1 Message Date
Miss Islington (bot)
193504acf3
bpo-28737: Document when tp_dealloc should call PyObject_GC_UnTrack() (GH-29246) (GH-29248)
Objects that support garbage collection ("container" objects) should
call PyObject_GC_UnTrack() from their destructors before clearing any
fields which may point to other "container" objects.
(cherry picked from commit 35e1ff38ee)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2021-10-28 21:23:19 +02:00
Christian Clauss
edef03aaa8
[3.9] [doc] Fix typos found using codespell (GH-28744) (GH-28759) 2021-10-06 15:57:39 +02:00
Miss Islington (bot)
f1d5cdef57
bpo-41203: Replace Mac OS X and OS X with macOS (GH-28515) (GH-28524)
Replace old names when they refer to actual versions of macOS.
Keep historical names in references to older versions.

Co-authored-by: Patrick Reader <_@pxeger.com>
(cherry picked from commit 36122e1814)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-23 13:25:57 +03:00
Miss Islington (bot)
6e151ff6fc
[3.9] Fix minor typo in Doc/c-api/type.rst (GH-28432) (GH-28441)
retreived-> retrieved
(cherry picked from commit af08f1ba40)


Co-authored-by: Konstantin Popov <konst.hardy@gmail.com>

Automerge-Triggered-By: GH:Fidget-Spinner
2021-09-17 19:12:25 -07:00
Serhiy Storchaka
9f64b1a44b
[3.9] docs: correct references to __isub__ etc (GH-28297). (GH-28415)
(cherry picked from commit 800bd01b6d)

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-09-17 14:14:27 +03:00
Miss Islington (bot)
834a2eb945
[doc] Fix typo c-api/exceptions.rst (GH-27847) (GH-27919)
Co-authored-by: Tianqing Peng <pengtianqing@yimian.com.cn>
(cherry picked from commit dcbf7ff6a7)

Co-authored-by: Sunny Bean <ptq008@gmail.com>
2021-08-23 22:09:52 +02:00
Miss Islington (bot)
467c873e49
Note that tp_clear and m_clear are not always called (GH-27581) (GH-27597)
(cherry picked from commit 10faada709)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-08-04 20:24:03 +02:00
Miss Islington (bot)
f26fec4f74
bpo-41886: Fix documented type of PyType_Type (GH-22454)
(cherry picked from commit ac811f9b5a)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2021-08-03 10:48:08 -07:00
Miss Islington (bot)
77a96da556
Document PyMember_GetOne and PyMember_SetOne (GH-27555) (GH-27561)
(cherry picked from commit d382bde220)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-08-02 18:53:55 +02:00
Miss Islington (bot)
7922546859
bpo-43565: Document PyUnicode_KIND's return type as an unsigned int (GH-25724) (GH-27440)
(cherry picked from commit 47fd4726a2)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2021-07-29 11:33:16 +02:00
Victor Stinner
5ed7827b16
bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26878)
Py_RunMain() now resets PyImport_Inittab to its initial value at
exit. It must be possible to call PyImport_AppendInittab() or
PyImport_ExtendInittab() at each Python initialization.

(cherry picked from commit 489699ca05)
2021-06-23 17:47:33 +02:00
Miss Islington (bot)
533bff4e9f
bpo-44426: Fix use of the C keyword 'default' as a variable name (GH-26798) (GH-26805)
(cherry picked from commit 291848195f)
2021-06-19 16:16:38 +01:00
Miss Islington (bot)
686c6f303a
bpo-44426: Use of 'complex' as a C variable name confuses Sphinx; change it to 'num'. (GH-26744) (GH-26761)
(cherry picked from commit 7247f6f433)
2021-06-16 20:13:53 +01:00
Ken Jin
c7e95715ec
[3.9] bpo-44392: Add Py_GenericAlias to C API docs (GH-26724) (GH-26757)
(cherry picked from commit 6773c3eaa7)
2021-06-16 08:34:52 -07:00
Miss Islington (bot)
7bd1304d49
bpo-44263: Mention PyType_Ready in the gc protocol warning (GH-26445)
(cherry picked from commit 43cf7c864a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-28 20:53:40 -07:00
Miss Islington (bot)
a30cbaee84
bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442)
(cherry picked from commit 8b55bc3f93)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-28 20:20:54 -07:00
Miss Islington (bot)
fdb11897d7
bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671) (GH-25689)
(cherry picked from commit 4c49be7668)
2021-04-28 17:11:15 +02:00
Miss Islington (bot)
a838e477a0
bpo-43506: Doc: Update removal schedule for Py_UNICODE encoder APIs (GH-24885)
See PEP 624.
(cherry picked from commit 1330338583)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-03-15 21:48:12 -07:00
Miss Islington (bot)
ea46c7bc50
bpo-3329: Fix typo in PyObjectArenaAllocator doc (GH-24795)
(cherry picked from commit 0d6bd1ca7c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-03-09 03:39:39 -08:00
Miss Islington (bot)
93853b73b6
bpo-36346: Document removal schedule of deprecate APIs (GH-20879)
We will remove wstr cache in Python 3.12. See PEP 623.
(cherry picked from commit 2d6f2eed14)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-02-22 15:30:52 -08:00
Miss Islington (bot)
1cfed3d5b0
closes bpo-43266: Improve array formatting. (GH-24573)
(cherry picked from commit 2d3e463e4a)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-02-19 07:55:44 -08:00
Miss Islington (bot)
1384887505
closes bpo-43254: Fix *snprintf() man page refs. (GH-24563)
(cherry picked from commit e92d67dfbb)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-02-18 18:16:30 -08:00
Miss Islington (bot)
ddc0fa3a1c
Docs: Remove stray semicolon in init.rst (GH-23974)
Removed stray semicolon which was causing the docs to render weirdly (it's the function right under the one [here](https://docs.python.org/3/c-api/init.htmlGH-c._PyInterpreterState_GetEvalFrameFunc)).
(cherry picked from commit 9712358277)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-01-14 08:17:44 -08:00
Miss Islington (bot)
faf4957396
bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) (GH-24139)
I think that none of these API calls can fail, but only few of them are
documented as such. Add the sentence "This function always succeeds" (which is
the same already used e.g. by PyNumber_Check) to all of them.
(cherry picked from commit 315fc52db1)

Co-authored-by: Antonio Cuni <anto.cuni@gmail.com>

Co-authored-by: Antonio Cuni <anto.cuni@gmail.com>
2021-01-06 13:54:18 +01:00
Miss Islington (bot)
d153eb8a1e
bpo-42412: Fix possible leaks and check arguments in 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.
(cherry picked from commit 1db76394ea)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-11-21 03:09:40 -08:00
Miss Skeleton (bot)
46130f8538
bpo-41192: Add documentation of undocumented audit events (GH-22831)
(cherry picked from commit 3f7e990fd4)
2020-10-20 16:05:13 -04:00
Miss Islington (bot)
6dc8e0eb9b
bpo-41802: Document 'PyDict_DelItem' can raise a 'KeyError' (GH-22291)
(cherry picked from commit 20ce62f009)

Co-authored-by: Campbell Barton <ideasman42@gmail.com>
2020-10-02 09:39:20 -07:00
Miss Islington (bot)
fbb9ee0a90
[3.9] bpo-38787: Clarify docs for PyType_GetModule and warn against common mistake (GH-20215) (GH-21984)
(cherry picked from commit d9a966ae08)


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

Automerge-Triggered-By: @Mariatta
2020-09-04 15:32:28 -07:00
Miss Islington (bot)
e2977f6202
Note the buffer slots can be set with PyType_Spec with the unlimited API. (GH-22052)
Follow up to f7c4e23642.
(cherry picked from commit 700fa1b836)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-09-01 22:18:21 -05:00
Victor Stinner
8f88190af5
[3.9] bpo-40204: Allow pre-Sphinx 3 syntax in the doc (GH-21844) (GH-21901)
* bpo-40204: Allow pre-Sphinx 3 syntax in the doc (GH-21844)

Enable Sphinx 3.2 "c_allow_pre_v3" option and disable the
c_warn_on_allowed_pre_v3 option to make the documentation compatible
with Sphinx 2 and Sphinx 3.

(cherry picked from commit 423e77d6de)

* bpo-40204: Fix Sphinx sytanx in howto/instrumentation.rst (GH-21858)

Use generic '.. object::' to declare markers, rather than abusing
'..  c:function::' which fails on Sphinx 3.

(cherry picked from commit 43577c01a2)

* bpo-40204: Fix duplicates in the documentation (GH-21857)

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)'.

(cherry picked from commit 46d10b1237)

* bpo-40204: Add :noindex: in the documentation (GH-21859)

Add :noindex: to duplicated documentation to fix "duplicate object
description" errors.

For example, fix this Sphinx 3 issue:

Doc/library/configparser.rst:1146: WARNING: duplicate object
description of configparser.ConfigParser.optionxform, other instance
in library/configparser, use :noindex: for one of them

(cherry picked from commit d3ded08048)

* bpo-40204, doc: Fix syntax of C variables (GH-21846)

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.

(cherry picked from commit 474652fe93)

* bpo-40204: Fix reference to terms in the doc (GH-21865)

Sphinx 3 requires to refer to terms with the exact case.

For example, fix the Sphinx 3 warning:

Doc/library/pkgutil.rst:71: WARNING: term Loader not found in case
sensitive match.made a reference to loader instead.

(cherry picked from commit bb0b08540c)

* bpo-40204: Fix duplicated productionlist names in the doc (GH-21900)

Sphinx 3 disallows having more than one productionlist markup with
the same name. Simply remove names in this case, since names are not
shown anyway. For example, fix the Sphinx 3 warning:

Doc/reference/introduction.rst:96: duplicate token description
of *:name, other instance in reference/expressions

(cherry picked from commit 1abeda80f7)
2020-08-19 19:25:22 +02:00
Miss Islington (bot)
b2514c4934
bpo-41098: Doc: Add missing deprecated directives (GH-21162)
PyUnicodeEncodeError_Create has been deprecated with
`Py_DEPRECATED` macro. But it was not documented.
(cherry picked from commit 46e19b61d3)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-08-07 00:49:53 -07:00
Miss Islington (bot)
ea680631b4
bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)
See PEP 623 for detail.
(cherry picked from commit 270b4ad4df)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-08-04 18:56:08 -07:00
Inada Naoki
16f451744b
bpo-41211: Doc: Fix PyLong_FromUnicode (GH-21331)
PyUnicode_EncodeDecimal is not used actually.
2020-07-05 14:28:38 +09:00
Miss Islington (bot)
48f388f02f
bpo-41211: Doc: Fix PyLong_FromUnicodeObject (GH-21325)
It doesn't use PyUnicode_EncodeDecimal. It uses a private API instead.
(cherry picked from commit 9c84417122)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-07-04 21:08:39 -07:00
Miss Islington (bot)
652585c629
Doc: Minor fix to init config C API documentation (GH-21198)
Co-authored-by: Tomer Vromen <tomer.vromen@intel.com>
(cherry picked from commit 741008a57b)

Co-authored-by: tomerv <tomerv@gmail.com>
2020-07-01 02:40:14 -07:00
Inada Naoki
2ea6a9928e
bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227) 2020-06-30 15:24:06 +09:00
Inada Naoki
02134dae44
bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205) 2020-06-29 14:26:27 +09:00
Lysandros Nikolaou
d301d9473e
[3.9] bpo-40939: Deprecate the PyParser_SimpleParse* functions (GH-21012) 2020-06-21 02:15:45 +01:00
Victor Stinner
817506432d
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) (GH-20725)
(cherry picked from commit 8f023a2f66)

Co-authored-by: Sandro Mani <manisandro@gmail.com>
2020-06-08 19:36:13 +02:00
Victor Stinner
dedaac040f
bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)
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().

(cherry picked from commit e81f6e687d)
2020-06-08 18:44:50 +02:00
Miss Islington (bot)
bcbe5c59dd
bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264)
Heap types now always visit the type in tp_traverse. See added docs for details.

This reverts commit 0169d3003b.

Automerge-Triggered-By: @encukou
(cherry picked from commit 1cf15af9a6)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-28 08:12:23 -07:00
Miss Islington (bot)
9a5e643483
bpo-39245: Fix docs links to the stable ABI (GH-20388)
Automerge-Triggered-By: @vstinner
(cherry picked from commit e50883ccc4)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2020-05-25 08:49:35 -07:00
Hai Shi
86d69444e7
bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset (GH-20026) 2020-05-11 23:38:55 +02:00
Hai Shi
c068b53a0c
bpo-38787: Update structures.rst docs (PEP 573) (GH-19980) 2020-05-07 19:16:01 +02:00
Petr Viktorin
e1becf46b4
bpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)
Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.

Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-07 15:39:59 +02:00
Victor Stinner
252346acd9
bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)
An isolated subinterpreter cannot spawn threads, spawn a child
process or call os.fork().

* Add private _Py_NewInterpreter(isolated_subinterpreter) function.
* Add isolated=True keyword-only parameter to
  _xxsubinterpreters.create().
* Allow again os.fork() in "non-isolated" subinterpreters.
2020-05-01 11:33:44 +02:00
Zackery Spytz
bb4a585d90
bpo-40428: Remove references to Py*_ClearFreeList in the docs (GH-19783)
They were removed from the C API in commit
ae00a5a885.
2020-04-29 04:41:56 +02:00
Victor Stinner
7036477323
bpo-40421: Add PyFrame_GetBack() function (GH-19765)
New PyFrame_GetBack() function: get the frame next outer frame.

Replace frame->f_back with PyFrame_GetBack(frame) in most code but
frameobject.c, ceval.c and genobject.c.
2020-04-29 03:28:46 +02:00
Victor Stinner
4386b9045e
bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
The PyThreadState_GetFrame() function now returns a strong reference
to the frame.
2020-04-29 03:01:43 +02:00
Victor Stinner
8852ad4208
bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773) 2020-04-29 01:28:13 +02:00