Commit Graph

111336 Commits

Author SHA1 Message Date
Alex Waygood d9575218d7
bpo-45655: Add ref to union type expressions at top of typing docs (GH-29309) 2021-10-29 21:56:21 +08:00
Vinay Sajip 8a77f59de5
bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) 2021-10-29 14:40:37 +01:00
Tim Golden 7bddd96982
bpo-45621: Small changes to mmap (GH-29247)
* Small tidy-ups / comments
* Use randomized names when testing tagged mmaps to avoid any risk of parallel tests treading on each others' toes
2021-10-29 09:20:21 +01:00
Eric Snow 074fa57506
bpo-45395: Make custom frozen modules additions instead of replacements. (gh-28778)
Currently custom modules (the array set on PyImport_FrozenModules) replace all the frozen stdlib modules. That can be problematic and is unlikely to be what the user wants. This change treats the custom frozen modules as additions instead. They take precedence over all other frozen modules except for those needed to bootstrap the import system. If the "code" field of an entry in the custom array is NULL then that frozen module is treated as disabled, which allows a custom entry to disable a frozen stdlib module.

This change allows us to get rid of is_essential_frozen_module() and simplifies the logic for which frozen modules should be ignored.

https://bugs.python.org/issue45395
2021-10-28 15:04:33 -06:00
Nikita Sobolev 66e6b3dcd3
bpo-45577: test all pickle protocols in `test_zoneinfo` (GH-29167) 2021-10-28 22:22:24 +02:00
Filipe Laíns 233841ab78
bpo-45379: add custom error string for FROZEN_DISABLED (GH-29190)
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Gareth Rees <gdr@garethrees.org>
2021-10-28 22:20:07 +02:00
Carl Friedrich Bolz-Tereick 7401694807
bpo-45624: make test_graphlib not depend on the iteration order of sets (GH-29233)
the current test depended on integer sets being iterated on in a certain
fixed order. That order is different on PyPy (insertion based) and could
change in CPython in the future in theory. Make the test robust against
a different iteration order by sorting.
2021-10-28 22:01:35 +02:00
Alex Waygood 03db1bbfd2
bpo-45655: Add "relevant PEPs" section to ``typing`` documentation (GH-29280)
The list of PEPs at the top of the documentation for the ``typing`` module has
become too long to be readable. This PR proposes presenting this
information in a more structured and readable way by adding a new "relevant
PEPs" section to the ``typing`` docs.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-28 21:55:50 +02:00
Erlend Egeberg Aasland 4dd1e84789
bpo-45612: Add sqlite3 module docstring (GH-29224) 2021-10-28 21:55:27 +02:00
Arthur Milchior d9c1868c25
bpo-45583: Correct datamodel documentation of int() (GH-29182)
It should be noted that this part of the documentation is redundant with
function.rst's documentation of int. This one was correctly updated with Python 3.8.
2021-10-28 21:48:37 +02:00
MalikIdreesHasanKhan cd30613165
Fixed typos (GH-29211) 2021-10-28 21:39:27 +02:00
Nikita Sobolev 1fb968c07a
bpo-45604: add `level` argument to `multiprocessing.log_to_stderr` func (GH-29226)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-10-28 21:38:14 +02:00
Erlend Egeberg Aasland 88d8a1a340
bpo-45608: Document missing `sqlite3` DB-API attributes and methods (GH-29219) 2021-10-28 21:35:51 +02:00
Ned Deily be8318be05
bpo-44828: Avoid tkinter file dialog failure on macOS 12 Monterey (GH-29276)
when using the Tk 8.6.11 provided by python.org macOS installers.
Patch by Marc Culler of the Tk project.
2021-10-28 14:22:05 -04:00
Pablo Galindo Salgado cdc7a58277
bpo-45562: Ensure all tokenizer debug messages are printed to stderr (GH-29270) 2021-10-28 18:06:15 +01:00
Mark Shannon 4fc68560ea
Store actual ints, not pointers to them in the interpreter state. (GH-29274) 2021-10-28 17:35:43 +01:00
Eric Snow 13d9205f40
bpo-45629: Add a test for the "freeze" tool. (gh-29222)
The "freeze" tool has been part of the repo for a long time. However, it hasn't had any tests in the test suite to guard against regressions. We add such a test here. This is especially important as there has been a lot of change recently related to frozen modules, with more to come.

Note that as part of the test we build Python out-of-tree and install it in a temp dir.

