Commit Graph

120165 Commits

Author SHA1 Message Date
Jeff Allen 8bce593a63
Fix trivial typo in test_interpreters (GH-113381) 2023-12-23 14:10:41 +00:00
Ronald Oussoren 593b4d81d2
gh-74573: document that ndbm can silently corrupt databases on macOS (#113354)
* gh-74573: document that ndbm can silently corrupt databases on macOS

The system ndbm implementation on macOS has an undocumented limitation
on the size of values and can silently corrupt database files when those
are exceeded.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-12-23 13:33:34 +01:00
Serhiy Storchaka 6e02d79f96
gh-113188: Fix shutil.copymode() on Windows (GH-113189)
Previously it worked differently if dst is a symbolic link:
it modified the permission bits of dst itself rather than the file
it points to if follow_symlinks is true or src is not a symbolic link,
and did nothing if follow_symlinks is false and src is a symbolic link.

Also document similar changes in shutil.copystat().
2023-12-23 11:07:54 +00:00
F-park bdc8d667ab
gh-112925: Fix error in example of `datetime.time.fromisoformat` and add doctest marker (GH-112931) 2023-12-23 12:44:27 +02:00
Serhiy Storchaka 4e5b27e6a3
gh-81682: Fix test failures when CPython is built without docstrings (GH-113410) 2023-12-23 09:56:30 +00:00
Erlend E. Aasland c3f92f6a75
gh-113317: Clean up Argument Clinic global namespace (#113414)
Split up clinic.py by establishing libclinic as a support package for
Argument Clinic. Get rid of clinic.py globals by either making them
class members, or by putting them into libclinic.

- Move INCLUDE_COMMENT_COLUMN to BlockPrinter
- Move NO_VARARG to CLanguage
- Move formatting helpers to libclinic
- Move some constants to libclinic (and annotate them as Final)
2023-12-23 00:37:39 +00:00
Erlend E. Aasland 9c3ddf31a3
gh-113317: Remove TextAccumulator type alias from clinic.py (#113413)
Clean-up after gh-113402.
2023-12-22 22:35:16 +00:00
Barney Gale d1c711e757
GH-110109: Adjust `test_pathlib_abc` imports to ease backporting (#113411)
This very boring patch reduces the number of changes needed in
`test_pathlib_abc.py` when backporting to the external `pathlib_abc`
package.
2023-12-22 20:59:17 +00:00
Erlend E. Aasland daa658aba5
gh-113317: Argument Clinic: tear out internal text accumulator APIs (#113402)
Replace the internal accumulator APIs by using lists of strings and join().

Yak-shaving for separating out formatting code into a separate file.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-22 21:28:15 +01:00
Barney Gale a0d3d3ec9d
GH-110109: pathlib ABCs: do not vary path syntax by host OS. (#113219)
Change the value of `pathlib._abc.PurePathBase.pathmod` from `os.path` to
`posixpath`.

User subclasses of `PurePathBase` and `PathBase` previously used the host
OS's path syntax, e.g. backslashes as separators on Windows. This is wrong
in most use cases, and likely to catch developers out unless they test on
both Windows and non-Windows machines.

In this patch we change the default to POSIX syntax, regardless of OS. This
is somewhat arguable (why not make all aspects of syntax abstract and
individually configurable?) but an improvement all the same.

This change has no effect on `PurePath`, `Path`, nor their subclasses. Only
private APIs are affected.
2023-12-22 18:09:50 +00:00
Barney Gale ff5e131df5
GH-112855: Slightly improve tests for `pathlib.PurePath` pickling (#113243)
Add a few more simple test cases, like non-anchored paths. Remove misplaced
and indirect test that pickling doesn't change the `stat()` value.
2023-12-22 17:49:09 +00:00
Yan Yanchii 4a3d2419bb
gh-113212: Improve error message & document zero-arg super inside nested functions and generator expressions (GH-113307) 2023-12-22 17:12:08 +02:00
Barney Gale 237e2cff00
GH-110109: Fix misleading `pathlib._abc.PurePathBase` repr (#113376)
`PurePathBase.__repr__()` produces a string like `MyPath('/foo')`. This
repr is incorrect/misleading when a subclass's `__init__()` method is
customized, which I expect to be the very common.

This commit moves the `__repr__()` method to `PurePath`, leaving
`PurePathBase` with the default `object` repr.

No user-facing changes because the `pathlib._abc` module remains private.
2023-12-22 15:11:16 +00:00
Mark Shannon 45e09f921b
GH-112215: Increase C recursion limit for non debug builds (GH-113397) 2023-12-22 14:25:25 +00:00
Ronald Oussoren 5f665e99e0
gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set (#113378)
* gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set

This fixes the existing tests when PYTHONIOENCODING is
set by unsetting PYTHONIOENCODING.

Also add a test that explicitly checks what happens
when PYTHONIOENCODING is set.

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-12-22 12:09:16 +01:00
Ronald Oussoren bee627c1e2
gh-113384: Skip test_freeze for framework builds on macOS (#113390) 2023-12-22 11:35:54 +01:00
Irit Katriel c31943af16
gh-113297: Fix segfault in compiler for with statement with 19 context managers (#113327) 2023-12-22 01:50:26 +00:00
Sam Gross 9afb0e1606
gh-112027: Don't print mimalloc warning after mmap() call (gh-113372)
gh-112027: Don't print mimalloc warning after mmap

This changes the warning to a "verbose"-level message in prim.c. The
address passed to mmap is only a hint -- it's normal for mmap() to
sometimes not respect the hint and return a different address.
2023-12-22 09:38:27 +09:00
Alex Waygood 7de9855410
Bump mypy to 1.8.0 (#113385) 2023-12-21 23:14:24 +00:00
Raymond Hettinger d058eaeed4
gh-113157 gh-89519: Fix method descriptors (gh-113233)
Restore behaviors before classmethod descriptor chaining was introduced.
2023-12-21 16:08:35 -06:00
Raymond Hettinger 6a5b4736e5
gh-113313: Note that slice support is not required for all sequences. (gh-113377) 2023-12-21 15:54:59 -06:00
Sam Gross 31d8757b60
gh-113370: Add missing obmalloc.o dependencies on mimalloc (#113371) 2023-12-21 22:44:55 +01:00
Shantanu 61e8184095
gh-95754: Better AttributeError on partially initialised module (#112577)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-21 13:24:10 -08:00
Jason R. Coombs 2d91409c69
gh-113174: Sync with importlib_metadata 7.0 (#113175)
* Sync with importlib_metadata 7.0.0

* Add blurb

* Update docs to reflect changes.

* Link datamodel docs for object.__getitem__

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Add what's new for removed __getattr__

* Link datamodel docs for object.__getitem__

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Add exclamation point, as that seems to be used for other classes.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-21 15:04:05 -05:00
Namhyung Kim 6b70c3dc5a
gh-113343: Fix error check on mmap(2) (#113342)
Fix error check on mmap(2)

It should check MAP_FAILED instead of NULL for error.

On mmap(2) man page:

  RETURN VALUE
       On success, mmap() returns a pointer to the mapped area.
       On error, the value MAP_FAILED (that is, (void *) -1) is
       returned, and errno is set to indicate the error.
2023-12-21 19:28:55 +00:00
Serhiy Storchaka 5f7a80fd02
gh-113325: Remove a debugging print accidentally left in test_symtable (GH-113368) 2023-12-21 20:12:07 +02:00
Ronald Oussoren df1eec3dae
gh-65701: document that freeze doesn't work with framework builds on macOS (#113352)
* gh-65701: document that freeze doesn't work with framework builds on macOS

The framework install is inherently incompatible with freeze. Document
that that freeze doesn't work with framework builds and bail out
early when trying to run freeze anyway.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-12-21 16:28:00 +01:00
Erlend E. Aasland 526d0a9b6e
gh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (#113355)
Clarify split direction in the docstring body,
instead of in the 'maxsplit' param docstring.
2023-12-21 15:22:39 +01:00
Ronald Oussoren ca8b1d0958
gh-87277: Don't look for X11 browsers on macOS in webbrowser (#24480)
The installation of XQuartz on macOS will unconditionally
set the $DISPLAY variable. The X11 server will be launched
when a program tries to access the display.  This results
in launching the X11 server when using the webbrowser module,
even though X11 browsers won't be used in practice.
2023-12-21 14:43:38 +01:00
Mark Shannon 723f4d6698
GH-111485: Delete the old generator code. (GH-113321) 2023-12-21 12:46:28 +00:00
Erlend E. Aasland fae096cd4b
gh-113336: Remove the 'version' directive from Argument Clinic (#113341)
The 'version' directive was introduced with gh-63929 in Nov 2013. It has
not been in use in the CPython code base, and the 'version' variable has
never been bumped.
2023-12-21 13:10:41 +01:00
Erlend E. Aasland 4b90b5d857
Docs: update URL in Argument Clinic CLI help text (#113351)
The Argument Clinic docs was moved to the devguide earlier in 2023.
2023-12-21 09:28:43 +00:00
Jan Brasna 24f8ff28a3
Docs: OpenSSL wording ambiguity (#113296) 2023-12-21 00:50:25 -07:00
Gregory P. Smith 103c4ea274
gh-112305: Fix check-clean-src to detect frozen_modules .h files. (#113344)
A typo left this check broken so many of us who do out-of-tree builds
were seeing strange failures due to bad `Python/frozen_modules/*.h`
files being picked up from the source tree and used at build time from
different Python versions leading to errors like:

`Fatal Python error: _PyImport_InitCore: failed to initialize importlib`

Or similar once our build got to an "invoke the interpreter"
bootstrapping step due to incorrect bytecode being embedded.
2023-12-20 23:32:13 -08:00
Carey Metcalfe a2dd0e7038
gh-111375: Use `NULL` rather than `None` in the exception stack to indicate that an exception was handled (#113302) 2023-12-21 01:46:41 +00:00
Martijn Pieters 1ff0238594
GH-113214: Fix SSLProto exception handling in SSL-over-SSL scenarios (#113334)
When wrapped, `_SSLProtocolTransport._force_close(exc)` is called just like in the unwrapped scenario `_SelectorTransport._force_close(exc)` or `_ProactorBasePipeTransport._force_close(exc)` would be called, except here the exception needs to be passed through the `SSLProtocol._abort()` method, which didn't accept an exception object.

This commit ensures that this path works, in the same way that the uvloop implementation of SSLProto passes on the exception (on which the current implementation of SSLProto is based).
2023-12-20 15:09:01 -08:00
Sam Gross a3e8afe0a3
gh-113330: Fix mimalloc headers reference (#113331)
The `MIMALLOC_HEADERS` variable is defined in the Makefile.pre.in, not
the configure script, so we should use the `$(MIMALLOC_HEADERS)` syntax
instead of the `@MIMALLOC_HEADERS@` syntax.
2023-12-20 22:07:17 +01:00
Guido van Rossum 713e42822f
GH-111485: Fix DEFAULT_OUTPUT in opcode_metadata_generator.py (#113324) 2023-12-20 10:05:48 -08:00
Seth Michael Larson b221e03010
gh-113257: Automatically generate pip SBOM metadata from wheel (#113295)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-12-20 17:28:20 +00:00
Kir 11ee912327
gh-113255: Clarify docs for `typing.reveal_type` (#113286)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-12-20 17:21:23 +00:00
Mark Shannon de8a4e52a5
GH-111485: Generate `TARGET` table for computed goto dispatch. (GH-113319) 2023-12-20 15:09:12 +00:00
Mark Shannon e96f26083b
GH-111485: Generate instruction and uop metadata (GH-113287) 2023-12-20 14:27:25 +00:00
Christopher Chavez a545a86ec6
gh-111178: Make slot functions in typeobject.c have compatible types (GH-112752) 2023-12-20 15:13:44 +01:00
Donghee Na 57b7e52790
gh-112205: Support docstring for `@getter` (#113160)
---------

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-12-20 21:52:12 +09:00
Rodrigo Girão Serrão 5a7cc667f8
Fix typo in datamodel docs (#113314)
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-12-20 11:58:38 +00:00
David Greaves 22b8945d76
Fix typo in collections.abc docs example (#113310)
Calling the instance reference arg for the __next__ method, "next", seems misleading as it would normally just be "self"
2023-12-20 09:51:16 +00:00
Ethan Furman 4afa7be32d
add Ujan to ACKS for work on enum docs (GH-113301) 2023-12-19 17:55:24 -08:00
Erlend E. Aasland 14d4c7742a
gh-111973: Update Windows installer to use SQLite 3.44.2 (#113281) 2023-12-19 23:31:52 +01:00
Marat Idrisov e1117cb886
gh-87264: Convert tarinfo type to stat type (GH-113230)
Co-authored-by: val-shkolnikov <val@nvsoft.net>
2023-12-19 11:04:43 -08:00
Erlend E. Aasland 6a1d5a4c0f
gh-111973: Update macOS installer to use SQLite 3.44.2 (GH-113279) 2023-12-19 13:23:52 -05:00