Commit Graph

3833 Commits

Author SHA1 Message Date
Łukasz Langa 904af3de2b
[3.10] bpo-45848: Allow the parser to get error lines from encoded files (GH-29646) (GH-29661)
(cherry picked from commit fdcc46d955)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-20 16:34:56 +01:00
Serhiy Storchaka 4641afef66
[3.10] bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28952)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.raw_unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit 39aa98346d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 21:23:39 +03:00
Miss Islington (bot) 0bff4ccbfd
[3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28943)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit c96d1546b1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 20:02:20 +03:00
Christian Clauss f6798391b5
[3.10] Fix typos in the Include directory (GH-28745) (GH-28789)
(cherry picked from commit 8e8f752217)
2021-10-07 06:00:23 -07:00
Pablo Galindo 1e328afb04
Post 3.10.0 2021-10-04 20:17:37 +01:00
Pablo Galindo 6145192287 Python 3.10.0
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmFbPJ8ACgkQ/+h0BBaL
 2EfHRRAAvS0Z8NNZXSzsyQ42kLtR6Sni7hxw5D1ChD0h4hSk+zyybUUnMlAiZhf+
 fGuoj3rTncE/J756EYlF9/tuNVgx/LAkLNzFAIBnCq/r1xaHBQ/E4QxxMoqNQ2Bq
 xfB0gyGScy1HtMF6thhv18udG0Npgu+eIbwtqtVdJeUkuTgTsUz7+EOu9FZdap4t
 s/PB7F29gw8UVVMz8kR6IyIE1Rq6c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zp7yP/XVIxvsT+fA6Kpp7ySxTpNNCgrhzEH3GfC/p8g7hBuPYNEjFiYOPQQ
 WS5NbJsuAi7SdfATxcjYaVkQzsn8mJYcN1cUD1HQvCNb28jLFEzzgdIPCDLkTHKL
 35SrFiTJFYXqWZa140j9L/3YROAsUJAmP+jdzRtEYqS4BKpuc0DVWt8p1+bFERH9
 UnMzn5PReIufBi5BjAW6SMNhHYoZC0nqX90T9aQAftYyuBF3d4U=
 =T4+A
 -----END PGP SIGNATURE-----

Merge tag 'v3.10.0' into 3.10

Python 3.10.0
2021-10-04 20:12:06 +01:00
Pablo Galindo b494f5935c
Python 3.10.0 2021-10-04 18:40:46 +01:00
Serhiy Storchaka edf190b97e
[3.10] Remove trailing spaces (GH-28709) 2021-10-04 00:40:48 +01:00
Serhiy Storchaka 93242d7a2a
[3.10] Remove trailing spaces (GH-28709) 2021-10-03 20:03:49 +03:00
Miss Islington (bot) 80285ecc8d
closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) (GH-28636)
Automerge-Triggered-By: GH:benjaminp
(cherry picked from commit 196998e220)

Co-authored-by: Geoffrey Thomas <geofft@ldpreload.com>
2021-09-30 01:02:11 +02:00
Łukasz Langa b09a68ac87
[3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 8f943ca257)

Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
2021-09-29 12:36:59 +01:00
Serhiy Storchaka 2ca4ab8031
[3.10] bpo-45307: Restore private C API function _PyImport_FindExtensionObject() (GH-28594)
py2exe and PyOxidizer rely on this API.
It will be removed in Python 3.11.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-29 12:27:08 +01:00
Serhiy Storchaka ec4e2ec241
[3.10] bpo-45307: Restore private C API function _PyImport_FindExtensionObject() (GH-28594)
py2exe and PyOxidizer rely on this API.
It will be removed in Python 3.11.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-28 23:12:50 +02:00
Łukasz Langa 8c1e1da565
[3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 8f943ca257)

Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
2021-09-22 01:33:59 +02:00
Miss Islington (bot) 6b996d61c9
[3.10] bpo-45083: Include the exception class qualname when formatting an exception (GH-28119) (GH-28134)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
(cherry picked from commit b4b6342848)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>

