Commit graph

111268 commits

Author SHA1 Message Date
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
Jeong YunWon
d2cd5eef0c
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100) 2021-10-21 02:09:03 +09:00
Łukasz Langa
dff0b71343
bpo-45464: [doc] Explain that subclassing multiple exceptions is fragile (GH-29094)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-10-20 18:54:31 +02:00
Gregory P. Smith
1dfac27dff
Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079) 2021-10-20 09:17:52 -07:00
Christian Heimes
81520fe677
bpo-45536: Check OpenSSL APIs in configure (GH-29088) 2021-10-20 17:18:34 +02:00
Alex Waygood
d9e1dae35a
Add PEPs 593 & 647 to list of PEPs at top of typing docs (GH-29097) 2021-10-20 23:15:59 +08:00
Barry Warsaw
6ef4507c74
Add a comment about how to fix bogus test_host_resolution_bad_address failures (#29085) 2021-10-20 08:08:57 -07:00
Mark Shannon
8863a0fcc5
bpo-44525: Specialize simple Python calls. (GH-29033) 2021-10-20 16:08:28 +01:00
Serhiy Storchaka
8d6740f489
bpo-45229: Make doctest tests discoverable (GH-28986) 2021-10-20 16:36:27 +02:00
Thomas Grainger
a774285e7d
bpo-25625: [doc] fix async/aync typo (GH-29091) 2021-10-20 15:51:07 +02:00
Petr Viktorin
98fa3b53e2
bpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)
Also, reword the What's New messages: this doesn't change the limited API, it only brings the Py_LIMITED_API macro closer to the ideal of only allowing the limited API.

Automerge-Triggered-By: GH:encukou
2021-10-20 02:32:14 -07:00
Zachary Ware
085ccb0f17
bpo-38371: Remove remaining use of tk.split from bigmem tcl test (GH-29082) 2021-10-19 22:34:23 -05:00
Zachary Ware
4fe454c6f5
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077)
Since v8.6.11, a few configuration options seem to accept an empty value
where they did not previously; particularly the `type` of a `Menu`
widget, and the `compound` of any ttk widget with a label.  Providing an
explicit expected error message to `checkEnumParam` bypasses the check
of an empty value, which no longer raises `TclError`.
2021-10-19 21:54:19 -05:00
Ken Jin
3163e68c34
bpo-44525: Specialize `CALL_FUNCTION` for C function calls (GH-26934) 2021-10-20 00:16:36 +01:00
Filipe Laíns
3592980f91
bpo-25625: add contextlib.chdir (GH-28271)
Added non parallel-safe :func:`~contextlib.chdir` context manager to change
the current working directory and then restore it on exit. Simple wrapper
around :func:`~os.chdir`.

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-20 00:19:27 +02:00
Alex Waygood
ad6d162e51
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034)
In Python 3.8 and 3.9, stacking `@functools.singledispatchmethod` on top of
`@classmethod` or `@staticmethod` caused an exception to be raised if the
method was registered using type-annotations rather than
`@method.register(int)`. This was not caught by unit tests, however, as the
tests only tested the `@method.register(int)` way of registering additional
implementations. The bug is no longer present in Python 3.10+, but
`test_functools.py` is still lacking regression tests for these cases. This
commit adds these test cases.
2021-10-19 22:30:27 +02:00
Eric Snow
f4b12440cf
bpo-45506: Go back to not running most of test_embed in out-of-tree builds. (gh-29063)
In gh-28954 I adjusted how test_embed determines if it should be skipped. That broke out-of-tree builds. This change fixes them.

https://bugs.python.org/issue45506
2021-10-19 14:11:16 -06:00
Pablo Galindo Salgado
a106343f63
bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993)
There are two errors that this commit fixes:

* The parser was not correctly computing the offset and the string
  source for E_LINECONT errors due to the incorrect usage of strtok().
* The parser was not correctly unwinding the call stack when a tokenizer
  exception happened in rules involving optionals ('?', [...]) as we
  always make them return valid results by using the comma operator. We
  need to check first if we don't have an error before continuing.
2021-10-19 21:24:12 +02:00
Julien Palard
bda69abe84
[doc]: Fix missing space in c-api/init.rst and add rstlint rule (GH-28988) 2021-10-19 21:13:24 +02:00
Serhiy Storchaka
975b94b9de
bpo-45500: Rewrite test_dbm (GH-29002)
* Generate test classes at import time. It allows to filter them when
  run with unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v".
* Create a database class in a new directory which will be removed after
  test. It guarantees that all created files and directories be removed
  and will not conflict with other dbm tests.
* Restore dbm._defaultmod after tests. Previously it was set to the last
  dbm module (dbm.dumb) which affected other tests.
