Commit Graph

113152 Commits

Author SHA1 Message Date
Inada Naoki 354ace8b07
gh-91954: Emit EncodingWarning from locale and subprocess (GH-91977)
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
2022-04-30 15:53:29 +09:00
David Hewitt c7b7f12b86
gh-91880 - fix typo (GH-92069)
https://github.com/python/cpython/issues/91880#issuecomment-1113914241 - With thanks to @MojoVampire for spotting this.

Automerge-Triggered-By: GH:gvanrossum
2022-04-29 22:23:54 -07:00
Serhiy Storchaka e8c2f72b94
bpo-43224: Implement substitution of unpacked TypeVarTuple in C (GH-31828)
Co-authored-by: Matthew Rahtz <mrahtz@gmail.com>
2022-04-30 08:22:46 +03:00
Dennis Sweeney a29aa76a3f
gh-92064: Fix global variable name collision in test_typing (#92067)
Fixes #92064
2022-04-29 21:18:38 -06:00
Shantanu 2f7952c35b
Rephrase typing.assert_never docs (#92061)
This change is similar to that in #32069
2022-04-29 21:13:21 -06:00
Shantanu d0064a1e72
gh-91491: Add several typing features to What's New (#92060)
This gets all the major items in #91491. However, I didn't get around to
adding what's new entries for the large clump of changes in the last
bullet point in the issue.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-29 21:12:45 -06:00
Brett Cannon c2b579741d
gh-91217: deprecate xdrlib (GH-92066)
Automerge-Triggered-By: GH:brettcannon
2022-04-29 18:22:10 -07:00
Jelle Zijlstra 7861a9e327
Fix indentation for typing.Unpack docs (#92058)
https://docs.python.org/3.11/library/typing.html#typing.Unpack
2022-04-29 16:58:40 -06:00
slateny 53ca774497
sorting howto: Add clarification on < using __lt__ (#92010) 2022-04-29 16:08:07 -06:00
Serhiy Storchaka 81120b6754
bpo-44791: Accept ellipsis as the last argument of typing.Concatenate (#30969) 2022-04-29 15:01:40 -06:00
Matthew Rahtz f6656163de
gh-87390: Add tests demonstrating current type variable substitution behaviour (#32341) 2022-04-29 14:03:21 -06:00
Humbled Drugman 117836f123
bpo-26792: Improve docstrings of runpy module run_functions (#30729)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-04-29 12:22:46 -06:00
Petr Viktorin 83bce8ef14
gh-91324: Convert the stable ABI manifest to TOML (GH-92026) 2022-04-29 16:18:08 +02:00
Hugo van Kemenade 89c6b2b8f6
bpo-36329: Remove 'make -C Doc serve' in favour of 'make -C Doc htmlview' (GH-32354)
Also updated `make -C htmlview` so it used a full path with `file://`, because the original didn't open the page (macOS).

For example:
```sh
cd Doc

# Doesn't open anything:
python3 -c "import webbrowser; webbrowser.open('build/html/index.html')"

# Opens the docs page e.g. file:///Users/hugo/github/cpython/Doc/build/html/index.html :
python3 -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
```

https://bugs.python.org/issue36329
2022-04-29 15:47:26 +02:00
Ken Jin 64113a4ba8
gh-91873: Summarise deprecations in typing at the top level (GH-91864) 2022-04-29 12:22:25 +08:00
Eisuke Kawashima ea2f5bcda1
bpo-22276: Change pathlib.Path.glob not to ignore trailing path separator (GH-10349)
Now pathlib.Path.glob() **only** matches directories when the pattern ends in a path separator.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-28 12:45:03 -07:00
Yurii Karabas 0ef8d921f5
gh-91603: Speed up isinstance/issubclass on union types (GH-91631)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-04-28 23:24:19 +08:00
Abhigyan Bose 4ed3900041
gh-91832: Add 'required' attr to argparse.Action repr (GH-91841)
# Adding 'required' to names in Lib.argparse.Action

gh-91832: 
Added 'required' to the list `names` in `Lib.argparse.Action`. 
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
2022-04-28 07:50:27 -07:00
Petr Viktorin 6dcbc08c95
gh-91324: List feature macros in the stable ABI manifest, improve tests (GH-32415) 2022-04-28 16:30:28 +02:00
Ethan Smith d1de10784d
gh-84461: Add HOSTRUNNER for program to run Python executable (GH-91931)
`HOSTRUNNER` is a program which can be used to run `BUILDPYTHON` for the host platform (for example, `python.js` requires `node`).

Also change depedencies from `build_all` to `all` so that targets which can't build everything (e.g. WASM) can still run `buildbottest` and `pythoninfo`.

cc @tiran
2022-04-28 05:14:19 -07:00
Victor Stinner 87c6cf9aa7
gh-89479: Export _Py_GetSpecializationStats() internal function (#92011)
When Python is built with "./configure --enable-pystats" (if the
Py_STATS macro is defined), the _Py_GetSpecializationStats() function
must be exported, since it's used by the _opcode extension which is
built as a shared library.
2022-04-28 14:02:45 +02:00
Abhigyan Bose 88dd227959
gh-91984: Fix trailing spaces in multiline test strings in test_argparse (GH-91986) 2022-04-28 14:29:24 +03:00
Serhiy Storchaka cd1fbbc817
gh-91603: Speed up operator "|" for UnionType (GH-91955)
Reduce the complexity from O((M+N)^2) to O(M*N), where M and N are the length
of __args__ for both operands (1 for operand which is not a UnionType).

As a consequence, the complexity of parameter substitution in UnionType has
been reduced from O(N^3) to O(N^2).

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2022-04-28 13:25:33 +03:00
Dennis Sweeney 37c6db60f9
gh-91869: Fix tracing of specialized instructions with extended args (GH-91945) 2022-04-27 22:36:34 -06:00
Brett Cannon 407c3afe19
gh-91217: deprecate uu (GH-92009)
Automerge-Triggered-By: GH:brettcannon
2022-04-27 20:26:33 -07:00
Ashwin Ramaswami f348154c8f
Add note that headers added via urllib.request.add_header are added to redirected requests (#30708) 2022-04-27 16:25:03 -06:00
slateny 161dff7e10
gh-84459: Make wording more specific for Path.replace (GH-91853)
#84459
2022-04-27 15:03:03 -07:00
Simon de Vlieger c6b84a727c
Correct method name typo (#91970) 2022-04-27 15:28:56 -06:00
Serhiy Storchaka 43a8bf1ea4
gh-87999: Change warning type for numeric literal followed by keyword (GH-91980)
The warning emitted by the Python parser for a numeric literal
immediately followed by keyword has been changed from deprecation
warning to syntax warning.
2022-04-27 20:15:14 +03:00
Serhiy Storchaka f60b4c3d74
gh-91810: Expand ElementTree.write() tests to use non-ASCII data (GH-91989) 2022-04-27 19:16:20 +03:00
David CARLIER ad9f817eeb
gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)
Fixes GH-91498
2022-04-27 06:47:17 -06:00
Dennis Sweeney b733708ca3
gh-91719: Mark pycore_opcode.h as generated in .gitattributes (#91976) 2022-04-27 12:45:40 +02:00
Victor Stinner 29e2245ad5
gh-91320: Add _Py_reinterpret_cast() macro (#91959)
Fix C++ compiler warnings about "old-style cast"
(g++ -Wold-style-cast) in the Python C API.  Use C++
reinterpret_cast<> and static_cast<> casts when the Python C API is
used in C++.

Example of fixed warning:

    Include/object.h:107:43: error: use of old-style cast to
    ‘PyObject*’ {aka ‘struct _object*’} [-Werror=old-style-cast]
    #define _PyObject_CAST(op) ((PyObject*)(op))

Add _Py_reinterpret_cast() and _Py_static_cast() macros.
2022-04-27 10:40:57 +02:00
Alexander Shadchin f882d33778
Fix missing `f` prefix on f-strings (GH-91910) 2022-04-27 09:30:54 +03:00
Victor Stinner 80de0273c0
gh-68966: Deprecate the mailcap module (#91951) 2022-04-26 22:43:50 +02:00
slateny b87f7f2c21
bpo-21761: Clarify __file__/__cached__ in import reference (GH-31565)
Automerge-Triggered-By: GH:brettcannon
2022-04-26 12:12:02 -07:00
Serhiy Storchaka f703c96cf0
gh-91870: Remove unsupported SRE opcode CALL (GH-91872)
It was initially added to support atomic groups, but that
support was never fully implemented, and CALL was only left
in the compiler, but not interpreter and parser.

ATOMIC_GROUP is now used to support atomic groups.
2022-04-26 21:07:25 +03:00
Brett Cannon 1af871eeee
gh-91217: deprecate telnetlib (GH-91958) 2022-04-26 10:45:08 -07:00
Serhiy Storchaka 4153f2cbcb
gh-91917: Fix test_zipfile on non-UTF-8 locale (GH-91921)
Skip the extraction test if file names are not encodable.
2022-04-26 08:01:33 +03:00
Serhiy Storchaka a568585069
gh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)
If use a non-builtin codec, partially implemented in Python
(e.g. ISO-8859-15), a new RecursionError (with empty error message)
can be raised while handle a RecursionError.

Testing for error message was needed to distinguish
a recursion error from arbitrary RuntimeError. After introducing
RecursionError, it became unnecessary.
2022-04-26 08:00:47 +03:00
Serhiy Storchaka f41c16bf51
gh-91914: Fix test_curses on non-UTF-8 locale (GH-91919) 2022-04-26 07:59:56 +03:00
Serhiy Storchaka 36306cf786
gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918) 2022-04-26 07:58:41 +03:00
Jelle Zijlstra 5397b5afc1
gh-91860: Add typing.dataclass_transform (PEP 681) (#91861)
Copied from typing-extensions (python/typing#1054, python/typing#1120).

Documentation is intentionally omitted, so we can focus on getting the
runtime part in before the feature freeze.
2022-04-25 20:30:25 -07:00
Brett Cannon d174ebe91e
gh-91217: deprecate sunau (GH-91866) 2022-04-25 16:26:43 -07:00
Gregory P. Smith cd5726fe67
gh-91401: Add a failsafe way to disable vfork. (#91490)
Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.

No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.

See the linked issue for some discussion on reasoning.

Also documents the existing way to disable posix_spawn.
2022-04-25 16:19:39 -07:00
Mariusz Felisiak eddd07f840
bpo-46907: Update Windows installer to SQLite 3.38.2 (GH-32147) 2022-04-25 23:33:45 +01:00
Victor Stinner 64a54e511d
gh-91719: Add pycore_opcode.h internal header file (#91906)
Move the following API from Include/opcode.h (public C API) to a new
Include/internal/pycore_opcode.h header file (internal C API):

* EXTRA_CASES
* _PyOpcode_Caches
* _PyOpcode_Deopt
* _PyOpcode_Jump
* _PyOpcode_OpName
* _PyOpcode_RelativeJump
2022-04-26 00:14:30 +02:00
Victor Stinner 20cc695286
gh-64783: Fix signal.NSIG value on FreeBSD (#91929)
Fix signal.NSIG value on FreeBSD to accept signal numbers greater
than 32, like signal.SIGRTMIN and signal.SIGRTMAX.

* Add Py_NSIG constant.
* Add pycore_signal.h internal header file.
* _Py_Sigset_Converter() now includes the range of valid signals in
  the error message.
2022-04-26 00:13:31 +02:00
Victor Stinner 61381d7da1
gh-89653: PEP 670: Functions don't cast pointers (#91697)
In the limited C API version 3.11 and newer, the following functions
no longer cast their object pointer argument with _PyObject_CAST() or
_PyObject_CAST_CONST():

* Py_REFCNT(), Py_TYPE(), Py_SIZE()
* Py_SET_REFCNT(), Py_SET_TYPE(), Py_SET_SIZE()
* Py_IS_TYPE()
* Py_INCREF(), Py_DECREF()
* Py_XINCREF(), Py_XDECREF()
* Py_NewRef(), Py_XNewRef()
* PyObject_TypeCheck()
* PyType_Check()
* PyType_CheckExact()

Split Py_DECREF() implementation in 3 versions to make the code more
readable.

Update the xxlimited.c extension, which uses the limited C API
version 3.11, to pass PyObject* to these functions.
2022-04-26 00:11:34 +02:00
David Hewitt 1cd8c29dac
gh-91880: add try/except around `signal.signal` (#91881)
Fixes gh-91880.
2022-04-25 08:56:20 -07:00