summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] GH-105162: Account for `INSTRUMENTED_RESUME` in gen.close/throw. ↵Miss Islington (bot)2023-06-061-3/+15
| | | | | | | | (GH-105187) (#105378) GH-105162: Account for `INSTRUMENTED_RESUME` in gen.close/throw. (GH-105187) (cherry picked from commit 601ae09f0c8eda213b9050892f5ce9b91f0aa522) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] gh-98963: Restore the ability to have a dict-less property. ↵Miss Islington (bot)2023-06-051-8/+37
| | | | | | | | | | | | | | | (GH-105262) (#105297) gh-98963: Restore the ability to have a dict-less property. (GH-105262) Ignore doc string assignment failures in `property` as has been the behavior of all past Python releases. (the docstring is discarded) (cherry picked from commit 418befd75d4d0d1cba83d8b81e1a7bcc9a65be8e) This fixes a behavior regression in 3.12beta1 where an AttributeError was being raised in a situation it has never been in the past. It keeps the existing unusual single situation where AttributeError does get raised. Existing widely deployed projects depend on this not raising an exception. Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.12] gh-104614: Make Sure ob_type is Always Set Correctly by ↵Miss Islington (bot)2023-06-011-16/+44
| | | | | | | | | | PyType_Ready() (gh-105122) (gh-105211) When I added the relevant condition to type_ready_set_bases() in gh-103912, I had missed that the function also sets tp_base and ob_type (if necessary). That led to problems for third-party static types. We fix that here, by making those extra operations distinct and by adjusting the condition to be more specific. (cherry picked from commit 1469393) Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
* [3.12] gh-105020: Share tp_bases and tp_mro Between Interpreters For All ↵Miss Islington (bot)2023-06-011-30/+46
| | | | | | | | Static Builtin Types (gh-105115) (gh-105124) In gh-103912 we added tp_bases and tp_mro to each PyInterpreterState.types.builtins entry. However, doing so ignored the fact that both PyTypeObject fields are public API, and not documented as internal (as opposed to tp_subclasses). We address that here by reverting back to shared objects, making them immortal in the process. (cherry picked from commit 7be667d) Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
* [3.12] gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* ↵Irit Katriel2023-05-301-0/+39
| | | | | implementation in the unstable API (GH-105072) (#105095) (cherry picked from commit b7aadb4583b040ddc8564896b91f4e5e571c82d6)
* Fix compiler warning in unicodeobject.c (GH-105050)Miss Islington (bot)2023-05-291-1/+1
| | | | | | Fix compiler warning in unicodeobject.c (GH-105050) (cherry picked from commit e92ac0a741b125f1cffe8c07b054d1dea7b0a05a) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* [3.12] gh-103921: Document PEP 695 (GH-104642) (#104989)Miss Islington (bot)2023-05-261-50/+65
| | | | | | (cherry picked from commit 060277d96bf4ba86df8e4d65831a8cbdfeb51fc5) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-104955: Fix __release_buffer__ signature (GH-104956) (#104973)Miss Islington (bot)2023-05-261-1/+1
| | | | | | (cherry picked from commit 6e1eccdcce5ea3bf1ef9d326d20ef9df21262c6b) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.12] gh-104879: Fix TypeAliasType.__module__ in exec() (GH-104881) (#104890)Miss Islington (bot)2023-05-241-2/+7
| | | | | (cherry picked from commit fe77a99fc8b549a8bf9ccbc5485fe5ea9bcf47b9) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-98836: Extend PyUnicode_FromFormat() (GH-98838)Serhiy Storchaka2023-05-211-108/+218
| | | | | | | | | * Support for conversion specifiers o (octal) and X (uppercase hexadecimal). * Support for length modifiers j (intmax_t) and t (ptrdiff_t). * Length modifiers are now applied to all integer conversions. * Support for wchar_t C strings (%ls and %lV). * Support for variable width and precision (*). * Support for flag - (left alignment).
* GH-101291: Add low level, unstable API for pylong (GH-101685)Mark Shannon2023-05-211-0/+14
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-104717: Add comment about manual loop unrolling (gh-104718)Dong-hee Na2023-05-211-0/+1
|
* gh-104600: Make type.__type_params__ writable (#104634)Jelle Zijlstra2023-05-191-13/+29
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104600: Make function.__type_params__ writable (#104601)Jelle Zijlstra2023-05-181-1/+16
|
* gh-104549: Set __module__ on TypeAliasType (#104550)Jelle Zijlstra2023-05-183-31/+62
|
* typing: Add more tests for TypeVar (#104571)Jelle Zijlstra2023-05-171-1/+1
| | | | | | | | During the PEP 695 implementation at one point I made TypeVar.__name__ return garbage, and all of test_typing passed. So I decided to add a few more tests. In the process I discovered a minor incompatibility from the C implementation of TypeVar: empty constraints were returned as None instead of an empty tuple.
* GH-103906: Remove immortal refcounting in the interpreter (GH-103909)Brandt Bucher2023-05-161-7/+1
|
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-166-4/+2490
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104454: Fix refleak in AttributeError_reduce (#104455)Charles Machalow2023-05-131-1/+3
| | | | | * Fix the reference leak introduced by https://github.com/python/cpython/issues/103333 Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* GH-94841: Fix usage of Py_ALWAYS_INLINE (GH-104409)Brandt Bucher2023-05-121-1/+1
|
* gh-103333: Pickle the keyword attributes of AttributeError (#103352)Charles Machalow2023-05-121-1/+43
| | | | | | * Pickle the `name` and `args` attributes of AttributeError when present. Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* GH-104371: check return value of calling `mv.release` (#104417)Kumar Aditya2023-05-121-1/+7
|
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-3/+0
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* Fix refleak in `super_descr_get` (#104408)Brandt Bucher2023-05-121-1/+3
|
* gh-104371: Fix calls to `__release_buffer__` while an exception is active ↵Jelle Zijlstra2023-05-121-2/+12
| | | | | (#104378) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)Carl Meyer2023-05-111-12/+0
|
* GH-102181: Improve specialization stats for SEND (GH-102182)penguin_wwy2023-05-101-3/+0
|
* gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)Sebastian Berg2023-05-101-12/+1
| | | | | | | | | | This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of using the standard `NAN` and `INFINITY` macros provided by C99. This change has the side-effect of fixing a bug on MIPS where the hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN rather than a quiet NaN. --------- Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)Eric Snow2023-05-101-11/+21
| | | This was missed in gh-19474. It matters for with a per-interpreter GIL since PyDictKeysObject.dk_refcnt breaks isolation and leads to races.
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-091-0/+4
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-104223: Fix issues with inheriting from buffer classes (#104227)Jelle Zijlstra2023-05-083-12/+161
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-104018: remove unused format "z" handling in string formatfloat() (#104107)John Belmonte2023-05-072-5/+0
| | | This is a cleanup overlooked in PR #104033.
* gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)Eric Snow2023-05-061-1/+7
| | | Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.
* gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)Eric Snow2023-05-052-1/+8
| | | Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
* gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)Eric Snow2023-05-051-0/+30
| | | I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-052-2/+3
| | | | for users of PEP 523. (GH-96849)
* GH-103899: Provide a hint when accidentally calling a module (GH-103900)Brandt Bucher2023-05-041-6/+38
|
* gh-102500: Implement PEP 688 (#102521)Jelle Zijlstra2023-05-044-9/+292
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-104066: Improve performance of hasattr for module objects (#104063)Itamar Ostricher2023-05-042-29/+73
|
* gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)Petr Viktorin2023-05-042-3/+110
| | | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-103968: Deprecate creating heap types whose metaclass has custom tp_new. ↵Petr Viktorin2023-05-031-9/+29
| | | | | | | | (GH-103972) (That's a mouthful of an edge case!) Co-authored-by: Barney Gale <barney.gale@gmail.com>
* gh-104078: Improve performance of PyObject_HasAttrString (#104079)Itamar Ostricher2023-05-031-6/+17
|
* gh-82012: Deprecate bitwise inversion (~) of bool (#103487)Tim Hoffmann2023-05-031-1/+17
| | | | | | | | | | | | | | The bitwise inversion operator on bool returns the bitwise inversion of the underlying int value; i.e. `~True == -2` such that `bool(~True) == True`. It's a common pitfall that users mistake `~` as negation operator and actually want `not`. Supporting `~` is an artifact of bool inheriting from int. Since there is no real use-case for the current behavior, let's deprecate `~` on bool and later raise an error. This removes a potential source errors for users. Full reasoning: https://github.com/python/cpython/issues/82012#issuecomment-1258705971 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)Eric Snow2023-05-032-58/+174
| | | | | his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses. Those three fields are effectively const for builtin static types (unlike tp_subclasses). In theory we only need to make their values immortal, along with their contents. However, that isn't such a simple proposition. (See gh-103823.) In the meantime the simplest solution is to move the fields into the interpreter. One alternative is to statically allocate the values, but that's its own can of worms.
* gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)Eric Snow2023-05-022-234/+333
| | | This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
* gh-94673: Properly Initialize and Finalize Static Builtin Types for Each ↵Eric Snow2023-05-028-91/+103
| | | | | Interpreter (gh-104072) Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
* gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (gh-104054)Eric Snow2023-05-014-48/+63
| | | This also does some cleanup.
* gh-104018: disallow "z" format specifier in %-format of byte strings (GH-104033)John Belmonte2023-05-011-1/+0
| | | | | | | | | | | PEP-0682 specified that %-formatting would not support the "z" specifier, but it was unintentionally allowed for bytes. This PR makes use of the "z" flag an error for %-formatting in a bytestring. Issue: #104018 --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-102213: Optimize the performance of `__getattr__` (GH-103761)sunmy20192023-05-011-7/+13
| | | | | Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Xiang Wang <34048878+wangxiang-hz@users.noreply.github.com>
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-301-12/+8
|