* Enable the whichdb test for dbm.dumb.
* Move test_keys to the correct test class. It does not test whichdb().
* Remove some outdated code and comments.
2021-10-19 21:11:28 +02:00
Filipe Laíns
236e301b8a
bpo-42174: fallback to sane values if the columns or lines are 0 in get_terminal_size (GH-29046)
I considered only falling back when both were 0, but that still seems
wrong, and the highly popular rich[1] library does it this way, so I
thought we should probably inherit that behavior.

[1] https://github.com/willmcgugan/rich

Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-19 20:42:13 +02:00
Serhiy Storchaka
574241632b
bpo-42222: Improve tests for invalid argument types in randrange() (GH-29021) 2021-10-19 20:40:30 +02:00
Gregory P. Smith
fdbdf3f735
bpo-40360: Make the 2to3 deprecation more obvious. (GH-29064) 2021-10-19 20:28:27 +02:00
Filipe Laíns
7bafa0cf58
bpo-45449: add note about PEP 585 in collections.abc's documentation (GH-29047)
Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-19 20:18:50 +02:00
Paul Ganssle
8e40ca127f
Add zoneinfo to the datetime documentation (GH-29038)
We should have done this way back when 3.9 was released, but it fell off
the radar.

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
2021-10-19 20:09:41 +02:00
Ken Jin
6e35b096ac
Record cache hits for BINARY_SUBSCR specializations (GH-29060) 2021-10-19 17:25:31 +01:00
Erlend Egeberg Aasland
09c04e7f0d
bpo-42064: Add module backref to sqlite3 callback context (GH-28242) 2021-10-19 15:44:45 +02:00
Erlend Egeberg Aasland
8702b667d8
bpo-43851: Build SQLite with SQLITE_OMIT_AUTOINIT on Windows (GH-25414) 2021-10-19 11:59:57 +01:00
Victor Stinner
52af0756b2
bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)
The Python 3.11 limited C API no longer includes stdlib.h, stdio.h,
string.h and errno.h.

* Exclude Py_MEMCPY() from Python 3.11 limited C API.
* xxlimited C extension is now built with Python 3.11 limited C API.
2021-10-19 12:10:22 +02:00
Inada Naoki
0a4c82ddd3
bpo-45475: Revert __iter__ optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016)
This reverts commit d2a8e69c2c.
2021-10-19 11:51:48 +09:00
Filipe Laíns
c029567530
bpo-45516: use documentation links in TraversableResources' description (GH-29045)
I think this makes the documentation much more digestible :)

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-10-18 20:52:28 -04:00
Victor Stinner
5f09bb021a
bpo-35134: Add Include/cpython/longobject.h (GH-29044)
Move Include/longobject.h non-limited API to a new
Include/cpython/longobject.h header file.

Move the following definitions to the internal C API:

* _PyLong_DigitValue
* _PyLong_FormatAdvancedWriter()
* _PyLong_FormatWriter()
2021-10-19 02:04:52 +02:00
Victor Stinner
aad88d33d9
bpo-35134: Split warnings.h and weakrefobject.h (GH-29042)
Split header files to move the non-limited API to Include/cpython/:

* Include/warnings.h => Include/cpython/warnings.h
* Include/weakrefobject.h => Include/cpython/weakrefobject.h

Exclude PyWeakref_GET_OBJECT() from the limited C API. It never
worked since the PyWeakReference structure is opaque in the limited C
API.

Move _PyWarnings_Init() and _PyErr_WarnUnawaitedCoroutine() to the
internal C API.
2021-10-19 01:31:57 +02:00
Filipe Laíns
4d03de3329
bpo-45516: add protocol description to the Traversable documentation (#29039)
* bpo-45516: add protocol description to the Traversable documentation

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Update Doc/library/importlib.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Update Lib/importlib/abc.py

* Update Doc/library/importlib.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-10-18 18:58:13 -04:00
andrei kulakov
6a533a4238
bpo-45221: Fix handling of LDFLAGS and CPPFLAGS options in setup.py (GH-29031) 2021-10-18 14:26:23 -04:00
Victor Stinner
034f607906
bpo-43760: Rename _PyThreadState_DisableTracing() (GH-29032)
* Rename _PyThreadState_DisableTracing()
  to _PyThreadState_PauseTracing()
* Rename _PyThreadState_ResetTracing()
  to _PyThreadState_ResumeTracing()
2021-10-18 18:40:43 +02:00
Mark Shannon
70945d57e7
bpo-45256: Avoid C calls for most Python to Python calls. (GH-28937)
* Avoid making C calls for most calls to Python functions.

* Change initialize_locals(steal=true) and _PyTuple_FromArraySteal to consume the argument references regardless of whether they succeed or fail.
2021-10-18 09:57:24 +01:00
Dong-hee Na
fd03917786
bpo-45434: Include stdlib.h for specialize stat (GH-29015) 2021-10-18 17:31:18 +09:00
Raymond Hettinger
54a4e1b53a
Improve multiserver queue recipe (GH-29012) 2021-10-17 18:20:34 -05:00