https://bugs.python.org/issue45629
2021-10-28 10:14:37 -06:00
Mark Shannon 7f61d9d848
bpo-45256: Rationalize code around Python-to-Python calls a bit. (GH-29235) 2021-10-28 16:14:59 +01:00
Ken Jin 0a1a36b74b
bpo-44525: Add recursive checks for `CALL_FUNCTION_BUILTIN_O` (GH-29271) 2021-10-28 16:02:34 +01:00
Mark Shannon f291404a80
bpo-45637: Store the frame pointer in the cframe (GH-29267)
* Rename 'frame' to 'current_frame'
2021-10-28 13:59:11 +01:00
Justinas Petuchovas 0a68b3603f
Fix typo in Counter documentation (GH-29223)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-10-28 18:43:09 +08:00
Dennis Sweeney d56375a0dd
bpo-30570: Fix segfault on buildbots caused by stack overflow from recursion in tests (GH-29258)
* Don't stackoveflow on debug builds

* Also catch the pickletester case
2021-10-28 11:11:18 +01:00
Christian Heimes 4c95fb4640
bpo-45548: Fix out-of-tree and Debian builds (GH-29263)
Add Modules subdirs to SRCDIRS to generate directories for out-of-tree
object files.

Debian wants ncurses lib. Works on Fedora, too.

Debian also needs pkg-config to detect correct flags.

Remove more outdated comments. Makefile now tracks header dependencies
-lintl is injected by configure when needed. Build _dbm with
gdbm-compat.

