Commit Graph

118127 Commits

Author SHA1 Message Date
Alex Waygood ee3bf45e5e
gh-106368: Improve coverage reports for argument clinic (#107693) 2023-08-06 20:40:55 +01:00
Adam Turner 9564e31cbc
Do not use deprecated ``logger.warn()`` in pyspecific (#107694) 2023-08-06 13:58:00 +00:00
Pieter Eendebak 3e334ae259
gh-85160: improve performance of `functools.singledispatchmethod` (#107148)
Co-authored-by: mental <m3nta1@yahoo.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-06 13:37:12 +01:00
Hugo van Kemenade 9641c4d8e2
Docs: skip python-docs-theme 2023.7 to fix mobile menu (#107666) 2023-08-06 13:08:32 +02:00
Erlend E. Aasland 71a7c96ffe
Docs: Fix Sphinx annotations in Doc/library/ctypes.rst (#107672)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-08-06 10:23:50 +02:00
cocoatomo ecb05e0b98
GH-84435: Make pyspecific directives translatable (#19470)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-08-05 23:10:50 -06:00
Alex Waygood 6996b406bc
gh-104683: Improve consistency and test coverage of argument-clinic `__repr__` functions (#107667) 2023-08-05 21:58:38 +01:00
Erlend E. Aasland 4a5b4221e3
Docs: Argument Clinic: Improve 'How to write a custom converter' (#107328)
- Omit unneccesary wording and sentences
- Don't mention implementation details (no digression, explanation)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-08-05 20:19:37 +00:00
Terry Jan Reedy 9ebc6ecbc3
gh-107662: Switch 'any' and 'anext' in functions.rst (#107663)
Order was reversed in index at top, not in body.
2023-08-05 14:38:20 +00:00
Kumar Aditya 41178e4199
GH-106684: raise `ResourceWarning` when `asyncio.StreamWriter` is not closed (#107650) 2023-08-05 17:48:15 +05:30
Daniele Procida 5e2746d6e2
gh-107432 Fix incorrect indentation in annotations HOWTO (#107445)
gh-107432 Fix incorrect indentation in annotations document

Body text in https://docs.python.org/3/howto/annotations.html was
indented throughout, and was being rendered in blockquote elements.
2023-08-05 14:28:28 +03:00
Guido van Rossum 85e5b1f5b8
gh-106812: Fix two tiny bugs in analysis.py (#107649)
This fixes two tiny defects in analysis.py that I didn't catch on time in #107564:

- `get_var_names` in `check_macro_consistency` should skip `UNUSED` names.
- Fix an occurrence of `is UNUSED` (should be `==`).
2023-08-05 04:50:36 +00:00
Ivin Lee 4e6fac7fcc
gh-106608: make uop trace variable length (#107531)
Executors are now more like tuples.
2023-08-04 21:10:46 -07:00
Brandt Bucher 05a824f294
GH-84436: Skip refcounting for known immortals (GH-107605) 2023-08-04 16:24:50 -07:00
Barney Gale ec0a0d2bd9
GH-70303: Emit FutureWarning when pathlib glob pattern ends with `**` (GH-105413)
In a future Python release, patterns with this ending will match both files
and directories. Users may add a trailing slash to remove the warning.
2023-08-04 23:12:12 +00:00
Alex Waygood 2c25bd82f4
gh-106368: Argument clinic: improve coverage for `self.valid_line()` calls (#107641) 2023-08-04 20:41:04 +01:00
Hugo van Kemenade 904b5319b3
Docs: Only include Plausible for html, not for epub etc (#107637)
Only include Plausible for html, not for epub etc
2023-08-04 21:33:34 +03:00
Erlend E. Aasland 321f0f7932
gh-104683: Argument Clinic: Use CConverter.length_name where possible (#107638)
Also make it a cached property.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-04 17:49:07 +00:00
Guido van Rossum 400835ea16
gh-106812: Refactor cases_generator to allow uops with array stack effects (#107564)
Introducing a new file, stacking.py, that takes over several responsibilities related to symbolic evaluation of push/pop operations, with more generality.
2023-08-04 09:35:56 -07:00
Alex Waygood 407d7fda94
gh-104146: Argument clinic: remove dead code highlighted by the `vulture` tool (#107632) 2023-08-04 14:56:50 +00:00
Tomas R 09a8cc7984
gh-107600: Docs: Update ctypes.ArgumentError error message (#107601) 2023-08-04 16:34:04 +02:00
Hugo van Kemenade 19f32b24b2
Docs: upgrade to python-docs-theme 2023.7 (#107617) 2023-08-04 14:16:10 +00:00
Alex Waygood 7eba274fb3
gh-104146: Argument clinic: Remove dead code flagged by mypy's `truthy-bool` check (#107627) 2023-08-04 13:28:13 +00:00
Erlend E. Aasland ac7605ed19
gh-107614: Normalise Argument Clinic error messages (#107615)
- always wrap the offending line, token, or name in quotes
- in most cases, put the entire error message on one line

Added tests for uncovered branches that were touched by this PR.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-04 12:13:10 +00:00
Mark Shannon 2ba7c7f7b1
Add some GC stats to Py_STATS (GH-107581) 2023-08-04 10:34:23 +01:00
Mark Shannon fa45958450
GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535)
* Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
2023-08-04 10:10:29 +01:00
Erlend E. Aasland 0bd784b355
gh-106368: Increase Argument Clinic test coverage (#107611)
Add tests for directives and destinations
2023-08-04 07:48:32 +00:00
Erlend E. Aasland a443c310ac
gh-107609: Fix duplicate module check in Argument Clinic (#107610)
Also remove duplicate module def from _testcapi.
2023-08-04 07:28:25 +02:00
Brandt Bucher e52e87c349
GH-105481: Mark more files as generated (GH-107598) 2023-08-03 21:37:23 -07:00
Alex Waygood ee78d01a61
gh-104146: Argument clinic: remove unused methods and variables (#107608) 2023-08-04 00:17:17 +00:00
Alex Waygood 9e6590b097
gh-106368: Argument clinic tests: improve error message when `expect_success()` fails (#107606) 2023-08-03 21:26:14 +00:00
Eric Snow 58ef741867
gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)
The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter.
2023-08-03 19:51:08 +00:00
Tian Gao 14fbd4e6b1
gh-107446: Fix test_inspect.test_class_with_method_from_other_module when ran multiple times (#107451)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2023-08-03 15:04:03 +00:00
James Hilton-Balfe ed4a978449
gh-107576: Ensure `__orig_bases__` are our own in `get_original_bases` (#107584)
Co-authored-by: Chris Bouchard <chris@upliftinglemma.net>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-03 14:19:24 +00:00
Pablo Galindo Salgado 77e09192b5
gh-107077: Raise SSLCertVerificationError even if the error is set via SSL_ERROR_SYSCALL (#107586)
Co-authored-by: T. Wouters <thomas@python.org>
2023-08-03 12:37:14 +00:00
Erlend E. Aasland a73daf54eb
gh-106368: Increase Argument Clinic test coverage (#107582)
Add tests for DSL parser state machine and docstring formatting
2023-08-03 09:35:26 +00:00
Kumar Aditya 46366ca048
GH-107458: fix test_tools refleak (#107577) 2023-08-03 06:36:02 +00:00
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