Victor Stinner
aa5c0a9f8d
bpo-40421: Cleanup PyFrame C API (GH-32417)
2022-04-19 09:53:10 +02:00
Oleg Iarygin
7fbc7f6128
gh-91098: Use Argument Clinic for Object/classobject.c to fix docstrings ( #31711 )
...
Closes GH-91098.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-18 19:56:53 -07:00
Oleg Iarygin
2f0fc521f4
gh-91102: Use Argument Clinic for EncodingMap ( #31725 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-18 13:43:56 -07:00
Kumar Aditya
8c54c3dacc
gh-91576: Speed up iteration of strings ( #91574 )
2022-04-18 07:18:27 -07:00
Oleg Iarygin
a573cb2fec
gh-91118: Fix docstrings that do not honor --without-doc-strings ( #31769 )
...
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-17 20:39:32 -07:00
Irit Katriel
d4c4a76ed1
gh-89770: Implement PEP-678 - Exception notes (GH-31317)
2022-04-16 19:59:52 +01:00
Pieter Eendebak
355cbaadbb
gh-91266: refactor bytearray strip methods (GH-32096)
2022-04-13 22:20:38 -04:00
Pablo Galindo Salgado
37a53fb6bd
gh-91502: Add a new API to check if a frame is an entry frame (GH-91503)
2022-04-13 14:06:56 +01:00
Tobias Stoeckmann
0859368335
gh-91421: Use constant value check during runtime (GH-91422)
...
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.
2022-04-12 20:01:02 -07:00
Dennis Sweeney
8be8949116
gh-91117: Ensure integer mod and pow operations use cached small ints (GH-31843)
2022-04-11 16:07:09 -04:00
Mark Shannon
f6e43e834c
GH-89480: Document motivation, design and implementation of 3.11 frame stack. (GH-32304)
2022-04-11 16:05:20 +01:00
John Belmonte
b0b836b20c
bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)
...
Add "z" format specifier to coerce negative 0 to zero.
See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995 ) for discussion.
This covers `str.format()` and f-strings. Old-style string interpolation is not supported.
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-04-11 15:34:18 +01:00
Irit Katriel
dd207a6ac5
bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400)
2022-04-11 10:40:24 +01:00
Raymond Hettinger
d6fb104690
Fix bad grammar and import docstring for split/rsplit (GH-32381)
2022-04-08 08:36:20 -05:00
Mark Shannon
5b4a4b6f09
Add new PyFrame_GetLasti C-API function (GH-32413)
2022-04-08 12:18:57 +01:00
Dong-hee Na
e2d78baed3
bpo-47250: Fix refleak from object.__getstate__() (GH-32403)
...
Co-authored-by: Brandt Bucher <brandt@python.org>
2022-04-08 08:27:00 +09:00
Brandt Bucher
ef6a482b02
bpo-47177: Replace f_lasti
with prev_instr
(GH-32208)
2022-04-07 12:31:01 -07:00
Victor Stinner
85addfb9c6
bpo-35134: Remove the Include/code.h header file (GH-32385)
...
Remove the Include/code.h header file. C extensions should only
include the main <Python.h> header file.
Python.h includes directly Include/cpython/code.h instead.
2022-04-07 02:29:52 +02:00
Serhiy Storchaka
884eba3c76
bpo-26579: Add object.__getstate__(). (GH-2821)
...
Copying and pickling instances of subclasses of builtin types
bytearray, set, frozenset, collections.OrderedDict, collections.deque,
weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
implemented as slots.
2022-04-06 20:00:14 +03:00
Serhiy Storchaka
a69a4a917c
bpo-46721: Optimize set.issuperset() for non-set arguments (GH-31280)
2022-04-06 19:57:13 +03:00
Serhiy Storchaka
31cd25f4e1
bpo-43464: Optimize set.intersection() for non-set arguments (GH-31316)
2022-04-06 19:56:28 +03:00
Irit Katriel
0aa8d5cbd8
bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221)
2022-04-05 12:49:08 +01:00
Irit Katriel
32091df41c
bpo-47186: Replace JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH + jump (GH-32309)
2022-04-05 12:06:22 +01:00
Dong-hee Na
b183f48649
no-issue: Add assertion to PyModule_GetName for understanding (GH-32236)
2022-04-02 09:56:30 +09:00
Irit Katriel
04e07c258f
bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)
2022-04-01 13:59:38 +01:00
Brandt Bucher
ae9de82e32
bpo-46841: Use a bytes
object for _co_code_adaptive
(GH-32205)
2022-04-01 12:28:50 +01:00
Brandt Bucher
bd2e47c883
bpo-46841: Avoid unnecessary allocations in code object comparisons (GH-32222)
2022-04-01 11:42:46 +01:00
Dennis Sweeney
a0ea7a116c
bpo-47009: Streamline list.append for the common case (GH-31864)
2022-04-01 11:23:42 +01:00
Mark Shannon
74b95d86e0
bpo-40421: Add missing getters for frame object attributes to C-API. (GH-32114)
2022-03-31 17:13:25 +01:00
Christian Heimes
44e915028d
bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212)
...
Automerge-Triggered-By: GH:tiran
2022-03-31 08:14:50 -07:00
Dave Goncalves
8be7c2bc5a
bpo-14911: Corrected generator.throw() documentation (GH-32207)
...
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-31 16:56:48 +03:00
Irit Katriel
a00518d9ad
bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD (GH-32115)
2022-03-31 14:14:15 +01:00
Victor Stinner
c14d7e4b81
bpo-47164: Add _PyASCIIObject_CAST() macro (GH-32191)
...
Add macros to cast objects to PyASCIIObject*, PyCompactUnicodeObject*
and PyUnicodeObject*: _PyASCIIObject_CAST(),
_PyCompactUnicodeObject_CAST() and _PyUnicodeObject_CAST(). Using
these new macros make the code more readable and check their argument
with: assert(PyUnicode_Check(op)).
Remove redundant assert(PyUnicode_Check(op)) in macros using directly
or indirectly these new CAST macros.
Replacing existing casts with these macros.
2022-03-31 09:59:27 +02:00
Christian Heimes
581c4434de
bpo-47162: Add call trampoline to mitigate bad fpcasts on Emscripten (GH-32189)
2022-03-30 12:28:33 -07:00
Dong-hee Na
d0c67ea064
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
2022-03-30 18:31:33 +01:00
Pieter Eendebak
850687df47
bpo-47070: Add _PyBytes_Repeat() (GH-31999)
...
Use it where appropriate: the repeat functions of `array.array`, `bytes`, `bytearray`, and `str`.
2022-03-28 04:43:45 -04:00
Pieter Eendebak
c23ddf5ec2
bpo-47116: use _PyLong_FromUnsignedChar instead of PyLong_FromLong (GH-32110)
2022-03-26 15:47:38 -04:00
Mark Shannon
d7163bb35d
bpo-42197: Don't create f_locals
dictionary unless we actually need it. (GH-32055)
...
* `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing.
(Contributed by Fabio Zadrozny)
* Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`.
* Document new `PyFrame_GetLocals` C-API function.
2022-03-25 12:57:50 +00:00
Kumar Aditya
bd1cf6ecee
bpo-47012: speed up iteration of bytes and bytearray (GH-31867)
2022-03-23 04:30:05 -04:00
Mark Shannon
49daf6dba8
bpo-47045: Remove f_state
field (GH-31963)
...
* Remove the f_state field from _PyInterpreterFrame
* Make ownership of the frame explicit, replacing the is_generator field with an owner field.
2022-03-22 12:57:19 +00:00
Jeremy Kloth
88872a29f1
bpo-47084: Clear Unicode cached representations on finalization (GH-32032)
2022-03-22 13:53:51 +01:00
penguin_wwy
1ea055bd53
bpo-47067: Optimize calling GenericAlias objects (GH-31996)
...
Use vectorcall, and replace `PyObject_SetAttrString` with `PyObject_SetAttr` and a global string.
2022-03-21 16:33:02 -04:00
Brandt Bucher
2bde6827ea
bpo-46841: Quicken code in-place (GH-31888)
...
* Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place.
* Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches
* _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms.
* _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches
* _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup
* _Py_Quicken is renamed to _PyCode_Quicken
* _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview).
* Do not emit unused nonzero opargs anymore in the compiler.
2022-03-21 11:11:17 +00:00
Victor Stinner
2217462bda
bpo-45786: Remove _PyFrame_Fini() and _PyFrame_DebugMallocStats() (GH-31874)
...
Remove private empty _PyFrame_Fini() and _PyFrame_DebugMallocStats()
functions.
2022-03-18 11:16:55 +01:00
Pieter Eendebak
ac8308d3ea
bpo-47005: Improve performance of bytearray_repeat and bytearray_irepeat (GH-31856)
2022-03-17 19:10:36 -04:00
Mark Shannon
49e1e1e1bd
bpo-46841: Don't scan backwards in bytecode (GH-31901)
2022-03-15 17:08:37 -07:00
Kumar Aditya
6dfe09fc5f
bpo-46993: Speed up bytearray creation from list and tuple (GH-31834)
2022-03-15 15:27:30 +02:00
Irit Katriel
e3d348a525
bpo-43721: Fix docstrings for property.getter/setter/deleter (GH-31046)
2022-03-14 23:28:54 +00:00
Oleg Iarygin
a52f82baf2
bpo-46920: Remove disabled debug code added decades ago and likely unnecessary (GH-31812)
2022-03-14 17:03:21 +01:00
Oleg Iarygin
e885ac3d5f
bpo-46920: Remove code that has no explainer why it was disabled (GH-31814)
2022-03-14 17:02:32 +01:00