Commit Graph

118390 Commits

Author SHA1 Message Date
Tomas R 62a3a15119
gh-107455: ctypes: Improve error messages when converting to an incompatible type (#107456) 2023-08-03 10:59:03 +05:30
Erlend E. Aasland 1cd479c6d3
gh-104683: Rework Argument Clinic error handling (#107551)
Introduce ClinicError, and use it in fail(). The CLI runs main(),
catches ClinicError, formats the error message, prints to stderr
and exits with an error.

As a side effect, this refactor greatly improves the accuracy of
reported line numbers in case of error.

Also, adapt the test suite to work with ClinicError.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-03 00:00:06 +00:00
Eric Snow 017f047183
gh-107471: Fix Refleaks in test_import (gh-107569)
gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat).  We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module.

The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests.

(This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.)
2023-08-02 20:55:09 +00:00
Erlend E. Aasland bcdd307231
gh-104683: Make Argument Clinic template strings class level members (#107556)
The motivation for this change is to clean up the output_templates()
method a little bit, as it accounts for ~10% of the lines of code in
clinic.py; removing some clutter helps readability.
2023-08-02 21:37:36 +02:00
Guido van Rossum af8141cf87
Fix test_capi.test_misc when run with -R:: (#107566)
Should fix the buildbot failures.

This creates a new function each time that test is run, like Victor did for other tests.
2023-08-02 12:05:25 -07:00
Mark Shannon 0d30a5a409
GH-100964: Break cycles involving exception state when returning from generator (GH-107563) 2023-08-02 18:44:20 +01:00
Irit Katriel dd693d6320
gh-105481: simplify definition of pseudo ops in Lib/opcode.py (#107561) 2023-08-02 18:16:57 +01:00
Erlend E. Aasland b9c9a36c2f
gh-106368: Increase test coverage for Argument Clinic (#107514)
As per this commit, we've got approx. ~91% test coverage for clinic.py.
2023-08-02 13:33:10 +00:00
Erlend E. Aasland 9ff7b4af13
gh-107559: Argument Clinic: complain about non-ASCII chars in param docstrings (#107560)
Previously, only function docstrings were checked for non-ASCII characters.
Also, improve the warn() message.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-02 12:40:23 +00:00
Erlend E. Aasland 439466a02b
gh-104146: Remove dead code from Argument Clinic (#107555) 2023-08-02 09:22:17 +00:00
Erlend E. Aasland b4d8897781
gh-104683: Argument Clinic: Refactor and simplify 'add docstring' states (#107550)
Introduce docstring_append() helper, and use it for both parameter and
function docstrings. Remove docstring fixup from
do_post_block_processing_cleanup(); instead, make sure no fixup is needed.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-01 23:32:27 +00:00
Alex Waygood 818c83cf81
gh-104683: Argument clinic: cleanup `DLSParser` `state_foo` methods (#107543) 2023-08-01 21:42:39 +01:00
Alexandru Mărășteanu c8872f4285
Clarify `Self` interaction with subclasses (#107511) 2023-08-01 13:20:25 -07:00
Alex Waygood 030f6b1e84
gh-104683: Argument clinic: remove the `LandMine` class (#107541) 2023-08-01 21:10:54 +01:00
Irit Katriel 2bd04d4234
gh-105481: combine regen-opcode-targets with regen-opcode to avoid calculating the specialized opcodes in two places (#107540) 2023-08-01 21:05:48 +01:00
Irit Katriel 6ef8f8ca88
gh-105481: the ENABLE_SPECIALIZATION flag does not need to be generated by the build script, or exposed in opcode.py (#107534) 2023-08-01 17:05:00 +00:00
Erlend E. Aasland 49f238e78c
gh-107467: Restructure Argument Clinic command-line interface (#107469)
- Use ArgumentParser.error() to handle CLI errors
- Put the entire CLI in main()
- Rework ClinicExternalTest to call main() instead of using subprocesses

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-08-01 18:24:23 +02:00
Anders Kaseorg 557b05c7a5
gh-106092: Fix use-after-free crash in frame_dealloc (#106875)
It was possible for the trashcan to delay the deallocation of a
PyFrameObject until after its corresponding _PyInterpreterFrame has
already been freed.  So frame_dealloc needs to avoid dereferencing the
f_frame pointer unless it first checks that the pointer still points
to the interpreter frame within the frame object.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-08-01 10:32:18 +01:00
Hugo van Kemenade 052a0d1106
Remove newlines from bug template (#107525) 2023-08-01 01:47:24 -06:00
Pieter Eendebak f7c9144c2c
gh-89013: Improve the performance of methodcaller (lazy version) (gh-107201) 2023-08-01 15:45:51 +09:00
Eric Snow 79e479c45f
gh-99113: Add a What's New Entry for PEP 684 (gh-107520) 2023-07-31 23:13:55 +00:00
Eric Snow db361a340a
gh-105766: Document that Custom Allocators Must Be Thread-Safe (gh-107519) 2023-07-31 23:11:15 +00:00
Eric Snow fb344e99aa
gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (#107403)
It was added in 3.12 for PEP 684 (per-interpreter GIL).
2023-07-31 17:03:01 -06:00
Erlend E. Aasland abb71c6a8f
gh-107507: Replace 'The goals of Argument Clinic' with a summary (#107508)
Summarise the goals of Argument Clinic in a single sentence.
Mention that Argument Clinic was introduced with PEP-436.
2023-07-31 23:33:13 +02:00
Brandt Bucher dfb55d9d7f
Use tstate->interp to get the interpreter state in bytecodes.c (GH-107506) 2023-07-31 14:18:38 -07:00
Brandt Bucher 5e584eb704
GH-104584: Fix incorrect uoperands (GH-107513) 2023-07-31 21:16:57 +00:00
Jacob Walls de51dede5b
gh-106762: Add news for `EnumMeta.__getattr__` removal (GH-107466) 2023-07-31 10:24:44 -07:00
Guido van Rossum 5eb80a61f5
GH-104909: Move unused cache entries from uops to macros (#107444)
There's no need to use a dummy uop to skip unused cache entries. The macro syntax lets you write `unused/1` instead.

Similarly, move `unused/5` from op `_LOAD_ATTR_INSTANCE_VALUE` to macro `LOAD_ATTR_INSTANCE_VALUE`.
2023-07-31 08:55:33 -07:00
Michael The a22ff8e11c
gh-105578: Document that `AnyStr` is deprecated in py313 (#107116)
It will not be removed until Python 3.18.
2023-07-31 15:43:53 +00:00
Michael The f877b32b87
gh-105578: Add more usage examples to `typing.AnyStr` docs (#107045)
``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
2023-07-31 16:23:08 +01:00
opavliuk f22bf8e3cf
gh-87799: Improve the textual representation of IPv4-mapped IPv6 addresses (#29345)
Represent IPv4-mapped IPv6 address as xxxd.d.d.d,
where the 'x's are the hexadecimal values
of the six high-order 16-bit pieces of the address,
and the 'd's are the decimal values
of the four low-order 8-bit pieces of the address
(standard IPv4 representation).

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2023-07-31 14:33:26 +00:00
Tomas R 520efecfc3
gh-105751: Remove obsolete `object` base class in some ctypes tests (#107460) 2023-07-31 14:48:27 +02:00
Georg Brandl f57b9fd2b6
no-issue: Fix typo in import.c (gh-107498) 2023-07-31 12:07:17 +00:00
Erlend E. Aasland 2c5d206b33
gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (#107496) 2023-07-31 11:50:03 +00:00
Furkan Onder a1c737b73d
gh-104280: Add test cases for DTrace probes (#107125) 2023-07-31 10:33:37 +02:00
Konstantin 08447b5deb
gh-46376: Return existing pointer when possible in ctypes (#107131) 2023-07-31 09:10:53 +02:00
Ned Deily 68f94715bb
Update macOS installer screens to 3.13. (GH-107475) 2023-07-31 06:05:47 +00:00
Ned Deily 83e0976f89
gh-99079: Update macOS installer to use OpenSSL 3.0.9. (GH-107474) 2023-07-31 05:58:35 +00:00
Dong-hee Na a24e25d74b
gh-107427: Update the description of UNPACK_SEQUENCE (gh-107429) 2023-07-31 00:40:37 +09:00
Charlie Zhao 3979150a0d
gh-106263: Fix segfault in `signaldict_repr` in `_decimal` module (#106270)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-07-30 13:58:54 +05:30
Alex Waygood 5113ed7a2b
gh-104683: Argument clinic: pass `clinic` as a parameter where possible (#107435) 2023-07-29 19:47:42 +01:00
Alex Waygood 6c74b2f669
gh-104683: Argument clinic: Make the `filename` parameter to `Clinic` required (#107439) 2023-07-29 19:46:52 +01:00
Kumar Aditya 2e9ddb943c
add Kumar Aditya as CODEOWNER for import.c (#107441) 2023-07-29 18:26:24 +00:00
da-woods f2abeb590d
Fix the documentation for PyCode_New add `qualname` parameter (#107186) 2023-07-29 23:11:40 +05:30
Rakesh Sabale 89fd4f4a3f
gh-107422: Remove outdated `TypedDict` example from typing docs (#107436) 2023-07-29 17:04:46 +00:00
Alex Waygood d0dcd27d3a
Improve the GitHub issue templates (#107150)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-07-29 15:42:44 +01:00
Alex Waygood 87de2fbb1e
gh-104050: Argument clinic: enable mypy's `--warn-return-any` setting (#107405) 2023-07-29 13:39:21 +01:00
Inada Naoki 37551c9cef
gh-107369: optimize textwrap.indent() (#107374) 2023-07-29 06:37:23 +00:00
Serhiy Storchaka f2d07d3289
gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386) 2023-07-29 08:48:10 +03:00
Serhiy Storchaka 413ba8943e
gh-107091: Fix some uses of :func: role (GH-107378)
:c:func: or :c:macro: should be used instead.
2023-07-29 08:43:10 +03:00