Ken Jin
6c7249f265
gh-92154: Expose PyCode_GetCode in the C API (GH-92168)
2022-05-03 21:13:13 +08:00
larryhastings
c96da83a8e
Fix the closure argument to PyEval_EvalCodeEx. (GH-92175)
2022-05-02 14:08:22 -06:00
Jelle Zijlstra
ff88f7e007
gh-87390: Add __unpacked__ attribute to types.GenericAlias ( #92059 )
2022-05-02 13:21:59 -06:00
Mark Dickinson
0ed91a26fe
gh-90213: Speed up right shifts of negative integers (GH-30277)
2022-05-02 11:19:03 -06:00
Serhiy Storchaka
18b07d773e
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.
2022-05-02 12:37:48 +03:00
Serhiy Storchaka
4d10f703d7
gh-92114: Improve error message for types with __class_getitem__ = None (GH-92115)
2022-05-02 08:29:49 +03:00
Serhiy Storchaka
3483299a24
gh-81548: Deprecate octal escape sequences with value larger than 0o377 (GH-91668)
2022-04-30 13:16:27 +03:00
Serhiy Storchaka
e8c2f72b94
bpo-43224: Implement substitution of unpacked TypeVarTuple in C (GH-31828)
...
Co-authored-by: Matthew Rahtz <mrahtz@gmail.com>
2022-04-30 08:22:46 +03:00
Yurii Karabas
0ef8d921f5
gh-91603: Speed up isinstance/issubclass on union types (GH-91631)
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-04-28 23:24:19 +08:00
Serhiy Storchaka
cd1fbbc817
gh-91603: Speed up operator "|" for UnionType (GH-91955)
...
Reduce the complexity from O((M+N)^2) to O(M*N), where M and N are the length
of __args__ for both operands (1 for operand which is not a UnionType).
As a consequence, the complexity of parameter substitution in UnionType has
been reduced from O(N^3) to O(N^2).
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2022-04-28 13:25:33 +03:00
Victor Stinner
64a54e511d
gh-91719: Add pycore_opcode.h internal header file ( #91906 )
...
Move the following API from Include/opcode.h (public C API) to a new
Include/internal/pycore_opcode.h header file (internal C API):
* EXTRA_CASES
* _PyOpcode_Caches
* _PyOpcode_Deopt
* _PyOpcode_Jump
* _PyOpcode_OpName
* _PyOpcode_RelativeJump
2022-04-26 00:14:30 +02:00
Victor Stinner
364ed94092
gh-89373: _Py_Dealloc() checks tp_dealloc exception ( #32357 )
...
If Python is built in debug mode, _Py_Dealloc() now ensures that the
tp_dealloc function leaves the current exception unchanged.
2022-04-21 23:04:01 +02:00
Mark Shannon
d44815cabc
GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangerous. (GH-91790)
2022-04-21 19:08:36 +01:00
Mark Shannon
944fffee89
GH-88116: Use a compact format to represent end line and column offsets. (GH-91666)
...
* Stores all location info in linetable to conform to PEP 626.
* Remove column table from code objects.
* Remove end-line table from code objects.
* Document new location table format
2022-04-21 16:10:37 +01:00
Dennis Sweeney
f2b4e458b3
gh-91636: Don't clear required fields of function objects (GH-91651)
2022-04-21 02:06:35 -04:00
Victor Stinner
7cdaf87ec5
gh-91731: Replace Py_BUILD_ASSERT() with static_assert() ( #91730 )
...
Python 3.11 now uses C11 standard which adds static_assert()
to <assert.h>.
* In pytime.c, replace Py_BUILD_ASSERT() with preprocessor checks on
SIZEOF_TIME_T with #error.
* On macOS, py_mach_timebase_info() now accepts timebase members with
the same size than _PyTime_t.
* py_get_monotonic_clock() now saturates GetTickCount64() to
_PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is
signed.
2022-04-20 19:26:40 +02:00
Dennis Sweeney
d7d7e6c007
Cast to (destructor) to fix compiler warnings (GH-91711)
2022-04-20 16:15:45 +01:00
Dong-hee Na
f571c26fc1
gh-91632: Fix generic_alias_iterator to be finalized at exit. (GH-91727)
2022-04-20 23:10:41 +09:00
Inada Naoki
4d2403fd50
gh-91020: Add `PyBytes_Type.tp_alloc` for subclass (GH-91686)
2022-04-20 14:06:29 +09:00
Dennis Sweeney
da6c78584b
gh-90667: Add specializations of Py_DECREF when types are known (GH-30872)
2022-04-19 19:02:19 +01:00
Kumar Aditya
ab0d35d70d
bpo-46712: share more global strings in deepfreeze (gh-32152)
...
(for gh-90868)
2022-04-19 11:41:36 -06:00
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