Commit Graph

7140 Commits

Author SHA1 Message Date
Miss Islington (bot) 2d79804bb0
GH-91153: Handle mutating __index__ methods in bytearray item assignment (GH-94891)
(cherry picked from commit f36589510b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-19 10:04:47 -07:00
Neil Schemenauer 5d26f85521
[3.10] gh-94841: Ensure arena_map_get() is inlined in PyObject_Free() (GH-94842)
Need to define ALWAYS_INLINE macro for 3.10.

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2022-07-14 17:26:40 -07:00
Ken Jin 73b1d494a7
gh-92888: Fix memoryview bad `__index__` use after free (GH-92946) (GH-93950)
(cherry picked from commit 11190c4ad0)

Co-authored-by: chilaxan <35645806+chilaxan@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
2022-06-23 18:10:14 +08:00
Miss Islington (bot) 1b8aa7aafd
gh-93021: Fix __text_signature__ for __get__ (GH-93023) (GH-94086)
Because of the way wrap_descr_get is written, the second argument
to __get__ methods implemented through the wrapper is always
optional.
(cherry picked from commit 4e08fbcfdf)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-06-21 22:32:24 +02:00
Serhiy Storchaka 54250e7353
[3.10] gh-79512: Fixed names and __module__ value of weakref classes (GH-93719) (GH-94071)
Classes ReferenceType, ProxyType and CallableProxyType have now correct
atrtributes __module__, __name__ and __qualname__.
It makes them (types, not instances) pickleable.
(cherry picked from commit 8352e322e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-21 22:36:09 +03:00
Kumar Aditya beba1020a9
GH-93990: fix refcounting bug in `add_subclass` in `typeobject.c` (GH-93989) (GH-93999)
(cherry picked from commit 726448ebe1)
2022-06-19 19:26:13 +08:00
Miss Islington (bot) 9204364e40
gh-92914: Round the allocated size for lists up to the even number (GH-92915) (GH-92942)
(cherry picked from commit 8a6af5a346)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-07 10:54:40 +02:00
Miss Islington (bot) 60adc4b92a
Fix missing word in sys.float_info docstring (GH-93489) (GH-93496)
(cherry picked from commit e12f34b6d8)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-06-04 20:23:22 +01:00
Miss Islington (bot) 009aeb6bb6
bpo-39829: Fix `__len__()` is called twice in list() constructor (GH-31816)
(cherry picked from commit 2153daf0a0)

This patch fixes gh-87740 too.

Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
2022-05-18 13:16:58 +09:00
Dennis Sweeney a24e676973
[3.10] gh-92311: Let frame_setlineno jump over listcomps (GH-92717) 2022-05-12 16:31:43 +01:00
Jelle Zijlstra 4674b315e5
[3.10] gh-92112: Fix crash triggered by an evil custom `mro()` (GH-92113) (#92370)
(cherry picked from commit 85354ed78c)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2022-05-06 21:01:23 -07:00
Miss Islington (bot) 0eef443f01
Issues/88027: A potential double free in list_sort_impl (GH-92367)
merge_freemem(): set keys to NULL do it's harmless to call this again.
(cherry picked from commit 9652900969)

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2022-05-05 21:38:14 -07:00
Thaddeus1499 c8ab1633fc
[3.10] bpo-43504: Remove effbot urls (GH-26308) (#92161)
* [3.10] Remove effbot urls (GH-26308).
(cherry picked from commit e9f66aedf4)

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
2022-05-02 12:21:51 -06:00
Miss Islington (bot) d985c8e2e0
bpo-36819: Fix crashes in built-in encoders with weird error handlers (GH-28593)
If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d773e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-02 02:58:41 -07:00
Oleg Iarygin e7e8a9fa4f
[3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91662)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a573cb2fec)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-04-19 13:01:09 -07:00
Miss Islington (bot) 72114c06fd
gh-91421: Use constant value check during runtime (GH-91422) (GH-91492)
The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.

Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.

Prevents a very unlikely integer overflow on 32 bit systems.

Fixes GH-91421.
(cherry picked from commit 0859368335)

Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com>
2022-04-13 18:38:37 -07:00
Miss Islington (bot) 69edc30d2b
Fix bad grammar and import docstring for split/rsplit (GH-32381) (GH-32416) 2022-04-08 12:06:19 -05:00
Christian Heimes 55d5c96c57
[3.10] bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212) (GH-32216)
Co-authored-by: Christian Heimes <christian@python.org>
2022-04-01 10:44:56 +02:00
Miss Islington (bot) 625f6704c0
bpo-14911: Corrected generator.throw() documentation (GH-32207)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 8be7c2bc5a)

Co-authored-by: Dave Goncalves <davegoncalves@gmail.com>
2022-03-31 07:23:04 -07:00
Miss Islington (bot) 1f2ec4cef1
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
(cherry picked from commit d0c67ea064)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-03-30 18:48:31 -07:00
Miss Islington (bot) cebdc32558
bpo-43721: Fix docstrings for property.getter/setter/deleter (GH-31046)
(cherry picked from commit e3d348a525)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-03-14 16:51:55 -07:00
Pablo Galindo Salgado 3594ebca2c
[3.10] bpo-46940: Don't override existing AttributeError suggestion information (GH-31710) (GH-31724)
When an exception is created in a nested call to PyObject_GetAttr, any
external calls will override the context information of the
AttributeError that we have already placed in the most internal call.
This will cause the suggestions we create to nor work properly as the
attribute name and object that we will be using are the incorrect ones.

To avoid this, we need to check first if these attributes are already
set and bail out if that's the case..
(cherry picked from commit 3b3be05a16)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-03-07 13:18:36 +00:00
Victor Stinner 0848da19ce
bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558) (GH-31578)
Rename the private undocumented float.__set_format__() method to
float.__setformat__() to fix a typo introduced in Python 3.7. The
method is only used by test_float.

