Commit Graph

111306 Commits

Author SHA1 Message Date
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
Serhiy Storchaka b781cc3bfc
bpo-45502: Fix test_shelve (GH-29003)
Run test_shelve with all underlying dbm implementations and pickle protocols.
Also make test_shelve discoverable.
2021-10-22 16:14:58 +02:00
Christian Heimes 03e9f5dc75
bpo-43974: Move Py_BUILD_CORE_MODULE into module code (GH-29157)
setup.py no longer defines Py_BUILD_CORE_MODULE. Instead every
module defines the macro before #include "Python.h" unless
Py_BUILD_CORE_BUILTIN is already defined.

Py_BUILD_CORE_BUILTIN is defined for every module that is built by
Modules/Setup.

The PR also simplifies Modules/Setup. Makefile and makesetup
already define Py_BUILD_CORE_BUILTIN and include Modules/internal
for us.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-22 15:36:28 +02:00
Pablo Galindo Salgado 86dfb55d2e
bpo-45562: Only show debug output from the parser in debug builds (GH-29140) 2021-10-22 01:52:24 -07:00
Petr Viktorin 276468dddb
bpo-43795: Add a test for Stable ABI symbol availability using ctypes (GH-26354)
This is a cross-platform check that the symbols are actually
exported in the ABI, not e.g. hidden in a macro.

Caveat: PyModule_Create2 & PyModule_FromDefAndSpec2 are skipped.

These aren't exported on some of our buildbots. This is a bug
(bpo-44133). This test now makes sure all the others don't regress.
2021-10-22 10:12:06 +02:00
Gregory P. Smith 843b890334
bpo-43592: Raise RLIMIT_NOFILE in test.libregrtest (GH-29127)
Raise RLIMIT_NOFILE in test.libregrtest.

On macOS the default is often too low for our testsuite to succeed.

Co-authored by reviewer: Victor Stinner
2021-10-21 18:22:25 -07:00
Brett Cannon 01cf4fb9c1
bpo-45548: Make `Modules/Setup` easier to read (GH-29143) 2021-10-21 17:07:26 -07:00
Zachary Ware 098a33f6a6
bpo-29844: Remove obsolete paragraph from Tools/msi/README.txt (GH-29141) 2021-10-21 19:02:12 -05:00
Dong-hee Na 83f202a802
bpo-43706: Use PEP 590 vectorcall to speed up enumerate() (GH-25154) 2021-10-22 08:20:43 +09:00
Dong-hee Na 37fad7d3b7
bpo-44019: Add test_all_exported_names for operator module (GH-29124) 2021-10-22 07:58:04 +09:00
Mark Dickinson d1b24775b4
bpo-44547: Make Fractions objects instances of typing.SupportsInt (GH-27851)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-22 00:09:47 +02:00
andrei kulakov 51375388be
bpo-41983: add availability info to socket docs (GH-27519)
* add availability info to AF_PACKET section

* add availability for AF_QIPCRTR as well
2021-10-21 23:13:37 +02:00
Neil Schemenauer 0224b7180b
bpo-45526: obmalloc radix use 64 addr bits (GH-29062)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-21 23:05:46 +02:00
Mark Dickinson 887a55705b
bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-21 22:57:49 +02:00
Eric V. Smith 087f089e5e
bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129) 2021-10-21 16:42:55 -04:00
Ryan Mast 3754f55b36
Add workflow_dispatch trigger to GHA workflows (GH-27873) 2021-10-21 22:34:18 +02:00
E-Paine add46f8476
bpo-45160: Ttk optionmenu only set variable once (GH-28291) 2021-10-21 22:25:52 +02:00
Nikita Sobolev 0c4c2e6213
Move several typing tests to a proper class, refs GH-28563 (GH-29126) 2021-10-21 22:16:50 +02:00
Neil Schemenauer 311910b31a
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051)
MAP_BOT_LENGTH was incorrectly used to compute MAP_TOP_MASK instead of
MAP_TOP_LENGTH. On 64-bit machines, the error causes the tree to hold
46-bits of virtual addresses, rather than the intended 48-bits.
2021-10-21 06:38:36 -07:00
Christian Heimes 9942f42a93
bpo-45522: Allow to disable freelists on build time (GH-29056)
Freelists for object structs can now be disabled. A new ``configure``
option ``--without-freelists`` can be used to disable all freelists
except empty tuple singleton. Internal Py*_MAXFREELIST macros can now
be defined as 0 without causing compiler warnings and segfaults.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-21 06:12:20 -07:00
Thomas 5a14f71fe8
bpo-34451: Document prompt and output toggle feature in html tutorial (GH-27105) 2021-10-21 12:19:20 +02:00
Kreus Amredes a53456e587
bpo-44019: Add operator.call() to __all__ for the operator module (GH-29110) 2021-10-21 19:05:36 +09:00
Petr Viktorin 8a310dd5f4
bpo-45315: PyType_FromSpec: Copy spec->name and have the type own the memory for its name (GH-29103) 2021-10-21 11:46:20 +02:00
Ken Jin 2cbf50e812
bpo-44220: Export PyStructSequence_UnnamedField in the limited API (GH-26331) 2021-10-21 10:46:48 +02:00
Ethan Furman 7c4d96103c
bpo-44174: [Enum] add reference to name mangling (GH-29116) 2021-10-20 20:32:11 -07:00
Brett Cannon dd86f63b55
bpo-45548: add some missing entries to `Modules/Setup` (GH-29115)
Also remove a duplicate entry for `_weakref`.
2021-10-20 17:34:49 -07:00
Barry Warsaw 876fc7fcec
bpo-35673: Add a public alias for namespace package __loader__ attribute (#29049)
Rename namespace package __loader__ class to be public.

Make the old name, i.e. _NamespaceLoader, an alias for the public name, for backward compatibility.
2021-10-20 14:05:29 -07:00
Kyungmin Lee 6270d3eeaf
bpo-45192: Fix a bug that infers the type of an os.PathLike[bytes] object as str (GH-28323)
An object implementing the os.PathLike protocol can represent a file
system path as a str or bytes object.
Therefore, _infer_return_type function should infer os.PathLike[str]
object as str type and os.PathLike[bytes] object as bytes type.
2021-10-20 21:54:41 +02:00
Mark Shannon bc85eb7a4f
bpo-45527: Don't count cache hits, just misses. (GH-29092) 2021-10-20 20:53:48 +02:00
Hugo van Kemenade d89fb9a5a6
bpo-45320: Remove long-deprecated inspect methods (GH-28618) 2021-10-20 20:48:55 +02:00
Zackery Spytz d8e1819251
bpo-41374: Remove obsolete exclusion of netinet/tcp.h on Cygwin (GH-21649) 2021-10-20 18:14:59 +01:00