Commit Graph

6891 Commits

Author SHA1 Message Date
Jelle Zijlstra f82b32410b
[3.9] gh-92112: Fix crash triggered by an evil custom `mro()` (GH-92113) (GH-92372)
(cherry picked from commit 85354ed78c)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2022-05-16 18:47:35 +02:00
Dennis Sweeney 801f77119d
[3.9] gh-92311: Let frame_setlineno jump over listcomps (#92740) 2022-05-12 17:41:34 -04:00
Thaddeus1499 e48da72647
[3.9] Remove effbot urls (GH-26308). (#92162)
(cherry picked from commit e9f66aedf4)

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
2022-05-02 12:22:05 -06:00
Miss Islington (bot) 206f416bd0
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:59:40 -07:00
Oleg Iarygin 312e16fb7b
[3.9] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91664)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a573cb2fec)
2022-04-19 12:58:34 -07:00
Miss Islington (bot) edf1a77f23
gh-91421: Use constant value check during runtime (GH-91422) (GH-91493)
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:55 -07:00
Miss Islington (bot) 98d57737de
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:24:39 -07:00
Miss Islington (bot) d04a21344a
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:49:40 -07:00
Miss Islington (bot) f1a5e1b89a
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:55:12 -07:00
Victor Stinner a549cd1fc5
bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558) (GH-31581)
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 16:13:34 +01:00
Miss Islington (bot) 8eb18d842c
[3.9] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31474)
(cherry picked from commit 0a222db2bc)


Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-21 09:18:55 -08:00
Dennis Sweeney c31b8a97a8
bpo-46615: Don't crash when set operations mutate the sets (GH-31120) (GH-31312)
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)
2022-02-13 12:29:42 +02:00
Miss Islington (bot) f1796f2947
bpo-46417: Fix race condition on setting type __bases__ (GH-30788) (GH-30790)
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:42 +01:00
Miss Islington (bot) 54feddae88
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:30 -08:00
Miss Islington (bot) 2d4049da1f
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:19 -08:00
Miss Islington (bot) f5287ecd59
bpo-45392: Update the docstring of the 'type' built-in (GH-29439) (GH-29453)
(cherry picked from commit 9127520729)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2021-11-06 21:17:59 +01:00
Miss Islington (bot) 1e29dce113
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048) (GH-29178)
* 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-11-04 21:20:21 +01:00
Serhiy Storchaka 6848602806
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28953)
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)
2021-10-14 21:23:52 +03:00
Serhiy Storchaka 7c722e32bf
[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28945)
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:03:29 +03:00
Christian Clauss 960e7b3ba1
[3.9] Fix typos in the Objects directory (GH-28766) (GH-28795)
(cherry picked from commit 5f401f1040)

Automerge-Triggered-By: GH:JulienPalard
2021-10-07 07:09:41 -07:00
Dong-hee Na 660718dba5
[3.9] bpo-45385: Fix reference leak from descr_check (GH-28719) (GH-28780)
(cherry picked from commit e6ff4eba6d)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-10-07 11:10:15 +09:00
Serhiy Storchaka e9ce081ec7
[3.9] Remove trailing spaces (GH-28710) 2021-10-03 20:04:38 +03:00
Łukasz Langa 5482db5800
[3.9] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28512)
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 17:32:04 +02:00
Miss Islington (bot) 2746045a37
bpo-45167: Fix deepcopying of GenericAlias (GH-28324) (GH-28368)
(cherry picked from commit 5dce51a887)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-15 21:31:14 +02:00
Miss Islington (bot) fecd17fbcb
bpo-45030: Fix integer overflow in __reduce__ of the range iterator (GH-28000)
It happened with fast range iterator  when the calculated stop = start + step * len
was out of the C long range.
(cherry picked from commit 936f6a16b9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-04 13:39:47 -07:00
Miss Islington (bot) 41c2374024
[3.9] bpo-45083: Include the exception class qualname when formatting an exception (GH-28119) (GH-28135)
* bpo-45083: Include the exception class qualname when formatting an exception (GH-28119)

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>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-03 18:56:05 +02:00
Miss Islington (bot) 02437641d2
bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938) (GH-27991)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 94a3d2a632)

