Commit graph

109418 commits

Author SHA1 Message Date
Victor Stinner 3359cab038
bpo-43688: Support the limited C API in debug mode (GH-25131)
The limited C API is now supported if Python is built in debug mode
(if the Py_DEBUG macro is defined). In the limited C API, the
Py_INCREF() and Py_DECREF() functions are now implemented as opaque
function calls, rather than accessing directly the PyObject.ob_refcnt
member, if Python is built in debug mode and the Py_LIMITED_API macro
targets Python 3.10 or newer. It became possible to support the
limited C API in debug mode because the PyObject structure is the
same in release and debug mode since Python 3.8 (see bpo-36465).

The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS macro).
2021-04-02 15:45:37 +02:00
Victor Stinner 442ad74fc2
bpo-43687: Py_Initialize() creates singletons earlier (GH-25147)
Reorganize pycore_interp_init() to initialize singletons before the
the first PyType_Ready() call. Fix an issue when Python is configured
using --without-doc-strings.
2021-04-02 15:28:13 +02:00
Mark Shannon 58384c6ab0
Document PyCode_Addr2Line function. (GH-25111)
* Document PyCode_Addr2Line function.

* Clarify when to use PEP 626 line iterators.
2021-04-02 13:24:57 +01:00
Inada Naoki bec8c787ec
bpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)
I forget to check PyErr_WarnEx() return value. But it will fail when -Werror is used.
2021-04-02 17:38:59 +09:00
Inada Naoki 8bbfeb3330
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)
* test__xxsubinterpreters
* test_builtin
* test_doctest
* test_exceptions
* test_opcodes
* test_support
* test_argparse
* test_baseexception
* test_bdb
* test_bool
* test_asdl_parser
2021-04-02 12:53:46 +09:00
Erlend Egeberg Aasland bef7b26f72
bpo-43700: Replace Zulip badge with Discourse badge (GH-25141)
Automerge-Triggered-By: GH:zware
2021-04-01 20:30:40 -07:00
Inada Naoki 80017752ba
bpo-43651: Fix test_compileall with PEP 597 (GH-25128) 2021-04-02 09:01:57 +09:00
Inada Naoki c0ec4486dc
bpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127) 2021-04-02 08:59:15 +09:00
Inada Naoki 036fc7de24
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126) 2021-04-02 08:57:05 +09:00
Irit Katriel bd4ab8e739
bpo-26053: Fix test_pdb.test_issue26053() (GH-25139) 2021-04-01 21:05:51 +02:00
Zackery Spytz e689cdca3c
bpo-43677: Fix a minor error in Doc/howto/descriptor.rst (#25123)
It should be PyMethod_Type, not Py_MethodType.
2021-04-01 10:03:33 -07:00
Irit Katriel 652bfdee94
bpo-26053: Fix args echoed by pdb run command (#22033) 2021-04-01 08:25:59 -07:00
Mark Shannon fcb55c0037
bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069)
* Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps.

* Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
2021-04-01 16:00:31 +01:00
Victor Stinner 2ac0515027
bpo-43688: Fix Py_LIMITED_API version of xxlimited (GH-25135)
xxlimited targets Python 3.10, not Python 3.16: fix the hexadecimal
version number used in the Py_LIMITED_API macro.
2021-04-01 15:09:33 +02:00
Victor Stinner 61092a99c4
bpo-43690: stable_abi.py no longer parses macros (GH-25136)
The stable_abi.py script no longer parse macros. Macro targets can be
static inline functions which are not part of the stable ABI, only
part of the limited C API.

Run "make regen-limited-abi" to exclude PyType_HasFeature from
Doc/data/stable_abi.dat.
2021-04-01 14:13:42 +02:00
Victor Stinner baf10da750
bpo-43688: Run make regen-limited-abi (GH-25134) 2021-04-01 11:29:46 +02:00
Don Kirkby 18701a0608
Fix typos in 3.10 "What's new" (GH-25104) 2021-04-01 15:00:30 +09:00
Tim Peters 078a3433eb
When printing stats, move radix tree info to its own section. (GH-25125)
When printing stats, move radix tree info to its own section.
Restore that the breakdown of bytes in arenas exactly accounts for the total of arena bytes allocated.
Add an assert so that invariant doesn't break again.
2021-03-31 22:46:31 -05:00
Inada Naoki 58cffba187
bpo-43651: Fix EncodingWarning in test_io (GH-25097) 2021-04-01 11:25:04 +09:00
Inada Naoki 55f31be44b
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109) 2021-04-01 11:23:03 +09:00
Victor Stinner ad493edf57
bpo-42955: Add _overlapped to sys.stdlib_module_names (GH-25122) 2021-04-01 02:28:23 +02:00
Ethan Furman 49aec1a185
Enum: add (re)import of Flag for doctests (GH-25118)
Fix issue with CI doctest forgetting that ``Flag`` had already been imported.
2021-03-31 09:20:08 -07:00
Julien Palard 202b546442
Disambiguate that -m also terminates the option list in the manpage. (GH-25100) 2021-03-31 14:31:38 +02:00
Victor Stinner f3ab670fea
bpo-37945: Fix test_locale.test_getsetlocale_issue1813() (#25110)
Skip the test if setlocale() fails.
2021-03-31 13:01:46 +02:00
Łukasz Langa 027d2cf1e5
Document GH-24624 2021-03-31 12:22:37 +02:00
Jessica Clarke dec0757549
bpo-43179: Generalise alignment for optimised string routines (GH-24624)
* Remove m68k-specific hack from ascii_decode

On m68k, alignments of primitives is more relaxed, with 4-byte and
8-byte types only requiring 2-byte alignment, thus using sizeof(size_t)
does not work. Instead, use the portable alternative.

Note that this is a minimal fix that only relaxes the assertion and the
condition for when to use the optimised version remains overly strict.
Such issues will be fixed tree-wide in the next commit.

NB: In C11 we could use _Alignof(size_t) instead, but for compatibility
we use autoconf.

* Optimise string routines for architectures with non-natural alignment

C only requires that sizeof(x) is a multiple of alignof(x), not that the
two are equal. Thus anywhere where we optimise based on alignment we
should be using alignof(x) not sizeof(x).

This is more annoying than it would be in C11 where we could just use
_Alignof(x) (and alignof(x) in C++11), but since we still require only
C99 we must plumb the information all the way from autoconf through the
various typedefs and defines.
2021-03-31 12:12:39 +02:00
Inada Naoki cfa176685a
Revert "bpo-43510: PEP 597: Accept encoding="locale" in binary mode (GH-25103)" (#25108)
This reverts commit ff3c9739bd.
2021-03-31 18:49:41 +09:00
Inada Naoki ff3c9739bd
bpo-43510: PEP 597: Accept encoding="locale" in binary mode (GH-25103)
It make `encoding="locale"` usable everywhere `encoding=None` is
allowed.
2021-03-31 14:26:08 +09:00
Terry Jan Reedy 1b4a9c7956
bpo-42225: IDLE - document two unix-related problems. (#25078)
1. Bad IP masquerade rules can prevent startup.
2. X cannot handle some complex colored chars.
2021-03-31 01:19:38 -04:00
Ethan Furman b775106d94
bpo-40066: Enum: modify repr() and str() (GH-22392)
* Enum: streamline repr() and str(); improve docs

- repr() is now ``enum_class.member_name``
- stdlib global enums are ``module_name.member_name``
- str() is now ``member_name``
- add HOW-TO section for ``Enum``
- change main documentation to be an API reference
2021-03-30 21:17:26 -07:00
Alex Prengère 51a85ddce8
bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751) 2021-03-31 00:11:29 +03:00
Antoine Pitrou 73b20ae2fb
bpo-41369: Finish updating the vendored libmpdec to version 2.5.1 (GH-24962)
Complete the update to libmpdec-2.5.1.

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2021-03-30 18:11:06 +02:00
Brett Cannon a7ff6df60c
bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044) 2021-03-30 08:43:03 -07:00
Grégory Starck cf35e05f89
bpo-43125: Fix: return expected type (str), not original value (bytes) in email/base64mime.py::body_encode (GH-24476) 2021-03-30 17:37:37 +09:00
Zackery Spytz dfeec347f2
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038) 2021-03-30 15:22:34 +09:00
Inada Naoki 068ebf9729
bpo-33164: blake2: Fix Coverity scan (GH-25060) 2021-03-30 12:25:28 +09:00
Neil Schemenauer 85b6b70589
bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474)
The radix tree approach is a relatively simple and memory sanitary
alternative to the old (slightly) unsanitary address_in_range().
To disable the radix tree map, set a preprocessor flag as follows:
-DWITH_PYMALLOC_RADIX_TREE=0.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2021-03-29 19:51:15 -07:00
Christian Heimes a54fc683f2
bpo-43631: Update to OpenSSL 1.1.1k (GH-25024)
- [x] Build OpenSSL 1.1.1k for macOS
- [x] Build OpenSSL 1.1.1k for Windows

