Commit Graph

124445 Commits

Author SHA1 Message Date
beavailable 0c5c80928c
gh-126896: Fix docs about `asyncio.start_server()` (#126897) 2024-11-17 11:32:35 -08:00
Filipe Laíns 🇵🇸 9d6366b60d
GH-126920: fix Makefile overwriting sysconfig.get_config_vars 2024-11-17 01:56:01 +00:00
Filipe Laíns 🇵🇸 acbd5c9c6c
GH-126789: fix some sysconfig data on late site initializations 2024-11-17 00:07:25 +00:00
RanKKI ed81971e6b
gh-124452: Fix header mismatches when folding/unfolding with email message (#125919)
The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-16 18:01:52 -05:00
Hood Chatham 2313f84210
GH-126748: amend configure.rst description for the 'build_wasm' make target (#126687)
Clarified the documentation around how the build_wasm target is selected.
2024-11-16 09:46:39 +08:00
Hood Chatham 544b001b23
gh-126691: Remove --with-emscripten-target (#126787)
This unifies the code for nodejs and the code for the browser. After this
commit, the browser example doesn't work; this will be fixed in a
subsequent update.
2024-11-16 09:44:05 +08:00
Alex Gaynor d6bcc154e9
Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659)
This was flagged to me at a party today by someone who works in red-teaming as a frequently encountered footgun. Documenting the potentially unexpected behavior seemed like a good place to start.
2024-11-15 18:09:05 -05:00
Beomsoo Kim 94a7a4e22f
Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720)
* Replace: The :keyword:`global` -> The :keyword:`global` statement
Add :keyword: when it's needed

* Replace repeated links with duoble backticks
2024-11-15 13:02:34 -08:00
Nadeshiko Manju 3be7498d24
gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-11-15 11:03:06 -08:00
Seth Michael Larson a2c180f4e7
Add PEP 761 to What's New (#126550)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-15 15:54:56 +00:00
Bénédikt Tran 612ac283b8
gh-122549: Add platform.invalidate_caches() (#122547)
Allow to invalidate platform's cached results.
2024-11-15 13:52:56 +00:00
Peter Bierma 08f98f4576
Fix intermittent failures for the `PyUnstable_Object_EnableDeferredRefcount` tests (GH-126849)
Hotfix for the PyUnstable_Object_EnableDeferredRefcount tests.
2024-11-15 14:03:46 +01:00
Petr Viktorin d00f7b1b9d
gh-125063: marshal: Add version 5, improve documentation (GH-126829)
* Document that slices can be marshalled
* Deduplicate and organize the list of supported types
  in docs
* Organize the type code list in marshal.c, to make
  it more obvious that this is a versioned format
* Back-fill some historical info

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-11-15 13:48:57 +01:00
Bénédikt Tran e17486982c
gh-89083: small docs fixup for UUIDv8 (#126857) 2024-11-15 14:26:38 +02:00
Steve Dower 9332a6f825
gh-118973: Add _tkinter to freethreaded MSI (GH-126768) 2024-11-15 12:22:56 +00:00
Peter Bierma d4c72fed8c
gh-126312: Don't traverse frozen objects on the free-threaded build (#126338)
Also, _PyGC_Freeze() no longer freezes unreachable objects.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-11-15 11:21:30 +01:00
George Alexopoulos 8717f792f7
gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555)
For dlsym(), a return value of NULL does not necessarily indicate
an error [1].

Therefore, to avoid using stale (or NULL) dlerror() values, we must:

 1. clear the previous error state by calling dlerror()
 2. call dlsym()
 3. call dlerror()

If the return value of dlerror() is not NULL, an error occured.

In ctypes we choose to treat a NULL return value from dlsym()
as a "not found" error. This is the same as the fallback
message we use on Windows, Cygwin or when getting/formatting
the error reason fails.

[1]: https://man7.org/linux/man-pages/man3/dlsym.3.html

Signed-off-by: Georgios Alexopoulos <grgalex42@gmail.com>
Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-15 11:05:51 +01:00
Mark Shannon c0f045f7fd
GH-124567: Reduce overhead of debug build for GC. Should help CI performance (GH-126777) 2024-11-15 08:59:01 +00:00
Sergey B Kirpichev d9e251223e
gh-103951: enable optimization for fast attribute access on module subclasses (GH-126264)
Co-authored-by: Nicolas Tessore <n.tessore@ucl.ac.uk>
2024-11-15 16:03:38 +08:00
Victor Stinner 3fecbe9255
gh-126433: Update hacl-star (GH-126791)
Retrieve the change: "Lib_Memzero0.c: Fix compiler warning on 32-bit Windows".
2024-11-15 00:22:50 +00:00
Tomas R. 9a456383be
gh-126807: pygettext: Do not attempt to extract messages from function definitions. (GH-126808)
Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
2024-11-14 22:17:42 +00:00
Barney Gale cae9d9d20f
GH-126766: `url2pathname()`: handle empty authority section. (#126767)
Discard two leading slashes from the beginning of a `file:` URI if they
introduce an empty authority section. As a result, file URIs like
`///etc/hosts` are correctly parsed as `/etc/hosts`.
2024-11-14 20:22:14 +00:00
Marc Culler 47cbf03885
gh-124111: Update tkinter for compatibility with Tcl/Tk 9.0.0 (GH-124156) 2024-11-14 12:45:08 -06:00
RUANG (James Roy) 1e3497e745
gh-126061: add new functions to `refcounts.dat` (#126788) 2024-11-14 15:04:38 +01:00
Mark Shannon 3966d8d626
GH-117759: Update GC docs for incremental collection (GH-126695) 2024-11-14 09:50:00 +00:00
Petr Viktorin ff0ef0a54b
gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182)
* gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance

This changes nothing changes for CPython supported platforms,
but hints how to deal with platforms that stick to the letter of
the spec.
It also marks `socket.getaddrinfo` as a wrapper around `getaddrinfo(3)`;
specifically, workarounds to make the function work consistently across
platforms are out of scope in its code.

Include wording similar to the POSIX's “by providing options and by
limiting the returned information”, which IMO suggests that the
hints limit the resulting list compared to the defaults, *but* can
be interpreted differently. Details are added in a note.

Specifically say that this wraps the underlying C function. So, the
details are in OS docs. The “full range of results” bit goes away.

Use `AF_UNSPEC` rather than zero for the *family* default, although
I don't think a system where it's nonzero would be very usable.

Suggest setting proto and/or type (with examples, as the appropriate
values aren't obvious). Say why you probably want to do that that
on all systems; mention the behavior on the “letter of the spec”
systems.

Suggest that the results should be tried in order, which is,
AFAIK best practice -- see RFC 6724 section 2, and its predecessor
from 2003 (which are specific to IP, but indicate how people use this):

> Well-behaved applications SHOULD iterate through the list of
> addresses returned from `getaddrinfo()` until they find a working address.


Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-14 09:31:14 +01:00
John Marshall e0692f1165
Document that return-less user-defined functions return None (#126769)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-14 07:47:24 +00:00
Colin Watson 73e34b6808
Doc: Recommend shlex.quote alongside pipes removal (#126570)
One of the most common reasons I see the old `pipes` module still in use
when porting to Python 3.13 is for the undocumented `pipes.quote`
function, which can easily be replaced with `shlex.quote`.  I think it's
worth specifically calling this out, since being directed to the
`subprocess` module would be confusing in this case.
2024-11-14 05:01:35 +00:00
Wulian 6a93a1adbb
gh-126731: Update outdated project information in `pprint.pp` doc (#126732) 2024-11-13 20:58:06 -08:00
Savannah Ostrowski 4ae50615d2
Add Savannah to CODEOWNERS for argparse and the JIT (#126814)
Add Savannah to CODEOWNERS
2024-11-13 15:45:08 -08:00
Barney Gale fd4b5453df
GH-118289: Fix handling of non-directories in `posixpath.realpath()` (#120127)
In strict mode, raise `NotADirectoryError` if we encounter a non-directory
while we still have path parts left to process.

We use a `part_count` variable rather than `len(rest)` because the `rest`
stack also contains markers for unresolved symlinks.
2024-11-13 22:59:32 +00:00
CF Bolz-Tereick c695e37a3f
GH-126606: don't write incomplete pyc files (GH-126627)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Brett Cannon <brett@python.org>
2024-11-13 21:39:10 +00:00
Stéphane Bidoul f6b0361c17
gh-126188: Update bundled pip to 24.3.1 (gh-126805)
Update bundled pip to 24.3.1
2024-11-13 20:58:57 +00:00
Hood Chatham 142104ce78
gh-89640: Pull in update to float word order detection in autoconf-archive (#126747) 2024-11-13 21:57:33 +01:00
Serhiy Storchaka 35010b8cf2
gh-126390: Support for preserving order of options and nonoption arguments in gnu_getopt() (GH-126393) 2024-11-13 22:50:46 +02:00
sobolevn 12ca7e622f
gh-109413: Enable `strict_optional` for `libregrtest/main.py` (#126394) 2024-11-13 22:29:28 +03:00
Seth Michael Larson 3c99969094
gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792)
Update libexpat to 2.6.4, make future updates easier.
2024-11-13 18:31:20 +00:00
neonene 8c9c6d3c12
gh-123465: Ensure PyType_FromMetaclass avoids extra strcmp (GH-125460)
use else
2024-11-13 17:09:26 +00:00
Victor Stinner b2bbdc56e3
gh-126456: Fix _pyrepl curses tigetstr() (#126472) 2024-11-13 17:46:10 +01:00
Peter Bierma d00878b06a
gh-123619: Add an unstable C API function for enabling deferred reference counting (GH-123635)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-11-13 13:27:16 +00:00
Taneli Hukkinen 29b5323c45
gh-126175: Add attributes to TOMLDecodeError. Deprecate free-form `__init__` args (GH-126428) 2024-11-13 13:52:16 +01:00
Ritvik Pasham a12690ef49
gh-126341: add release check to `__iter__` method of `memoryview` (#126759)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-13 11:51:01 +00:00
Petr Viktorin ba088c8f9c
gh-71936: Fix race condition in multiprocessing.Pool (GH-124973)
* gh-71936: Fix race condition in multiprocessing.Pool

Proxes of shared objects register a Finalizer in BaseProxy._incref(), and it
will call BaseProxy._decref() when it is GCed. This may cause a race condition
with Pool(maxtasksperchild=None) on Windows.

A connection would be closed and raised TypeError when a GC occurs between
_ConnectionBase._check_writable() and _ConnectionBase._send_bytes() in
_ConnectionBase.send() in the second or later task, and a new object
is allocated that shares the id() of a previously deleted one.

Instead of using the id() of the token (or the proxy), use a unique,
non-reusable number.

Co-Authored-By: Akinori Hattori <hattya@gmail.com>
2024-11-13 10:25:10 +01:00
Red4Ru 1e40c5ba47
gh-104745: Limit starting a patcher more than once without stopping it (#126649)
Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-13 08:20:38 +00:00
Andrew Svetlov 2e39d77dde
bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (#30196)
* Strip IsolatedAsyncioTestCase frames from reported stacktraces

* Update Misc/NEWS.d/next/Library/2021-12-19-10-47-24.bpo-46128.Qv3EK1.rst

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

---------

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-11-13 05:24:33 +01:00
Yuxuan Zhang 8cc6e5c875
gh-126757: fix minor typo (GH-126758) 2024-11-12 13:23:40 -08:00
Nice Zombies 4b00aba42e
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938) 2024-11-12 21:18:03 +00:00
Sam Gross 5610860840
gh-126688: Reinit import lock after fork (#126692)
The PyMutex implementation supports unlocking after fork because we
clear the list of waiters in parking_lot.c. This doesn't work as well
for _PyRecursiveMutex because on some systems, such as SerenityOS, the
thread id is not preserved across fork().
2024-11-12 15:53:58 -05:00
Barney Gale bf224bd7ce
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)
Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.
2024-11-12 19:52:30 +00:00
Serhiy Storchaka 7577307ebd
gh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)
Accepting objects with false values (like 0 and []) except empty strings
and byte-like objects and None in urllib.parse functions parse_qsl() and
parse_qs() is now deprecated.
2024-11-12 21:10:29 +02:00