Commit Graph

114376 Commits

Author SHA1 Message Date
MrSuspicious 757c383d24
gh-96039: Corrected wording error in itertools doc (GH-96105) 2022-08-19 01:20:45 -05:00
Christian Heimes d9c1b746b5
gh-96017: Fix some compiler warnings (GH-96018)
- "comparison of integers of different signs" in typeobject.c
- only define static_builtin_index_is_set in DEBUG builds
- only define recreate_gil with ifdef HAVE_FORK
2022-08-19 08:08:43 +02:00
Raymond Hettinger 6740680b57
GH-95822: Need _PyType_Lookup() in descriptor howto code equivalent. (GH-95967) 2022-08-18 23:56:58 -05:00
C.A.M. Gerlach b6d88b7225
gh-95914: Add Py_UNICODE encode APIs removed in PEP 624 to 3.11 What's New (#96016)
* 3.11 Whatsnew: Add Py_UNICODE encode functions removed in PEP 624

* Just use :func: instead of :c:func: for non-resolved funcs so ! works
2022-08-19 00:52:59 +01:00
Pablo Galindo Salgado 9d066e2aa6
gh-95463: Remove backwards incompatible change regarding the _MASK_UTF_FILENAME flags in bpo-28080 (GH-96072)
Automerge-Triggered-By: GH:pablogsal
2022-08-18 16:45:55 -07:00
Raymond Hettinger ba4bb7e464
GH-93179: Document the thread safety of functools.lru_cache (GH-95970) 2022-08-18 17:38:49 -05:00
Kevin Modzelewski 214eb2cce5
gh-90536: Add support for the BOLT post-link binary optimizer (gh-95908)
* Add support for the BOLT post-link binary optimizer

