Commit Graph

48872 Commits

Author SHA1 Message Date
Kumar Aditya 86c1df1872
bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) 2022-07-11 13:32:11 +01:00
Kumar Aditya f5b76330cf
GH-94736: Fix _multiprocessing.SemLock subclassing (#94738)
* fix allocator and deallocator

* 📜🤖 Added by blurb_it.

* code review

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-07-11 13:12:36 +01:00
John Belmonte 1fdc35ef51
gh-93883: Fix some tests involving traceback formatting (#94737)
PR #93994 was merged without being rebased in a few weeks, and
some new test code using the old scheme passed through automatic merge.
2022-07-11 10:22:41 +01:00
Simon-Martin Schröder 46fc584b00
gh-87822: Make traceback module robust to exceptions from repr() of local values (GH-94691) 2022-07-11 10:14:15 +01:00
John Belmonte da717519ec
gh-93883: elide traceback indicators when possible (#93994)
* gh-93883: elide traceback indicators when possible

Elide traceback column indicators when the entire line of the
frame is implicated.  This reduces traceback length and draws
even more attention to the remaining (very relevant) indicators.

Example:
```
Traceback (most recent call last):
  File "query.py", line 99, in <module>
    bar()
  File "query.py", line 66, in bar
    foo()
  File "query.py", line 37, in foo
    magic_arithmetic('foo')
  File "query.py", line 18, in magic_arithmetic
    return add_counts(x) / 25
           ^^^^^^^^^^^^^
  File "query.py", line 24, in add_counts
    return 25 + query_user(user1) + query_user(user2)
                ^^^^^^^^^^^^^^^^^
  File "query.py", line 32, in query_user
    return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
                               ~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```

Rather than going out of our way to provide indicator coverage
in every traceback test suite, the indicator test suite should
be responible for sufficient coverage (e.g. by adding a basic
exception group test to ensure that margin strings are covered).
2022-07-11 07:40:53 +01:00
Raymond Hettinger c9118afd04
Small speed-up for NormalDist.samples (GH-94730) 2022-07-10 22:34:53 -05:00
Brandt Bucher 264b3ddfd5
GH-94694: Fix column offsets for multi-line method lookups (GH-94697) 2022-07-09 17:22:23 -07:00
Tom Fryers a10cf2f6b3
Improve dataclass docstring (gh-94686) 2022-07-09 14:26:24 -04:00
Ken Jin 6442a9dd21
gh-94607: Fix subclassing generics (GH-94610)
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
2022-07-09 12:18:01 +08:00
Brandt Bucher 8a285df806
GH-93252: Fix error handling for failed Python calls (GH-94693) 2022-07-08 18:52:26 -07:00
Irit Katriel 4bed0db7c2
Increase test coverage of Objects/exceptions.c (GH-94674) 2022-07-08 19:01:47 +01:00
Victor Stinner 00464bbed6
gh-94199: Remove the ssl.wrap_socket() function (#94203)
Remove the ssl.wrap_socket() function, deprecated in Python 3.7:
instead, create a ssl.SSLContext object and call its
sl.SSLContext.wrap_socket() method. Any package that still uses
ssl.wrap_socket() is broken and insecure. The function neither sends
a SNI TLS extension nor validates server hostname. Code is subject to
CWE-295 : Improper Certificate Validation.
2022-07-08 15:20:15 +02:00
Brandt Bucher 23ee4a8067
gh-94215: Fix error handling for line-tracing events (GH-94681)
* Re-enable crasher
* Fix error handling for line-tracing events
* blurb add
2022-07-08 14:40:35 +02:00
Samuel Sloniker afd6a37ad1
gh-93654: Add module docstring to pathlib (GH-94611)
Issue: gh-93654
2022-07-07 12:59:29 -07:00
finefoot b6558d768f
gh-94343: Ease initialization of reprlib.Repr attributes (GH-94581) 2022-07-07 09:55:33 -05:00
Michael Droettboom ed136b9673
gh-93910: Fix enum performance regression (GH-94614)
This removes the performance regression in 3.11, **at the expense of not fixing
the "bug" that allows accessing values from values** (e.g. `Color.RED.BLUE`).

Using the benchmark @markshannon [presented](https://github.com/python/cpython/issues/93910#issuecomment-1165503032), the results are:

| Version | Enum | Fast enum | Normal class |
| --- | --- | --- | --- |
| 3.10 | 2.04 | 0.59 | 0.56 |
| 3.11 | 2.78 | 0.31 | 0.15 |
| This PR | 1.30 | 0.32 | 0.16 |

I share this mostly as information about the source of the regression, as this may be useful. It may be that the lower-risk approach for the beta is just to revert to a previously-known working state.
2022-07-07 04:26:56 -07:00
Christian Heimes de5884295e
gh-94215: Add reproducer for segfault in frame_setlineno() (GH-94563) 2022-07-07 12:53:57 +02:00
Erlend Egeberg Aasland 8bbd70b4d1
gh-94430: Allow params named `module` or `self` with custom C names in Argument Clinic (#94431) 2022-07-07 11:29:34 +02:00
Irit Katriel bde06e1b83
gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592)
Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.

This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None".
2022-07-06 23:38:36 -07:00
Kumar Aditya 14fea6b4d2
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase (#94593) 2022-07-06 16:18:21 +01:00
Pablo Galindo Salgado 40d81fd63b
gh-94510: Raise on re-entrant calls to sys.setprofile and sys.settrace (GH-94511)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-07-05 20:18:47 +02:00
Erik De Bonte 5f319308a8
gh-91330: Tests and docs for dataclass descriptor-typed fields (GH-94424)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-07-05 20:09:41 +02:00
Carter Dodd c8556bcf6c
gh-90355: Add isolated flag if currently isolated (GH-92857)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-07-05 17:23:44 +02:00
Jeremy Kloth 067597522a
gh-92897: Ensure `venv --copies` respects source build property of the creating interpreter (GH-92899) 2022-07-05 16:08:20 +01:00
Erik Montnemery c60f125533
bpo-46755: Don't log stack info twice in QueueHandler (GH-31355) 2022-07-05 15:23:12 +01:00
Irit Katriel 324d01944d
gh-94485: Set line number of module's RESUME instruction to 0, as specified by PEP 626 (GH-94552)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-07-05 14:38:44 +02:00
Victor Stinner 92bcb26d00
gh-94379: Remove zipimport find_loader() and find_module() methods (#94380)
zipimport: Remove find_loader() and find_module() methods, deprecated
in Python 3.10: use the find_spec() method instead. See PEP 451 for
the rationale.
2022-07-05 12:11:42 +02:00
KotlinIsland 4791a8a835
gh-93626: Set the release for `__future__.annotations` to `None` (GH-93628)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2022-07-05 10:46:39 +02:00
Victor Stinner fd76eb547d
gh-94383: Remove ElementTree.Element.copy() method (#94384)
xml.etree: Remove the ElementTree.Element.copy() method of the pure
Python implementation, deprecated in Python 3.10, use the copy.copy()
function instead. The C implementation of xml.etree has no copy()
method, only a __copy__() method.
2022-07-04 15:51:01 +02:00
Victor Stinner fbcee570d1
gh-94352: shlex.split() no longer accepts None (#94353)
shlex.split(): Passing None for s argument now raises an exception,
rather than reading sys.stdin. The feature was deprecated in Python
3.9.
2022-07-04 15:29:19 +02:00
Jason R. Coombs 71848c9609
gh-93963: Officially deprecate abcs and warn about their usage. (GH-93965)
Fixes #93963

Automerge-Triggered-By: GH:jaraco
2022-07-03 12:17:27 -07:00
Thomas Perl b296c7442b
gh-92869: ctypes: Add c_time_t (#92870)
Adds `ctypes.c_time_t` to represent the C `time_t` type accurately as its size varies.

Primarily-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2022-07-03 11:58:02 -07:00
Terry Jan Reedy 39c29f753e
IDLE doc: Tweek RESTART and Windows console start (#94530) 2022-07-03 12:56:44 -04:00
Oleg Iarygin 7db1d2eaf3
gh-93096: Remove `python -m base64 -t` (gh-94230) 2022-07-02 15:53:43 +09:00
Oleg Iarygin 1bc8a38d8b
gh-93096: Remove `python -m codecs` (gh-94233) 2022-07-02 14:45:31 +09:00
Irit Katriel c57aad777a
gh-94216: add pseudo instructions to the dis/opcodes modules (GH-94241) 2022-07-01 15:33:35 +01:00
Mark Shannon be80db14c4
GH-94438: Account for NULLs on evaluation stack when jumping lines. (GH-94444) 2022-07-01 14:01:14 +01:00
Mark Shannon 544531de23
GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371) 2022-07-01 11:08:20 +01:00
Guido van Rossum 594c369949
GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400)
Once the task group is shutting down, it should not be possible to create a new task.
Here "shutting down" means `self._aborting` is set, indicating that at least one task
has failed and we have cancelled all others.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-06-30 19:10:46 +02:00
Mehdi ABAAKOUK 4261b6bffc
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (#94050)
The inspect version was not working with unittest.mock.AsyncMock.

The fix introduces special-casing of AsyncMock in
`inspect.iscoroutinefunction` equivalent to the one
performed in `asyncio.iscoroutinefunction`.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-06-30 19:08:38 +02:00
Mark Shannon b152bf448b
GH-94329: Don't raise on excessive stack consumption (GH-94421) 2022-06-30 15:27:14 +01:00
Irit Katriel 21cbdae90f
gh-92336: linecache.getline should not raise exceptions on decoding errors (GH-94410) 2022-06-30 10:18:18 +01:00
Christian Heimes 199ba23324
gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253)
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-29 10:05:16 +02:00
Victor Stinner 600c65c094
gh-94172: Remove ssl.PROTOCOL_SSLv2 dead code (#94312)
Remove dead code related to ssl.PROTOCOL_SSLv2. ssl.PROTOCOL_SSLv2
was already removed in Python 3.10.

In test_ssl, @requires_tls_version('SSLv2') always returned False.

Extract of the removed code: "OpenSSL has removed support for SSLv2".
2022-06-28 13:57:08 +02:00
Robin Plumey 176fd5571f
gh-94018: Remove trailing spaces in _sanitize_windows_name (GH-94040)
Closes #94018.

Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2022-06-28 12:09:22 +02:00
Serhiy Storchaka efdc9d68de
gh-87995: Make MappingProxyType hashable (GH-94252) 2022-06-28 11:54:58 +02:00
Victor Stinner 71d5299b73
gh-94199: Remove hashlib.pbkdf2_hmac() Python implementation (GH-94200)
Remove the pure Python implementation of hashlib.pbkdf2_hmac(),
deprecated in Python 3.10. Python 3.10 and newer requires OpenSSL
1.1.1 or newer (PEP 644), this OpenSSL version provides a C
implementation of pbkdf2_hmac() which is faster.
2022-06-28 11:51:13 +02:00
Christian Heimes 1bc86c2625
gh-94208: Add more TLS version/protocol checks for FreeBSD (GH-94347)
Three test cases were failing on FreeBSD with latest OpenSSL.
2022-06-28 09:33:06 +02:00
Kumar Aditya 01ef1f95da
GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298) 2022-06-28 10:01:43 +03:00
Terry Jan Reedy e6391e08bf
gh-82006: IDLE doc improvements (#94349)
0. Update text start and stop conditions.
1. Title-case sections but not subsections.
2. Edit Shell Window sections: title, execute, restart.
2022-06-27 18:59:26 -04:00