The change enables again test_float tests on the float format which
were previously skipped because of the typo.

The typo was introduced in Python 3.7 by bpo-20185
in commit b5c51d3dd9.

(cherry picked from commit 7d03c8be5a)
2022-02-25 15:47:07 +01:00
Miss Islington (bot) c596ecbf82
[3.10] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31473)
(cherry picked from commit 0a222db2bc)


Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-21 09:18:48 -08:00
Miss Islington (bot) 1f5fe9962f
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
Ensure strong references are acquired whenever using `set_next()`. Added randomized test cases for `__eq__` methods that sometimes mutate sets when called.
(cherry picked from commit 4a66615ba7)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-02-11 12:44:17 -08:00
Petr Viktorin 8b8673fe94
[3.10] bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696) (GH-31262)
(cherry picked from commit 0ef0853012)
2022-02-11 12:25:25 +01:00
Miss Islington (bot) acda9f3b90
bpo-46417: Fix race condition on setting type __bases__ (GH-30788) (GH-30789)
Fix a race condition on setting a type __bases__ attribute: the
internal function add_subclass() now gets the
PyTypeObject.tp_subclasses member after calling PyWeakref_NewRef()
which can trigger a garbage collection which can indirectly modify
PyTypeObject.tp_subclasses.
(cherry picked from commit f1c6ae3270)

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

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-01-22 15:28:36 +01:00
Miss Islington (bot) d2b7e08d86
docs: correct outdated MappingProxyType docstrings (GH-30281)
The docstrings for MappingProxyType's keys(), values(), and items()
methods were never updated to reflect the changes that Python 3 brought
to these APIs, namely returning views rather than lists.
(cherry picked from commit 2d10fa9bc4)

Co-authored-by: Joshua Bronson <jabronson@gmail.com>
2022-01-19 13:57:09 -08:00
Victor Stinner 72c260cf0c
[3.10] bpo-46006: Revert "bpo-40521: Per-interpreter interned strings (GH-20085)" (GH-30422) (GH-30425)
This reverts commit ea251806b8.

Keep "assert(interned == NULL);" in _PyUnicode_Fini(), but only for
the main interpreter.

Keep _PyUnicode_ClearInterned() changes avoiding the creation of a
temporary Python list object.

