Commit Graph

49137 Commits

Author SHA1 Message Date
Gregory P. Smith e61ca22431
gh-95865: Further reduce quote_from_bytes memory consumption (#96860)
on large input values.  Based on Dennis Sweeney's chunking idea.
2022-09-19 16:06:25 -07:00
Brandt Bucher c10e33ac11
GH-96864: Check for error between line and opcode events (GH-96880) 2022-09-19 14:02:24 -07:00
Terry Jan Reedy aa671b48d6
gh-87179: Fix more IDLE class headers (#96899)
Remove unneeded '(object)' and '()'.
2022-09-17 17:53:23 -04:00
Guido van Rossum 487135a396
Revert "gh-87079: Warn on unintended signal wakeup fd override in `asyncio` (#96807)" (#96898)
This reverts commit 0587810698.
Reason: This broke buildbots (some warnings added by that commit are turned to errors in the SSL buildbot).
Repro:  ./python Lib/test/ssltests.py
2022-09-17 14:12:45 -07:00
Lysandros Nikolaou 7e36abbb78
gh-91210: Improve error message when non-default param follows default (GH-95933)
- Improve error message when parameter without a default follows one with a default
- Show same error message when positional-only params precede the default/non-default sequence
2022-09-17 10:09:28 -07:00
Michel Hidalgo 0587810698
gh-87079: Warn on unintended signal wakeup fd override in `asyncio` (#96807)
Warn on loop initialization, when setting the wakeup fd disturbs a previously set wakeup fd, and on loop closing, when upon resetting the wakeup fd, we find it has been changed by someone else.
2022-09-17 08:07:54 -07:00
Vinay Sajip 2cd70ffb3f
gh-96861: Check for unset sys.executable during venv creation. (GH-96887) 2022-09-17 12:58:31 +01:00
Serhiy Storchaka 426d72e7dd
gh-96052: codeop: fix handling compiler warnings in incomplete input (GH-96132)
Previously codeop.compile_command() emitted compiler warnings (SyntaxWarning or
DeprecationWarning) and raised a SyntaxError for incomplete input containing
a potentially incorrect code. Now it always returns None for incomplete input
without emitting any warnings.
2022-09-16 17:37:30 +03:00
Dennis Sweeney 303bd88047
Fix ResourceWarning in test.test_frame (GH-96831) 2022-09-15 18:31:45 +01:00
adphrost a41ed975e8
GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)
Co-authored-by: Andrew Frost <adfrost@fb.com>
Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
2022-09-15 16:42:37 +01:00
Nikita Sobolev e37ac5fbb6
gh-96751: Remove dead code from `CALL_FUNCTION_EX` opcode (GH-96752) 2022-09-15 10:33:13 +01:00
Ruan Comelli 8e9a37dde4
Fix type annotation of `pstats.FunctionProfile.ncalls` (#96741)
* fix: annotate `pstats.FunctionProfile.ncalls` as `str`

This change aligns the type annotation of `pstats.FunctionProfile.ncalls` with its runtime type.
2022-09-14 18:33:43 -07:00
Yusuke Kadowaki 92338f8f19
gh-77171 Support WAVE_FORMAT_EXTENSIBLE in the wave module (GH-96777)
The test file, a modified version of Lib/test/audiodata/pluck-pcm24.wav, was provided by Andrea Celletti on the bug tracker.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-09-14 14:34:40 +01:00
Nikita Sobolev f2d749a2c2
gh-96784: Cover more typing special forms in `get_args()` (#96791) 2022-09-13 19:35:52 -07:00
Nikita Sobolev 9b3d2d008a
gh-96769: Cover more typing special forms to be unsubclassable (#96772) 2022-09-13 19:35:16 -07:00
Benjamin Peterson fd1e477f53
closes gh-96734: Update to Unicode 15.0.0. (GH-96809) 2022-09-13 15:45:12 -07:00
Dennis Sweeney 69d9a08099
gh-94808: improve comments and coverage of fastsearch.h (GH-96760) 2022-09-13 14:25:10 -04:00
Irit Katriel 6d7a0e0dd7
gh-87092: reduce redundancy and repetition in compiler's optimization stage (GH-96713) 2022-09-13 13:03:41 +01:00
Christian Heimes 1fc8bd3710
gh-95853: Multiple ops and debug for wasm_build.py (#96744) 2022-09-11 09:51:23 +02:00
Dong-hee Na 8d75a13fde
gh-90751: memoryview now supports half-float (#96738)
Co-authored-by: Antoine Pitrou <antoine@python.org>
2022-09-10 22:44:10 +02:00
Hendrik Makait 6281affee6
gh-94972: document that shield users need to keep a reference to their task (#96724)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2022-09-10 07:34:14 -07:00
Gregory P. Smith 11e3548fd1
gh-96710: Make the test timing more lenient for the int/str DoS regression test. (#96717)
A regression would still absolutely fail and even a flaky pass isn't
harmful as it'd fail most of the time across our N system test runs.

Windows has a low resolution timer and CI systems are prone to odd
timing so this just gives more leeway to avoid flakiness.
2022-09-09 12:51:34 -07:00
Dennis Sweeney 569ca27293
gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py (GH-96691)
* Update test_dotted_but_module_not_loaded to reflect the move of unittest.test to test.test_unittest.
2022-09-08 23:46:13 -04:00
Guido van Rossum df50938f58
GH-46412: More efficient bool() for ndbm/_gdbmmodule (#96692) 2022-09-08 19:32:40 -07:00
Steve Dower 95d6330a3e
gh-96684: Silently suppress COM security errors in _wmi module (GH-96690) 2022-09-08 22:02:04 +01:00
Zachary Ware 9c8f379433
gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689)
Automerge-Triggered-By: GH:zware
2022-09-08 11:52:07 -07:00
finefoot c06c001b30
gh-92734: Add indentation feature to reprlib.Repr (GH-92735) 2022-09-08 13:51:44 -05:00
Mark Shannon aa3b4cf779
GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-09-08 17:16:48 +01:00
philg314 b9634ac776
gh-96352: Set AttributeError context in _PyObject_GenericGetAttrWithDict (#96353) 2022-09-08 12:12:14 +01:00
Michael Droettboom 8bc356a7dd
gh-96268: Fix loading invalid UTF-8 (#96270)
This makes tokenizer.c:valid_utf8 match stringlib/codecs.h:decode_utf8.

It also fixes an off-by-one error introduced in 3.10 for the line number when the tokenizer reports bad UTF8.
2022-09-07 14:23:54 -07:00
Steve Dower de33df27aa
gh-89545: Updates platform module to use new internal _wmi module on Windows to directly query OS properties (GH-96289) 2022-09-07 21:09:20 +01:00
Raymond Hettinger 3eaf70d836
GH-96465: Cache hashes for Fraction instances (GH-96483) 2022-09-07 10:31:50 -05:00
Michael Droettboom dde15f5879
gh-94808: Improve coverage of _PyBytes_FormatEx (GH-95895)
There were two specific areas not covered:

- %(name) syntax
- %*s syntax

Automerge-Triggered-By: GH:iritkatriel
2022-09-07 04:51:50 -07:00
Dennis Sweeney 56d9cf7fc8
gh-96538: Fix refleak in _bisectmodule.c (gh-96619) 2022-09-06 19:37:18 -04:00
Irit Katriel 147eb723b2
gh-96628: remove deprecated and ignored arg of sysconfig.is_python_build() (GH-96629) 2022-09-07 00:24:34 +01:00
Michael Droettboom 05692c67c5
gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (#96623) 2022-09-07 00:12:16 +01:00
Mark Shannon 95e271b226
GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613) 2022-09-06 17:37:47 +01:00
Jelle Zijlstra f0d9136c69
gh-96478: Fix new test when run in refleak mode (#96615)
./python.exe -m test -R : test.test_typing would fail, apparently
because the dictionary used in the @patch decorator was modified.
2022-09-06 09:33:09 -07:00
Nikita Sobolev f177f6f29b
gh-96478: Test `@overload` on C functions (#96479)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-09-05 14:35:05 -07:00
Jonathon Reinhart 30878a7735
argparse: Remove unused name variable when handling ArgumentTypeError (#96549)
This removes the unused `name` variable in the block where `ArgumentTypeError` is handled.

`ArgumentTypeError` errors are handled by showing just the string of the exception; unlike `ValueError`, the name (`__name__`) of the function is not included in the error message.

Fixes #96548
2022-09-05 14:32:23 -07:00
Jason R. Coombs 52fe7e50c9
gh-93963: Remove ResourceReaderDefaultsTests (GH-96598)
Automerge-Triggered-By: GH:jaraco
2022-09-05 12:37:51 -07:00
Steve Dower 80a9bd2e94
gh-96559: Fixes Windows launcher handling of defaults using old-style tags, and adds What's New section (GH-96595) 2022-09-05 20:06:30 +01:00
Shantanu 200c9a8da0
gh-92986: Fix ast.unparse when ImportFrom.level is None (#92992)
This doesn't happen naturally, but is allowed by the ASDL and compiler.
We don't want to change ASDL for backward compatibility reasons
(#57645, #92987)
2022-09-05 20:14:50 +03:00
Nikita Sobolev 2c7d2e8d46
gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` (#96588) 2022-09-05 17:54:09 +01:00
Pamela Fox a0ad63e70e
gh-93973: Add all_errors to asyncio.create_connection (#93974)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2022-09-04 18:33:50 -07:00
Mark Dickinson b126196838
gh-95778: Correctly pre-check for int-to-str conversion (#96537)
Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =)

The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact.

The justification for the current check. The C code check is:
```c
max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10
```

In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is:
$$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$

From this it follows that
$$\frac{M}{3L} < \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$
So
$$2^{L(s-1)} > 10^M.$$
But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check.

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2022-09-04 09:21:18 -07:00
Sergey B Kirpichev 8464b754c4
gh-68163: Correct conversion of Rational instances to float (GH-25619)
* gh-68163: Correct conversion of Rational instances to float

Also document that numerator/denominator properties are instances of Integral.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-04 13:15:59 +01:00
Charlie Zhao 9b9394df5f
gh-93884: Improve test coverage of `PyNumber_ToBase` (GH-93932)
Link to #93884 
* Test with some large negative and positive values(out of range of a longlong,i.e.[-2\*\*63, 2\*\*63-1])
* Test with objects of non-int type

Automerge-Triggered-By: GH:mdickinson
2022-09-04 03:37:04 -07:00
Vinay Sajip ac4ddab405
gh-90195: Unset logger disabled flag when configuring it. (GH-96530) 2022-09-03 13:38:38 +01:00
Terry Jan Reedy 837ce6460d
gh-75500: Update idlelib/help.html (#96523) 2022-09-03 03:38:57 -04:00