* Use a private version of _PyType_GetQualName

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-08 18:32:19 +02:00
Pablo Galindo 8afab2ebbc
Post 3.10.0rc2 2021-09-07 15:39:51 +01:00
Pablo Galindo 839d789394
Python 3.10.0rc2 2021-09-07 14:18:28 +01:00
Miss Islington (bot) 53257cf19f
bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194) (GH-28199)
Fix PyAiter_Check to only check for the `__anext__` presense (not for
`__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`,
`PyObject_GetAiter()` -> `PyObject_GetAIter()`.
2021-09-07 12:43:33 +01:00
Pablo Galindo 2b8d4eaec9
Post 3.10.0rc1 2021-08-02 22:37:13 +01:00
Pablo Galindo cc115e5bf6
Python 3.10.0rc1 2021-08-02 20:53:59 +01:00
Miss Islington (bot) 6b922dae6c
bpo-41103: Resurrect the old buffer protocol. (GH-27437) (GH-27441)
Revert "bpo-41103: Remove old buffer protocol support (GH-21117)"

This reverts commit 6f8a6ee59c.
(cherry picked from commit ce5e1a6809)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-07-29 13:31:42 +02:00
Miss Islington (bot) 632e8a6959
bpo-42747: Remove Py_TPFLAGS_HAVE_AM_SEND and make Py_TPFLAGS_HAVE_VERSION_TAG no-op (GH-27260) (GH-27306)
* Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG

    The field is always present in the type struct, as explained
    in the added comment.

* Remove Py_TPFLAGS_HAVE_AM_SEND

    The flag is not needed, and since it was added in 3.10 it can be removed now.
(cherry picked from commit a4760cc32d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-07-23 16:56:53 +02:00
Serhiy Storchaka a6670cdf77
[3.10] bpo-44654: Do not export the union type related symbols (GH-27223). (GH-27225)
(cherry picked from commit 8f50f44592)
2021-07-18 18:37:41 +03:00
Miss Islington (bot) 03aad3049d
[3.10] bpo-44654: Refactor and clean up the union type implementation (GH-27196) (GH-27219)
(cherry picked from commit 0fd27375ca)
2021-07-18 00:10:21 +03:00
Serhiy Storchaka 2d055ce132
[3.10] bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980) (GH-27207)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>.
(cherry picked from commit c45fa1a5d9)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-17 22:14:57 +03:00
Pablo Galindo bff66d0c3f
Post 3.10.0b4 2021-07-10 02:27:16 +01:00
Pablo Galindo 2ba4b20854
Python 3.10.0b4 2021-07-10 01:51:07 +01:00
Miss Islington (bot) cf739332bd
bpo-44458: Ensure BUFFER_BLOCK_SIZE symbol is statically allocated. (GH-26808) (GH-26844)
* bpo-44458: Ensure BUFFER_BLOCK_SIZE symbol is statically allocated.
(cherry picked from commit 92c2e91580)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2021-06-22 00:10:23 -07:00
Pablo Galindo 4f71b0199b
Post 3.10.0b3 2021-06-17 13:20:47 +01:00
Pablo Galindo 865714a117
Python 3.10.0b3 2021-06-17 11:29:18 +01:00
Serhiy Storchaka c43317d41e
[3.10] Add more const modifiers. (GH-26691). (GH-26692)
(cherry picked from commit be8b631b7a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-06-12 18:44:32 +01:00
Miss Islington (bot) e6d28a1a6a
bpo-44378: Fix a compiler warning in Py_IS_TYPE() (GH-26644)
Py_IS_TYPE() no longer uses Py_TYPE() to avoid a compiler warning:
no longer cast "const PyObject*" to "PyObject*".
(cherry picked from commit 304dfec8d3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-06-11 01:57:16 -07:00
Miss Islington (bot) 0895e62c9b
bpo-44363: Get test_capi passing with address sanitizer (GH-26639)
(cherry picked from commit 31aa0dbff4)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2021-06-10 05:02:22 -07:00
Pablo Galindo 3f592c3665
Post 3.10.0b2 2021-05-31 12:58:35 +01:00
Pablo Galindo 317314165a
Python 3.10.0b2 2021-05-31 12:30:34 +01:00
Miss Islington (bot) 68b9c20a98
bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI (GH-26241) (GH-26353)
Py_FrozenMain was added to the Limited C API in [bpo-42591]() (3.10.0a4);
but to fix that issue it would be enough to add it to the regular C API.

The function is undocumented, tests were added very recently ([bpo-44131]()),
and most importantly, it is not present in all builds of Python, as
the linker sometimes omits it as unused.
It should be added back when these issues are fixed.

Note that this does not affect Python's regular C API.
(cherry picked from commit d16856960e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-05-25 12:59:10 +01:00
Miss Islington (bot) 1fb6b9e91d
bpo-44201: Avoid side effects of "invalid_*" rules in the REPL (GH-26298) (GH-26313)
When the parser does a second pass to check for errors, these rules can
have some small side-effects as they may advance the parser more than
the point reached in the first pass. This can cause the tokenizer to ask
for extra tokens in interactive mode causing the tokenizer to show the
prompt instead of failing instantly.

To avoid this, add a new mode to the tokenizer that is activated in the
second pass and deactivates asking for new tokens when the interactive
line is finished. As the parsing should have reached the last line in
the first pass, the second pass should not need to ask for more tokens.

(cherry picked from commit bd7476dae3)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-22 23:23:26 +01:00
Miss Islington (bot) 50b0d148a6
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274) (GH-26290)
Fix a crash at Python exit when a deallocator function removes the
last strong reference to a heap type.

Don't read type memory after calling basedealloc() since
basedealloc() can deallocate the type and free its memory.

_PyMem_IsPtrFreed() argument is now constant.
(cherry picked from commit 615069eb08)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-05-22 00:50:11 +02:00
Miss Islington (bot) 373937182e
bpo-43795: PEP 652 user documentation (GH-25668) (GH-26034)
- Reformat the C API and ABI Versioning page (and extend/clarify a bit)
- Rewrite the stable ABI docs into a general text on C API Compatibility
- Add a list of Limited API contents, and notes for the individual items.
- Replace `Include/README.rst` with a link to a devguide page with the same info
(cherry picked from commit b05955d6f5)

Co-authored-by: Petr Viktorin <encukou@gmail.com>

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-05-13 22:29:09 -07:00
Pablo Galindo 1d320fe189
Post 3.10.0b1 2021-05-03 21:16:33 +01:00
Pablo Galindo ba4217537c
Python 3.10.0b1 2021-05-03 20:34:56 +01:00
Dennis Sweeney 80a2a4ed7d
bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)
- Make case-swaps half the cost of any other edit
- Refactor Levenshtein code to not use memory allocator, and to bail early on no match.
- Add comments to Levenshtein distance code
- Add test cases for Levenshtein distance behind a debug macro
- Set threshold to `(name_size + item_size + 3) * MOVE_COST / 6`.
  - Reasoning: similar to `difflib.SequenceMatcher.ratio()` >= 2/3:
```
"Multiset Jaccard similarity" >= 2/3
matching letters / total letters >= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) >= 2/3
1 - (2*distance) / (name_size + item_size) >= 2/3
1/3 >= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 >= distance
With rounding:
(name_size + item_size + 3) // 6 >= distance
```

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-05-03 16:47:27 +01:00
Pablo Galindo c2931d31f8
bpo-43916: Move the _PyStructSequence_InitType function to the internal API (GH-25854) 2021-05-03 15:50:24 +01:00
Batuhan Taskaya ad106c68eb
bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583) 2021-05-03 10:43:00 +03:00
Brandt Bucher 0ad1e0384c
bpo-43754: Eliminate bindings for partial pattern matches (GH-25229) 2021-05-02 13:02:10 -07:00
Pablo Galindo 558df90109
bpo-43916: Export the _PyStructSequence_InitType to fix build errors in the curses module (GH-25768) 2021-05-01 02:21:19 +01:00
Jakub Kulík 9032cf5cb1
bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris (GH-25096) 2021-04-30 15:21:42 +02:00
Victor Stinner 3bb09947ec
bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag (GH-25721)
Add a new Py_TPFLAGS_DISALLOW_INSTANTIATION type flag to disallow
creating type instances: set tp_new to NULL and don't create the
"__new__" key in the type dictionary.

The flag is set automatically on static types if tp_base is NULL or
&PyBaseObject_Type and tp_new is NULL.

Use the flag on the following types:

* _curses.ncurses_version type
* _curses_panel.panel
* _tkinter.Tcl_Obj
* _tkinter.tkapp
* _tkinter.tktimertoken
* _xxsubinterpretersmodule.ChannelID
* sys.flags type
* sys.getwindowsversion() type
* sys.version_info type

Update MyStr example in the C API documentation to use
Py_TPFLAGS_DISALLOW_INSTANTIATION.

Add _PyStructSequence_InitType() function to create a structseq type
with the Py_TPFLAGS_DISALLOW_INSTANTIATION flag set.

type_new() calls _PyType_CheckConsistency() at exit.
2021-04-30 12:46:15 +02:00
Mark Shannon 069e81ab3d
bpo-43977: Use tp_flags for collection matching (GH-25723)
* Add Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING, add to all relevant standard builtin classes.

* Set relevant flags on collections.abc.Sequence and Mapping.

* Use flags in MATCH_SEQUENCE and MATCH_MAPPING opcodes.

* Inherit Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING.

* Add NEWS

* Remove interpreter-state map_abc and seq_abc fields.
2021-04-30 09:50:28 +01:00
Steve Dower 87655e2cf5
bpo-42800: Rename AUDIT_READ to PY_AUDIT_READ (GH-25736) 2021-04-30 01:08:55 +01:00