gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)
(cherry picked from commit 8f459255eba2b6639f1912e5c5e318a7cdafada1)
Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
gh-126014: test_makefile_test_folders: Ignore basically-empty directories (GH-140466)
The code in test_makefile was attempting to ignore any
non-interesting files, but missed some corners:
1. There is never a *file* called `__pycache__`.
2. A directory containing only a `__pycache__` subdirectory should be
ignored.
3. A directory containing only hidden files should be ignored.
Simplify this all into a couple of filters that let us check for empty
lists.
(cherry picked from commit 17d447e993a0ff9b7d44786ceb2a8f9510638bfa)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
gh-143935: Email preserve parens when folding comments (GH-143936)
Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.
(cherry picked from commit 17d1490aa97bd6b98a42b1a9b324ead84e7fd8a2)
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
gh-143237: Fix support of named pipes in the rotating logging handlers (GH-143259)
This fixes regression introduced in GH-105887.
(cherry picked from commit aa8a43d179bad5cd9fbfce63b630e2ee0bd617e4)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-143919: Reject control characters in http cookies
(cherry picked from commit 95746b3a13a985787ef53b977129041971ed7f70)
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
It does not support an ASCII string.
Also add more tests.
(cherry picked from commit 25a10b60b04ab2fa802409dc6f211cf2ca028a0a)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-142779: Initialize reserved field for proper padding (GH-142780)
The jitdump specification specifies a reserved field for padding.
Initialize it so no garbage data is embedded in the jitdump files.
(cherry picked from commit 77bf4ba732a8736910bd6b7ec5a58b8ee833c95f)
Co-authored-by: stratakis <cstratak@redhat.com>
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)
The check was (fd > 0), should be (fd >= 0).
(cherry picked from commit fa44efa0ef1972ac1e2f66996303154be11f605e)
Co-authored-by: AZero13 <gfunni234@gmail.com>
gh-141004: Mark up constants for `PyOS_double_to_string` (GH-143867)
This ensures they show up as C macros in search and the Sphinx inventory.
(cherry picked from commit fb690c38cafb15e4ccddc52aba37f9470ce201a0)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-141004: Mark up docs of old PyMem macros (GH-143783)
These had a docs-only deprecation notice since the first version of the docs in this repo. Nowadays we call things “soft deprecated” if there's just a note in the docs.
The deprecated directive needs a version, I went with the first one that had the notice (2.0; it's not in 1.6):
- https://docs.python.org/release/2.0/api/memoryInterface.html
- https://docs.python.org/release/1.6/api/memoryInterface.html
Since PEP 445, they are now direct aliases; there are no (additional) binary compatibility concerns over the preferred names.
(cherry picked from commit a009e78b79ec340d9ff0e1a8ad20f8178fd3257f)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Update struct.__doc__: _Bool available unconditionally (GH-143716)
This amends commit a9296e7f3be4d6c22271b25c86467ff867c63bbb.
(cherry picked from commit 31c81ab0a2fb7009a76426617991a9b539ab0180)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
gh-143774 - Improve IDLE Format Paragraph doc (GH-143775)
Add a reminder to not rewrap code line to the Menu => Format => Reformat Paragraph entry.
In Editing and Nagivagion, add a new 'Format block' subsection that defines 'paragraph'
to better match what is dependably handled as more or less expected.
In particular, specify equal indents and that the resulting indent equals original indent.
Also mention that selections are expanded to complete lines and how to modify max length.
(Also fix a couple case errors in cross references.)
(cherry picked from commit fa3abf5a51d42b2d62e1bc89e9465b398a567e94)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-102809: No longer mention `Misc/gdbinit` in the code (GH-143980)
Fix misleading comment on `PyObject_Dump`.
(cherry picked from commit f84ea1107170988742fbd350123678a5c503c1ad)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Use more relevant terminology instead of "master"/"slave" widgets where possible.
(cherry picked from commit 813fc7a291c98654c27f2b5d8f9afa8e53b066a6)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-143916: Reject control characters in wsgiref.headers.Headers (GH-143917)
* Add 'test.support' fixture for C0 control characters
* gh-143916: Reject control characters in wsgiref.headers.Headers
(cherry picked from commit f7fceed79ca1bceae8dbe5ba5bc8928564da7211)
Co-authored-by: Seth Michael Larson <seth@python.org>
This allows to run Tkinter tests with the specified value of
tkinter.wantobjects, for example "-u wantobjects=0".
(cherry picked from commit 21ed1e2a9401a2e96ccc910fcb66f22afc96efbd)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
[3.14] gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) (#143872)
gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629)
Fix an inconsistency issue in io.BytesIO.write() where the buffer was exported
twice, which could lead to unexpected data overwrites and position drift when
the buffer changes between exports.
(cherry picked from commit c461aa99e2fabbaf5859c0a8a93e08306ee8115d)
(cherry picked from commit 1241432150f6342e3d38c5a80a19c8c157a4ebe8)
Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
Add tests for negative offset, out of bound offset, invalid type of offset,
non-writeable buffer, non-continuous buffer, invalid type of buffer.
Repeat all tests for struct.Struct.pack_into().
(cherry picked from commit 66680f1230e51b8274279964f8d2278d12285eb3)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This happens when the set contained several elements with the same hash,
and then some of them were removed.
(cherry picked from commit b8e925b4f8f6c5e28fbebc4f3965bf77610698b3)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
(cherry picked from commit ce8f5f98c6fc95a1704360d986a4d0281eeada79)
Co-authored-by: Duane Griffin <duaneg@dghda.com>
For vectorcall API, the underscore-prefixed provisional names
continue to be available per PEP 590:
https://peps.python.org/pep-0590/#finalizing-the-api
Use `versionadded`, `versionchanged`, and `:no-typesetting:`
to mark this up.
For PyCode API, use `:no-typesetting:` rather than `index::` so that
these are semantically documented as C functions.
(cherry picked from commit 7e8a1b5061313e03f99bc2ffa2062702bcc76426)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Add a note to the readline module documentation stating that
Python 3.13 and later no longer supports readline in the default REPL,
as per gh-118840. Includes workaround using PYTHON_BASIC_REPL.
Update tutorial to remove the reference, and use a different key to
test things out.
(cherry picked from commit 971f387bbb598a481aa8974ddc7a358459030415)
Signed-off-by: Kuang Yu Heng <yuheng3107@gmail.com>
Co-authored-by: Kuang Yu Heng <yuheng3107@gmail.com>
The forkserver was not passing sys.argv to its main() function, causing
sys.argv to be empty during `__main__` module import in child processes. This
fixes a non-obvious regression inadvertently introduced by the gh-126631 main
preloading fix.
(cherry picked from commit 298d5440eb83f2dfd5651bac86d1592ec358d54c)