Leave the PyInterpreterState structure unchanged to keep the ABI
backward compatibility with Python 3.10.0: rename the "interned"
member to "unused_interned".

(cherry picked from commit 35d6540c90)
2022-01-06 16:12:28 +01:00
Miss Islington (bot) da8be157f4
bpo-46236: Fix PyFunction_GetAnnotations() returned tuple. (GH-30409)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 46e4c257e7)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2022-01-05 05:12:21 -08:00
Miss Islington (bot) 1b37268ef1
bpo-46085: Fix iterator cache mechanism of OrderedDict. (GH-30290)
(cherry picked from commit fb44d05896)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-12-29 21:29:03 -08:00
Mark Shannon 99c72326d2
[3.10] bpo-46009: Do not exhaust generator when send() method raises (GH-29986). (GH-29988)
* [3.10] bpo-46009: Do not exhaust generator when send() method raises (GH-29986).
(cherry picked from commit 69806b9516)

Co-authored-by: Mark Shannon <mark@hotpy.org>

* Rename variable after cherry-pick.

* Add NULL check.
2021-12-08 14:46:32 +00:00
Miss Islington (bot) 045f205ba4
bpo-45392: Update the docstring of the 'type' built-in (GH-29439) (GH-29452)
(cherry picked from commit 9127520729)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2021-11-06 21:21:04 +01:00
Miss Islington (bot) f812fef2f8
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048)
* Use Py_EnterRecursiveCall() in issubclass()

Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google]
(cherry picked from commit 423fa1c181)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-10-22 14:46:56 -07:00
Miss Islington (bot) 1cdac61065
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051) (GH-29122)
MAP_BOT_LENGTH was incorrectly used to compute MAP_TOP_MASK instead of
MAP_TOP_LENGTH. On 64-bit machines, the error causes the tree to hold
46-bits of virtual addresses, rather than the intended 48-bits.
(cherry picked from commit 311910b31a)
2021-10-21 08:39:58 -07: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 dcfbe4f72d
[3.10] Fix typos in the Objects directory (GH-28766) (GH-28797)
(cherry picked from commit 5f401f1040)

Automerge-Triggered-By: GH:JulienPalard
2021-10-07 07:31:33 -07:00
Miss Islington (bot) 35d4857375
bpo-45385: Fix reference leak from descr_check (GH-28719) (GH-28779) 2021-10-07 16:48:00 +09:00
Serhiy Storchaka 1670d590fa
[3.10] bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720). (GH-28721)
(cherry picked from commit 252b7bcb23)
2021-10-04 17:07:21 +03:00
Serhiy Storchaka b5499784ec
[3.10] bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711). (GH-28718)
(cherry picked from commit 60b9e040c9)
2021-10-04 15:01:11 +03:00
Serhiy Storchaka 93242d7a2a
[3.10] Remove trailing spaces (GH-28709) 2021-10-03 20:03:49 +03:00
Miss Islington (bot) 5ba61f488d
Fix spelling error in comment (GH-28696) (GH-28699) 2021-10-02 14:33:49 -05: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) 9c23a1ebad
bpo-44640: Improve punctuation consistency in isinstance/issubclass error messages (GH-27144) (GH-28436)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit f4813388b4)

Co-authored-by: wyz23x2 <52805709+wyz23x2@users.noreply.github.com>

Co-authored-by: wyz23x2 <52805709+wyz23x2@users.noreply.github.com>
2021-09-19 20:11:41 +01:00
Miss Islington (bot) 7ab114bf1f
bpo-45198: __set_name__ documentation not clear about its usage with non-descriptor classes (GH-28439)
(cherry picked from commit 94b462686b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2021-09-18 00:10:00 -07:00
Miss Islington (bot) de4c9c0bdc
bpo-45167: Fix deepcopying of GenericAlias (GH-28324) (GH-28367)
(cherry picked from commit 5dce51a887)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-15 21:35:16 +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
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
Miss Islington (bot) adc80a58f9
bpo-44963: Implement send() and throw() methods for anext_awaitable objects (GH-27955)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
(cherry picked from commit 533e725821)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-07 03:52:53 -07:00