I have also updated multissl tester and various CI configurations to use latest OpenSSL. The versions were all over the place.

Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: GH:tiran
2021-03-29 17:00:34 -07:00
Pablo Galindo 92a02c1f7e
Fix tokenizer error when raw decoding null bytes (GH-25080) 2021-03-30 00:24:49 +01:00
Pablo Galindo 09b90a037d
bpo-43660: Fix crash when displaying exceptions with custom values for sys.stderr (GH-25075) 2021-03-29 23:38:51 +01:00
Michael Felt c8b5738810
bpo-43659: Fix test_curses on AIX (GH-25074)
curses.update_lines_cols() is only defined when the curses library
provides either resizeterm() or resize_term() functions which are optional
and are not provided on AIX.
2021-03-29 22:06:24 +03:00
Jesús Cea 32430aadad
bpo-35930: Raising an exception raised in a "future" instance will create reference cycles (#24995)
Before: https://lists.es.python.org/pipermail/general/attachments/20201229/0c14bc58/attachment-0002.png

After: https://lists.es.python.org/pipermail/general/attachments/20201229/0c14bc58/attachment-0003.png
2021-03-29 19:22:13 +02:00
Harry 7bfd65eba7
bpo-43648: Remove redundant datefmt option in logging file config (GH-25051)
[bpo-43648](): Remove redundant datefmt option in logging file config

Automerge-Triggered-By: GH:vsajip
2021-03-29 07:16:19 -07:00
Serhiy Storchaka c1b073a630
bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057) 2021-03-29 22:39:31 +09:00
Pablo Galindo 70cdf1812c
bpo-40645: Fix reference leak in the _hashopenssl extension (GH-25063) 2021-03-29 06:17:40 -07:00
Victor Stinner 9b999479c0
bpo-42988: Remove the pydoc getfile feature (GH-25015)
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which
could be abused to read arbitrary files on the disk (directory
traversal vulnerability). Moreover, even source code of Python
modules can contain sensitive data like passwords. Vulnerability
reported by David Schwörer.
2021-03-29 14:40:40 +02:00
Inada Naoki 4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry
2021-03-29 12:28:14 +09:00
Pablo Galindo 261a452a13
bpo-25643: Refactor the C tokenizer into smaller, logical units (GH-25050) 2021-03-28 23:48:05 +01:00
Irit Katriel fb1d01b963
bpo-31907: [doc] clarify that str.format() does not support arbitrary expressions (#25053) 2021-03-28 16:47:20 -04:00
Jason R. Coombs af50c84643
bpo-43644: Add docs for importlib.resources.as_file. (#25048) 2021-03-27 20:25:53 -04:00