Commit Graph

115041 Commits

Author SHA1 Message Date
Batuhan Taskaya c0f2a5ef91
gh-98744: Prevent column-level decoding crashes on traceback module (#98824) 2022-10-29 13:28:20 +01:00
FC Stegerman 7ea10567af
gh-98286: handle empty filename in ZipFile/ZipInfo properly (#98346)
effectively code modernization and a meaningful exception.
2022-10-28 22:45:46 -07:00
Mateusz 0023f51deb
gh-98240: Updated Path.rename docs, when it is atomic (GH-98245) 2022-10-28 16:31:37 -07:00
domragusa e089f23bbb
gh-84538: add strict argument to pathlib.PurePath.relative_to (GH-19813)
By default, :meth:`pathlib.PurePath.relative_to` doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a *walk_up* parameter that can be set to allow for using ``..`` to calculate the relative path.

example:
```
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pathlib.py", line 940, in relative_to
    raise ValueError(error_message.format(str(self), str(formatted)))
ValueError: '/etc/passwd' does not start with '/usr'
>>> p.relative_to('/usr', strict=False)
PurePosixPath('../etc/passwd')
```


https://bugs.python.org/issue40358

Automerge-Triggered-By: GH:brettcannon
2022-10-28 16:20:14 -07:00
cburroughs 72fa57a8fe
Fix typo in contextvars docs (#98823) 2022-10-28 22:13:48 +01:00
Gareth Rees 7ee3aca00a
gh-92452: Avoid race in initialization of sysconfig._CONFIG_VARS
Co-authored-by: Filipe Laíns <lains@riseup.net>
2022-10-28 19:17:04 +01:00
Skip Montanaro b27b57c6e4
`argparse` docs: normalize constant references (#98765) 2022-10-28 13:15:39 +01:00
Miro Hrončok 5a8c4b9464
gh-98776: Fix make regen-test-levenshtein for out-of-tree builds (GH-98779)
Fixes https://github.com/python/cpython/issues/98776

Automerge-Triggered-By: GH:erlend-aasland
2022-10-28 04:31:33 -07:00
Nikita Sobolev c144e57b31
gh-98657: [docs] `array.typecodes` is a module-level attribute (#98729)
* gh-98657: [docs] `array.typecodes` is a module-level attribute

* Update array.rst
2022-10-28 12:26:01 +02:00
Stanley 8cd21c2c5d
gh-65002: Make note that null bytes are used to pad bytes (#98635) 2022-10-28 12:21:28 +02:00
Steve Dower 25811d9010
gh-98745: Allow py.exe launcher to install 3.11 by default and 3.12 on request (GH-98780) 2022-10-28 10:12:22 +01:00
noah-weingarden 0346eddbe9
gh-98624 Add mutex to unittest.mock.NonCallableMock (#98688)
* Added lock to NonCallableMock in unittest.mock

* Add blurb

* Nitpick blurb

* Edit comment based on @Jason-Y-Z's review

* Add link to GH issue
2022-10-28 08:51:18 +01:00
Dennis Sweeney fbcafa6eee
gh-98789: Fix FOR_ITER assert on big-endian (GH-98792)
Fix FOR_ITER assertion syntax
2022-10-28 14:42:39 +08:00
Shaun Walbridge 3e07f827b3
gh-98739: Update libexpat from 2.4.9 to 2.5.0 (#98742)
* Update libexpat from 2.4.9 to 2.5.0 to address CVE-2022-43680.

Co-authored-by: Shaun Walbridge <shaun.walbridge@gmail.com>
2022-10-27 13:45:12 -07:00
Benjamin Peterson bded5edd9a
obmalloc: Remove unused variable. (GH-98770) 2022-10-27 09:06:49 -07:00
Erlend E. Aasland 723ebe76e7
gh-96143: Improve perf profiler docs (#96445) 2022-10-27 14:06:48 +01:00
Mark Shannon 22863df7ca
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
2022-10-27 11:55:03 +01:00
Wenzel Jakob e60892f9db
gh-98586: Add vector call APIs to the Limited API (GH-98587)
Expose the facilities for making vector calls through Python's limited API.
2022-10-27 11:45:42 +02:00
Gerardwx d578aaea62
Python documents state elsewhere that a comma is not an operator, so … (GH-98736)
…calling it an operator here is confusing. See https://docs.python.org/3/reference/lexical_analysis.html#operators and https://docs.python.org/3/faq/programming.html#id22.
2022-10-26 23:33:42 -07:00
Eric Snow 731909ebef
gh-98627: Use a Switch in PyModule_FromDefAndSpec2() (gh-98734)
This helps simplify some changes in follow-up PRs.  It also matches what we're doing in PyModule_ExecDef().
2022-10-26 21:20:54 -06:00
Kumar Aditya 96ae80f1d0
gh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop (GH-98730) 2022-10-27 11:07:31 +08:00
Ken Jin 8a755423eb
gh-98703: Fix asyncio proactor_events calling _call_connection_lost multiple times (GH-98704)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-27 10:37:12 +08:00
Nikita Sobolev 7b24333fff
gh-94808: cover `PyFunction_GetDefaults` and `PyFunction_SetDefaults` (#98449) 2022-10-26 17:47:29 -07:00
Benjamin Peterson 29b391b137
Fix readline.c compiler warning. (GH-98738)
```
Modules/readline.c:1260:37: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    completer_word_break_characters =
                                    ^
```
2022-10-26 15:53:25 -07:00
Henry Schreiner a508631b3c
gh-98741: Remove useless check_home usage from is_python_build usage (GH-98743) 2022-10-26 22:40:47 +01:00
Nikita Sobolev 6777e09166
gh-98727: Remove old style classes from `test_cmath` (GH-98728) 2022-10-26 19:08:34 +01:00
Eric Snow f32369480d
gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() (gh-98609)
(see https://github.com/python/cpython/issues/98608)

This change does the following:

1. change the argument to a new `_PyInterpreterConfig` struct
2. rename the function to `_Py_NewInterpreterFromConfig()`, inspired by `Py_InitializeFromConfig()` (takes a `_PyInterpreterConfig`  instead of `isolated_subinterpreter`)
3. split up the boolean `isolated_subinterpreter` into the corresponding multiple granular settings
   * allow_fork
   * allow_subprocess
   * allow_threads
4. add `PyInterpreterState.feature_flags` to store those settings
5. add a function for checking if a feature is enabled on an opaque `PyInterpreterState *`
6. drop `PyConfig._isolated_interpreter`

The existing default (see `Py_NewInterpeter()` and `Py_Initialize*()`) allows fork, subprocess, and threads and the optional "isolated" interpreter (see the `_xxsubinterpreters` module) disables all three.  None of that changes here; the defaults are preserved.

Note that the given `_PyInterpreterConfig` will not be used outside `_Py_NewInterpreterFromConfig()`, nor preserved.  This contrasts with how `PyConfig` is currently preserved, used, and even modified outside `Py_InitializeFromConfig()`.  I'd rather just avoid that mess from the start for `_PyInterpreterConfig`.  We can preserve it later if we find an actual need.

This change allows us to follow up with a number of improvements (e.g. stop disallowing subprocess and support disallowing exec instead).

(Note that this PR adds "private" symbols.  We'll probably make them public, and add docs, in a separate change.)
2022-10-26 11:16:30 -06:00
Pablo Galindo Salgado 24c56b4642
Fix small typo in the removed/deprecated section of the 3.11 whats new (GH-98722) 2022-10-27 01:05:00 +08:00
Erlend E. Aasland 365852a03a
gh-98716: Revert gh-96081: Escape lone stars in sqlite3 docs (#98720) 2022-10-26 16:53:46 +02:00
Philipp A 5e74bad93c
gh-98644: point people to tomllib from configparser’s docs (#98645)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-26 07:06:20 -07:00
Nikita Sobolev 9495360c72
gh-98713: Use `@cpython_only` for a test that fails on PyPy (#98714)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-10-26 14:15:39 +01:00
Neil Schemenauer de6981680b
gh-90716: add _pylong.py module (#96673)
Add Python implementations of certain longobject.c functions. These use
asymptotically faster algorithms that can be used for operations on
integers with many digits. In those cases, the performance overhead of
the Python implementation is not significant since the asymptotic
behavior is what dominates runtime. Functions provided by this module
should be considered private and not part of any public API.

Co-author: Tim Peters <tim.peters@gmail.com>
Co-author: Mark Dickinson <dickinsm@gmail.com>
Co-author: Bjorn Martinsson
2022-10-25 22:00:50 -07:00
Nikita Sobolev 5d30544485
gh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (#98486) 2022-10-25 21:33:32 -07:00
fancidev 216f45e4fe
gh-98348: Mention ReferenceError in weakref.proxy documentation (#98355) 2022-10-25 20:48:24 -07:00
Stanley 268129a74f
docs: Change links to label refs (#98454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-25 20:26:28 -07:00
Stanley 0ca6a4d640
gh-77753: Add example for values that compare equal in stdtypes (#98497)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-25 19:54:27 -07:00
Stanley 4196ee5c8b
gh-84747: Add `async for` comment for StreamReader (#98633) 2022-10-25 19:16:18 -07:00
July Tikhonov 45644905ea
fix a typo in whatsnew/3.11 (#98603) 2022-10-25 16:42:54 -07:00
Nikita Sobolev b1783bc124
gh-94808: Improve coverage of `unicode_find` and `unicode_rfind` (#98648) 2022-10-25 16:37:53 -07:00
Jacob Walls faea6a131a
Fix typos in deprecation section of 3.11 What's New (#98628) 2022-10-25 16:35:53 -07:00
Jelle Zijlstra 5d8bf2b106
gh-97937: dis docs: add adaptive=False (#97939)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-10-25 15:58:04 -07:00
Pablo Galindo Salgado 7cfbb49fcd
gh-91058: Add error suggestions to 'import from' import errors (#98305) 2022-10-25 23:56:59 +01:00
Pablo Galindo Salgado 1f737edb67
gh-96143: Move the perf trampoline files to the Python directory (#98675) 2022-10-25 23:34:22 +01:00
Erlend E. Aasland 0c84593275
gh-94328: Update Windows installer to use SQLite 3.39.4 (#98640) 2022-10-25 20:27:21 +02:00
Zachary Ware 6ffb4e24e0
Update build status links in contributing doc (GH-98672) 2022-10-25 12:13:37 -05:00
Zachary Ware 175247f364
Update link to supported versions table in security policy (GH-98670) 2022-10-25 11:59:19 -05:00
Eclips4 be0cf82ae4
gh-98602: [typing docs] Use quotes for forward reference in TypeVarTuple example (#98605) 2022-10-25 16:32:52 +01:00
Matthew Rahtz cb95cc24ef
GH-87390: Add remaining tests for PEP 646 (#98267)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2022-10-25 07:44:30 -07:00
Nikita Sobolev 5076108872
gh-98623: Fix base classes in `typing.rst` (#98626) 2022-10-25 07:06:13 -07:00
Nikita Sobolev 45c89358b7
Use more precise exception types in `assertRaises` in typing tests (#98650) 2022-10-25 06:33:34 -07:00