Group some modules by purpose. socket, select, and mmap work on Windows,
too.
2021-10-28 11:57:38 +02:00
Alex Waygood b1302abcc8
bpo-44904: Fix classmethod property bug in doctest module (GH-28838)
The doctest module raised an error if a docstring contained an example that
attempted to access a classmethod property. (Stacking '@classmethod' on top of
`@property` has been supported since Python 3.9; see
https://docs.python.org/3/howto/descriptor.html#class-methods.)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-28 10:48:02 +03:00
Martin Rueckl d02ffd1b5c
bpo-45438: format of inspect.Signature with generic builtins (#29212)
Use types.GenericAlias in inspect.formatannotation to correctly add
type arguments of builtin types to the string representation of
Signatures.

Co-authored-by: Martin Rückl <martin.rueckl@codecentric.de>
2021-10-27 14:36:41 -07:00
Pablo Galindo Salgado 10bbd41ba8
bpo-45562: Print tokenizer debug messages to stderr (GH-29250) 2021-10-27 14:27:34 -07:00
Sam Gross 35e1ff38ee
bpo-28737: Document when tp_dealloc should call PyObject_GC_UnTrack() (GH-29246)
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.
2021-10-27 21:15:13 +02:00
Mark Shannon 4776b07d17
Don't make a call at the C level when calling bound-methods from Python code. (GH-29238) 2021-10-27 15:26:22 +01:00
m-aciek bcee6aa315
bpo-45618: Fix documentation build by pinning Docutils version to 0.17.1 (GH-29230)
Co-authored-by: Maciej Olko <maciej.olko@yougov.com>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-10-27 10:21:29 -04:00
Erlend Egeberg Aasland 8f24b7dbcb
bpo-42064: Convert `sqlite3` global state to module state (GH-29073) 2021-10-27 13:12:21 +02:00
Brandt Bucher 82a662e521
bpo-44511: Improve the bytecode for class and mapping patterns (GH-26922)
* Refactor mapping patterns and speed up class patterns.

* Simplify MATCH_KEYS and MATCH_CLASS.

* Add COPY opcode.
2021-10-27 10:45:35 +01:00
Benjamin Peterson 19a6c41e56
Remove unused variables. (GH-29231) 2021-10-26 16:22:34 -07:00
Tim Golden aea5ecc458
bpo-40915: Fix mmap resize bugs on Windows (GH-29213)
(original patch by eryksun)

Correctly hand various failure modes when resizing an mmap on Windows:

* Resizing a pagefile-backed mmap now creates a new mmap and copies data
* Attempting to resize when another mapping is held on the same file raises an OSError
* Attempting to resize a nametagged mmap raises an OSError if another mapping is held with the same nametag
2021-10-26 22:56:43 +01:00
Christian Heimes b5ee79494b
bpo-45548: makesetup improvements (GH-29225)
* record which modules are build as shared extensions
* put object files in same directory as source files
* remove dependency on deleted _math.c

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-26 10:58:43 +02:00
Eric Snow 6afb285ff0
bpo-45020: Add tests for the -X "frozen_modules" option. (gh-28997)
We hadn't explicitly added any tests for this, so here they are.

https://bugs.python.org/issue45020
2021-10-25 15:26:41 -06:00
Christian Heimes 2b8677a3cd
bpo-45548: FreeBSD doesn't like auto vars in makesetup (GH-29216) 2021-10-25 20:52:55 +02:00
Christian Heimes ece916e92c
bpo-45548: Add missing extensions to Modules/Setup (GH-29199)
Adds _ctypes, _decimal, _multiprocessing, _posixshmem, _scproxy, _sqlite3,
and _uuid.

Use Makefile variables to build OpenSSL and TCL/TK modules.

Drop ``-lm`` from math lines. Extensions are always linked against libm.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 20:01:52 +02:00
Christian Heimes 81669d1b7b
bpo-45595: Make extensions depend on header files (GH-29198)
``setup.py`` and ``makesetup`` now track build dependencies on all Python
header files and module specific header files.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 20:01:03 +02:00
Christian Heimes 77e3f224d6
bpo-45548: Remove checks for finite and gamma (GH-29206) 2021-10-25 18:25:43 +02:00
Christian Heimes fa26245a1c
bpo-45548: Remove _math.c workarounds for pre-C99 libm (GH-29179)
The :mod:`math` and :mod:`cmath` implementation now require a C99 compatible
``libm`` and no longer ship with workarounds for missing acosh, asinh,
expm1, and log1p functions.

The changeset also removes ``_math.c`` and moves the last remaining
workaround into ``_math.h``. This simplifies static builds with
``Modules/Setup`` and resolves symbol conflicts.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Co-authored-by: Brett Cannon <brett@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 01:25:27 -07:00
Tim Peters 51ed2c56a1
bpo-45530: speed listobject.c's unsafe_tuple_compare() (GH-29076)
Keep track of whether unsafe_tuple_compare() calls are resolved by the very
first tuple elements, and adjust strategy accordingly. This can significantly
cut the number of calls made to the full-blown PyObject_RichCompareBool(),
and especially when duplicates are rare.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-24 22:27:24 -05:00
Nikita Sobolev 07236d562e
bpo-45566: `test_frozen_pickle` checks all `pickle` protocols (GH-29150)
Refs https://github.com/python/cpython/pull/29147

Automerge-Triggered-By: GH:ericvsmith
2021-10-24 06:06:32 -07:00
William Andrea 9e05da6224
Expand about soft keywords in the docs for keyword.py (GH-29139)
Add link at the top and fix the existing links to point to the "[soft keywords](https://docs.python.org/3.10/reference/lexical_analysis.html#soft-keywords)" section created in the Python 3.10 docs.

Changes should be backported to 3.10 as well.
2021-10-23 09:24:02 -07:00
Filipe Laíns 8ce20bbdd6
bpo-45516: add protocol description to the TraversableResources documentation (#29173)
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-10-23 11:47:55 -04:00
Eric Snow 17c61045c5
bpo-45506: Normalize _PyPathConfig.stdlib_dir when calculated. (#29040)
The recently added PyConfig.stdlib_dir was being set with ".." entries. When __file__ was added for from modules this caused a problem on out-of-tree builds. This PR fixes that by normalizing "stdlib_dir" when it is calculated in getpath.c.

https://bugs.python.org/issue45506
2021-10-22 17:20:03 -06:00
Irit Katriel f30ad65dbf
bpo-45292: [PEP 654] add the ExceptionGroup and BaseExceptionGroup classes (GH-28569) 2021-10-23 00:13:46 +01:00
Nikita Sobolev 4bc5473a42
bpo-45574: fix warning about `print_escape` being unused (GH-29172)
It used to be like this:
<img width="1232" alt="Снимок экрана 2021-10-22 в 23 07 40" src="https://user-images.githubusercontent.com/4660275/138516608-fef6ec01-a96a-40f4-81ef-52265b0f536b.png">

Quick `grep` tells that it is just used in one place under `Py_DEBUG`: f6e8b80d20/Parser/tokenizer.c (L1047-L1051)
<img width="752" alt="Снимок экрана 2021-10-22 в 23 08 09" src="https://user-images.githubusercontent.com/4660275/138516684-ea503136-1e92-48a5-95bb-419e190d5866.png">

I am not sure, but it also looks like a private thing, it should not affect other users.

Automerge-Triggered-By: GH:pablogsal
2021-10-22 14:57:24 -07:00
Dennis Sweeney 423fa1c181
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048)
* Use Py_EnterRecursiveCall() in issubclass()

Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google]
2021-10-22 14:24:08 -07:00
Christian Heimes f6e8b80d20
bpo-45571: use PY_CFLAGS_NODIST for shared Modules/Setup (GH-29161) 2021-10-22 20:02:54 +02:00
Christian Heimes ec93721e00
bpo-45570: Simplify setup macros for pyexpat (GH-29159)
* ``HAVE_EXPAT_CONFIG_H`` is not used by our code and not used by
  system-wide expat header files
* ``USE_PYEXPAT_CAPI`` is no longer used by our code
* ``XML_POOR_ENTROPY`` should be defined in expat_config.h

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-22 09:28:23 -07:00