Co-authored-by: chilaxan <chilaxan@gmail.com>
2021-08-27 12:52:07 +02:00
Miss Islington (bot) 7ef0673de4
bpo-44954: Fix wrong result in float.fromhex corner case (GH-27834) (GH-27855)
(cherry picked from commit 60b93d9e49)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2021-08-20 12:37:41 +01:00
Miss Islington (bot) beb3a835da
bpo-44698: Restore complex pow behaviour for small integral exponents (GH-27772) (GH-27797)
(cherry picked from commit 4b9a2dcf19)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2021-08-17 18:38:39 +01:00
Miss Islington (bot) 15f0a45b28
bpo-33930: Fix segfault with deep recursion when cleaning method objects (GH-27678) (GH-27720)
(cherry picked from commit bfc2d5a5c4)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-08-11 10:32:24 +02:00
Irit Katriel ede1dc416d
bpo-44872: use new trashcan macros in framobject.c (GH-27683) (GH-27691) 2021-08-10 09:55:39 +02:00
Miss Islington (bot) 12fc0d28fc
bpo-44707: Fix an undefined behavior of the null pointer arithmetic (GH-27292) (GH-27443)
(cherry picked from commit e5c8ddb171)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-29 14:05:43 +02:00
Miss Islington (bot) c48720576d
bpo-44657: Fix instancemethod_call to use PyInstanceMethod_GET_FUNCTION (GH-27202)
(cherry picked from commit ddf8ae31a0)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-07-28 06:33:03 -07:00
Miss Islington (bot) 85ac81499e
bpo-44698: Fix undefined behaviour in complex exponentiation. (GH-27278) (GH-27367)
(cherry picked from commit 1d582bbc96)

Co-authored-by: T. Wouters <thomas@python.org>
2021-07-26 21:30:11 +02:00
Miss Islington (bot) 0a08f22184
bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ (GH-27316) (#27325)
(cherry picked from commit 5370f0a82a)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-07-24 11:45:40 +02:00
Miss Islington (bot) 298ee657ab
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)
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>
2021-07-15 16:36:51 -07:00
Miss Islington (bot) 0b4704973d
bpo-44184: Apply GH-26274 to the non-GC-type branch of subtype_dealloc (GH-27165) (GH-27175)
The non-GC-type branch of subtype_dealloc is using the type of an object after freeing in the same unsafe way as GH-26274 fixes. (I believe the old news entry covers this change well enough.)

https://bugs.python.org/issue44184
(cherry picked from commit 074e7659f2)

Co-authored-by: T. Wouters <thomas@python.org>
2021-07-16 01:35:25 +02:00
Ken Jin 51a29c42f1
[3.9] bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27028) 2021-07-05 17:22:43 +01:00
Pablo Galindo fe847a6285
Revert "bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27018)" (GH-27022)
This reverts commit 4684a34c8d.
2021-07-04 20:26:34 +01:00
Miss Islington (bot) 4684a34c8d
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27018)
(cherry picked from commit d33943a6c3)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-04 18:55:43 +01:00
Miss Islington (bot) f790bc8084
bpo-44523: Remove the pass-through for hash() in weakref proxy objects (GH-26950) (GH-26960)
(cherry picked from commit e2fea101fd)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-30 00:19:32 +01:00
Miss Islington (bot) 9ee8752162
Fix a potential reference-counting bug in long_pow (GH-26690) (#26702)
(cherry picked from commit 5924243199)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2021-06-13 08:42:43 +01:00
Jakub Kulík d3cc68900d
[3.9] bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris (GH-25096) (GH-25847)
(cherry picked from commit 9032cf5cb1)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2021-05-21 16:59:39 +02:00
Miss Islington (bot) 925cb85e9e
bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) (GH-26093)
These are passed and called as PyCFunction, however they are defined here without the (ignored) args parameter.

This works fine in some C compilers, but fails in webassembly or anything else that has strict function pointer call type checking.
(cherry picked from commit ab383eb6f0)

Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>

Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
2021-05-16 17:34:43 +03:00
Miss Islington (bot) 04c4610194
bpo-44114: Remove redundant cast. (GH-26098)
(cherry picked from commit e0c614e5fd)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-05-13 14:07:16 -07:00
Petr Viktorin ec18362f6a
[3.9] bpo-42083: Allow NULL doc in PyStructSequence_NewType (#25896)
(cherry picked from commit 2f5baa1750)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-05-04 16:07:13 +02:00
Steve Dower bb2f3ff7a8
bpo-42800: Add audit events for f_code and tb_frame (GH-24182)
Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name):
* PyTracebackObject: tb_frame
* PyFrameObject: f_code
* PyGenObject: gi_code, gi_frame
* PyCoroObject: cr_code, cr_frame
* PyAsyncGenObject: ag_code, ag_frame
2021-05-03 14:06:36 +01:00
Miss Islington (bot) d0698c676c
bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208) (#24211)
Before, using the * operator to repeat a bytearray would copy data from the start of
the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).
(cherry picked from commit 61d8c54f43)

Co-authored-by: Tobias Holl <TobiasHoll@users.noreply.github.com>
2021-04-26 21:39:51 +02:00
Miss Islington (bot) aa967ec4d4
bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)
Python no longer fails at startup with a fatal error if a command
line argument contains an invalid Unicode character.

The Py_DecodeLocale() function now escapes byte sequences which would
be decoded as Unicode characters outside the [U+0000; U+10ffff]
range.

Use MAX_UNICODE constant in unicodeobject.c.
(cherry picked from commit 9976834f80)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-03-17 14:11:14 -07:00
Ammar Askar db73376106
[3.9] bpo-43499: Restrict co_code to be under INT_MAX in codeobject (GH-20628) (GH-24896)
(cherry picked from commit 3b3b83c965)
2021-03-17 20:26:38 +02:00