Using [bolt](https://github.com/llvm/llvm-project/tree/main/bolt)
provides a fairly large speedup without any code or functionality
changes. It provides roughly a 1% speedup on pyperformance, and a
4% improvement on the Pyston web macrobenchmarks.

It is gated behind an `--enable-bolt` configure arg because not all
toolchains and environments are supported. It has been tested on a
Linux x86_64 toolchain, using llvm-bolt built from the LLVM 14.0.6
sources (their binary distribution of this version did not include bolt).

Compared to [a previous attempt](https://github.com/faster-cpython/ideas/issues/224),
this commit uses bolt's preferred "instrumentation" approach, as well as adds some non-PIE
flags which enable much better optimizations from bolt.

The effects of this change are a bit more dependent on CPU microarchitecture
than other changes, since it optimizes i-cache behavior which seems
to be a bit more variable between architectures. The 1%/4% numbers
were collected on an Intel Skylake CPU, and on an AMD Zen 3 CPU I
got a slightly larger speedup (2%/4%), and on a c6i.xlarge EC2 instance
I got a slightly lower speedup (1%/3%).

The low speedup on pyperformance is not entirely unexpected, because
BOLT improves i-cache behavior, and the benchmarks in the pyperformance
suite are small and tend to fit in i-cache.

This change uses the existing pgo profiling task (`python -m test --pgo`),
though I was able to measure about a 1% macrobenchmark improvement by
using the macrobenchmarks as the training task. I personally think that
both the PGO and BOLT tasks should be updated to use macrobenchmarks,
but for the sake of splitting up the work this PR uses the existing pgo task.

* Simplify the build flags

* Add a NEWS entry

* Update Makefile.pre.in

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

* Update configure.ac

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

* Add myself to ACKS

* Add docs

* Other review comments

* fix tab/space issue

* Make it more clear that --enable-bolt is experimental

* Add link to bolt's github page

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2022-08-19 06:33:54 +09:00
Steve Dower 22a95cb511
Remove manual build scripts for Windows dependencies and put them in the release-tools repository instead (GH-96088) 2022-08-18 21:48:09 +01:00
Raymond Hettinger 29c8f80760
GH-95861: Add support for Spearman's rank correlation coefficient (GH-95863) 2022-08-18 13:48:27 -05:00
Erlend E. Aasland 91afe66707
Docs: Escape lone stars in sqlite3 docs (#96081) 2022-08-18 20:39:36 +02:00
Erlend E. Aasland c87ea10fc9
gh-95271: Rework sqlite3 tutorial (#95749)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-08-18 20:36:20 +02:00
Victor Stinner cfaa79aac0
gh-93103: Doc uses PyConfig rather than deprecated vars (#96070)
The C API documentation now uses the new PyConfig API, rather than
deprecated global configuration variables.
2022-08-18 16:58:38 +02:00
Dong-hee Na 157aef79b0
gh-95813: Improve HTMLParser from the view of inheritance (#95874)
* gh-95813: Improve HTMLParser from the view of inheritance

* gh-95813: Add unittest

* Address code review
2022-08-18 13:16:33 +02:00
Irit Katriel c5bc67b2a1
gh-95913: Add traceback module additions to what's new in 3.11 (GH-95980) 2022-08-18 11:37:41 +01:00
Irit Katriel 1a720c6003
gh-95913: make the new internal classes pdb.ModuleTarget/ScriptTarget private (GH-96053) 2022-08-18 11:16:07 +01:00
Matthias Görgens 4a6fa89465
Remove dead code in _PyDict_GetItemHint and rename to _PyDict_LookupIndex (GH-95948) 2022-08-18 10:19:21 +01:00
Eric Snow 586fc02be5
gh-90110: Update the c-analyzer Tool (gh-96058) 2022-08-17 16:54:59 -06:00
Eric Snow 5aac85101b
gh-90110: Get the C Analyzer Tool Working Again (gh-96057)
We broke it with a recent `_PyArg_Parser` change.

Also:
* moved the `_PyArg_Parser` whitelist entries over to ignored.tsv now that they are thread-safe
* added some known globals from a currently-excluded file
* dropped some outdated globals from the whitelist
2022-08-17 13:55:01 -06:00
Mark Shannon d8c07f8cb4
Correct news entry. (GH-96043) 2022-08-17 12:59:44 +01:00
Mark Shannon b73e3b6d4a
GH-95589: Dont crash when subclassing extension classes with multiple inheritance (GH-96028)
* Treat tp_weakref and tp_dictoffset like other opaque slots for multiple inheritance.

* Document Py_TPFLAGS_MANAGED_DICT and Py_TPFLAGS_MANAGED_WEAKREF in what's new.
2022-08-17 12:50:53 +01:00
Petr Viktorin 0f2b469ce1
gh-95991: Add some infrastructure for testing Limited API in _testcapi (GH-95992)
- Limited API needs to be enabled per source file
- Some builds don't support Limited API, so Limited API tests must be skipped on those builds
  (currently this is `Py_TRACE_REFS`, but that may change.)
- `Py_LIMITED_API` must be defined before `<Python.h>` is included.

This puts the hoop-jumping in `testcapi/parts.h`, so individual
test files can be relatively simple. (Currently that's only
`vectorcall_limited.c`, imagine more.)
2022-08-17 13:48:43 +02:00
Ken Jin 7276ca25f5
GH-93911: Specialize `LOAD_ATTR` for custom `__getattribute__` (GH-93988) 2022-08-17 12:37:07 +01:00
Serhiy Storchaka 36517101dd
gh-95736: Fix event loop creation in IsolatedAsyncioTestCase (GH-96033)
It should be created before calling the setUp() method, but after
checking for skipping a test.

Automerge-Triggered-By: GH:tiran
2022-08-17 02:05:17 -07:00
Christian Heimes da0aa518bf
gh-96005: FreeBSD has ENOTCAPABLE, too (GH-96034) 2022-08-17 07:24:53 +02:00
Guido van Rossum f51f54f39d
GH-95704: Don't suppress errors from tasks when TG is cancelled (#95761)
When a task catches CancelledError and raises some other error,
the other error should not silently be suppressed.

Any scenario where a task crashes in cleanup upon cancellation
will now result in an ExceptionGroup wrapping the crash(es)
instead of propagating CancelledError and ignoring the side errors.

NOTE: This represents a change in behavior (hence the need to
change several tests).  But it is only an edge case.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-08-16 18:23:06 -07:00
Kumar Aditya 9b30b965f0
GH-95909: Make `_PyArg_Parser` initialization thread safe (GH-95958) 2022-08-16 11:22:14 -07:00
Christian Heimes 48174fa0b9
gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`.
- The `errno` modules exposes the new error number.
- `getpath.py` now ignores `PermissionError` when it cannot open landmark
  files `pybuilddir.txt` and `pyenv.cfg`.
2022-08-16 20:20:15 +02:00
Michael Droettboom f215d7cac9
gh-94823: Improve coverage in tokenizer.c:valid_utf8 (GH-94856)
When loading a source file from disk, there is a separate UTF-8 validator
distinct from the one in `unicode_decode_utf8`. This exercises that code path
with the same set of invalid inputs as we use for testing the "other" UTF-8
decoder.
2022-08-16 08:54:13 -07:00
Kumar Aditya 9d515997f9
GH-95736: fix IsolatedAsyncioTestCase to initialize Runner before calling setup functions (#95898) 2022-08-16 08:52:06 -07:00
Mark Shannon 5a8c15819c
GH-95245: Move weakreflist into the pre-header. (GH-95996) 2022-08-16 13:57:18 +01:00
Irit Katriel 829aab8592
remove repetitive credit from what's new in 3.11 rst (GH-96024) 2022-08-16 13:47:07 +01:00
Christian Heimes ab4d72954f
gh-95957: Add instructions for Tcl/Tk and OpenSSL on RHEL/CentOS 7 (#95964)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-08-16 13:44:02 +02:00
Irit Katriel bfc2028df0
Change CODEOWNERS entries for iritkatriel (GH-96008) 2022-08-16 09:38:32 +01:00
Yury Selivanov b2afe482f2
gh-95808: Add missing early returns in _asynciomodule.c (#95809) 2022-08-15 16:32:40 -07:00
Terry Jan Reedy f6b811059a
gh-78143: IDLE - fix settings dialog page label. (#96009)
'/Tab' should have been removed from the font page label
when the tab-spaces setting was moved to the Windows page.
2022-08-15 19:03:56 -04:00
Michael Droettboom 3adb4d864b
GH-94808: Test __build_class__ inside non-dict __builtins__ (GH-95932) 2022-08-15 10:39:06 -07:00
Kumar Aditya 914f6367a0
GH-95899: fix asyncio.Runner to call set_event_loop only once (#95900) 2022-08-15 10:02:47 -07:00
Shreenidhi Shedi 2fa03b1b07
gh-95231: Disable md5 & crypt modules if FIPS is enabled (GH-94742)
If kernel fips is enabled, we get permission error upon doing
`import crypt`. So, if kernel fips is enabled, disable the
unallowed hashing methods.

Python 3.9.1 (default, May 10 2022, 11:36:26)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/crypt.py", line 117, in <module>
    _add_method('MD5', '1', 8, 34)
  File "/usr/lib/python3.9/crypt.py", line 94, in _add_method
    result = crypt('', salt)
  File "/usr/lib/python3.9/crypt.py", line 82, in crypt
    return _crypt.crypt(word, salt)
PermissionError: [Errno 1] Operation not permitted

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2022-08-15 07:48:07 -07:00
Christian Heimes 8621e6d43a
gh-95707: Fix function signature (GH-95995) 2022-08-15 15:06:28 +01:00
Mark Shannon 3ef3c6306d
GH-95707: Fix uses of `Py_TPFLAGS_MANAGED_DICT` (GH-95854)
* Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set.

* Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
2022-08-15 12:29:27 +01:00
Christian Heimes 4a7f5a55dc
gh-95853: Address wasm build and test issues (GH-95985) 2022-08-15 07:41:10 +02:00
Kumar Aditya e8259e047c
Clarify asyncio.Runner docs re: loop_factory (#95979) 2022-08-14 08:53:34 -07:00
Kumar Aditya f2afdf3352
GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978) 2022-08-15 00:13:42 +09:00
Pablo Galindo Salgado c26500224f
bpo-40222: Mark exception table function in the dis module as private (#95961) 2022-08-14 15:42:31 +01:00
Christian Heimes 32ac98e899
gh-95853: Add script to automate WASM build (GH-95828)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.

Co-authored-by: Brett Cannon <brett@python.org>
2022-08-13 21:56:08 +02:00
Christian Heimes 0b329f4f03
gh-89313: Add hashlib.file_digest to whatsnew 3.11 (GH-95965)
Automerge-Triggered-By: GH:pablogsal
2022-08-13 12:00:58 -07:00
Pablo Galindo Salgado 7552f237a2
bpo-25625: Document contextlib.chdir in the 3.11 what's new (#95962) 2022-08-13 19:27:44 +01:00
Irit Katriel 1402d2ceca
gh-95914: Add paragraph about PEP 654 in main body of 'What's New in 3.11' (GH-95937) 2022-08-13 12:49:04 +01:00
Erlend E. Aasland f07adf82f3
gh-90928: Improve static initialization of keywords tuple in AC (#95907) 2022-08-13 12:09:40 +02:00
Howie Zhao f235178bec
gh-94439: typing docs: Add minimum version to `__required_keys__` and `__optional_keys__` (#95373) 2022-08-12 21:23:33 -07:00