Commit Graph

114075 Commits

Author SHA1 Message Date
MonadChains b03a9e8c8a
gh-94309: Add typing.Hashable and typing.Sized for "What's New for Python 3.12" (GH-94729)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-07-14 07:50:31 +01:00
Terry Jan Reedy 6a15f918b5
idlelib: replace 'while 1' with 'while True' (#94827) 2022-07-13 21:09:07 -04:00
Dong-hee Na 967da5febb
gh-90359: Unify documentation style for datetime.rst (gh-94836) 2022-07-14 09:40:10 +09:00
Dong-hee Na 07374cce52
gh-90359: Update documentation to follow PEP 495. (gh-94800) 2022-07-14 09:04:52 +09:00
da-woods 8d7089f0a0
gh-94499 Add test for private name mangling in class pattern matching (#94500)
The current status quo is that private attribute names are not
mangled when a class is matched. I've added a test to
document/legimize this behaviour.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-07-13 09:13:10 -07:00
neonene 4a6bb30eb6
gh-90815: Fix test_embed for Windows PGO build with mimalloc (GH-94790)
Fixes the failure of PGO building with `mimalloc` on Windows, ensuring that `test_bpo20891` does not break profiling data (`python31*.pgc`).
2022-07-13 09:08:12 -07:00
Raymond Hettinger ed06ec1ab8
GH-81620: Add random.binomialvariate() (GH-94719) 2022-07-13 09:46:04 -05:00
Christian Heimes f5c02afaff
gh-94759: Create LCOV report with branch coverage (GH-94793) 2022-07-13 16:35:28 +02:00
Oleg Iarygin fc21a43b1f
gh-93649: Fix linkage of _PyTestCapi_Init_Vectorcall (#94702) 2022-07-13 13:22:45 +02:00
Itay cceac5dd06
gh-94713 - Replacing while 1 with while True (#94714) 2022-07-12 22:53:14 -05:00
Benjamin Peterson e39ce7d487
Fix typo in _exact_ratio comment. (GH-94789) 2022-07-12 14:34:23 -07:00
Pradyun Gedam 47f50cbab7
Fix heading levels for "Deprecated" section in What's New for 3.12 (GH-94762)
These headings were at the same level as the "Deprecated" heading, but
likely intended to be a subheading within that section.

Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2022-07-12 20:55:32 +01:00
Max Zhenzhera 90a6e56e56
docs: typing.Self, fix typo (GH-94771)
* fix typo - double spelled word 'use'

* change methods names to the infinitive form
2022-07-12 18:45:52 +01:00
Christian Heimes 0c66074e9f
gh-94773: deepfreeze: support frozensets with unsortable types (GH-94775) 2022-07-12 18:09:47 +02:00
Petr Viktorin ec5db539b9
gh-94751: Install, import and run the test C++ extension (MVP) (GH-94754)
This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
2022-07-12 17:06:05 +02:00
Kumar Aditya cfafd3adf8
GH-94736: mark SemLock test as linux only (GH-94750)
See https://buildbot.python.org/all/#/builders/172/builds/2522
The PR skips the test on non-linux platforms.

Automerge-Triggered-By: GH:pablogsal
2022-07-11 07:35:47 -07:00
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
MonadChains e8e4b550f5
gh-94309: Deprecate typing.Hashable/Sized (GH-94626)
Deprecate typing.Hashable/Sized. Use the collections.abc counterparts directly instead.

To be consistent with PEP 585, deprecated aliases will not raise any DeprecationWarning.
2022-07-10 19:04:01 +01:00
Raymond Hettinger ef61b259e3
GH-77265: Document NaN handling in statistics functions that sort or count (#94676)
* Document NaN handling in functions that sort or count

* Update Doc/library/statistics.rst

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>

* Update Doc/library/statistics.rst

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>

* Fix trailing whitespace and rewrap text

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-10 17:40:27 +10: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
Christian Heimes 78307c7dc2
gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658) 2022-07-09 18:11:15 +02:00
Itamar Ostricher 0fc8ac0b0d
pycore_interp.h: Fix comment about pytypedefs.h (#93188)
GH-31527 moved this typedef to `Include/pytypedefs.h`, so this comment
should point at the correct location
2022-07-09 15:58:30 +02:00
Christian Heimes 18ef240a2c
gh-93649: Fix dependencies of _testcapi (#94695)
- header files are located in $(srcdir)
- dependencies must not list C files that are also in a makesetup Setup file
- generate SRCDIRS for OOT builds
2022-07-09 13:01:23 +02:00
CAM Gerlach 761eeb62a9
gh-94700: Rewrite the logging.Formatter API ref in structured form (GH-94701) 2022-07-09 06:03:47 +01: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
Kumar Aditya 9dff9f4814
GH-90699: Intern statically allocated strings (GH-93597)
This is similar to how strings are interned for deepfreeze.
2022-07-08 10:47:37 -07:00
Petr Viktorin be862b4e55
gh-93649: Split vectorcall testing from _testcapimodule.c (GH-94549)
The `_testcapimodule.c` file is getting too large to work with effectively.
This PR lays out a general structure of how tests can be split up, with more splitting to come later if the structure is OK.

Vectorcall tests aren't the biggest issue -- it's just an area I want to work on next, so I'm starting here.
An issue specific to vectorcall tests is that it wasn't clear that e.g. `MethodDescriptor2` is related to testing vectorcall: the `/* Test PEP 590 */` section had an ambiguous end. Separate file should make things like this much clearer.
OTOH, for some pieces it might not be clear where they should be -- I left `meth_fastcall` with tests of the other calling conventions. IMO, even with the ambiguity it's still worth it to split the huge file up.

I'm not sure about the buildsystem changes, hopefully CI will tell me what's wrong.

@vstinner, @markshannon: Do you think this is a good idea?

Automerge-Triggered-By: GH:encukou
2022-07-08 08:56:26 -07:00
Oleg Iarygin efb20a97c4
Use mdash-es consistently in the library docs index (#92762) 2022-07-08 16:44:15 +02: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
Erlend Egeberg Aasland e5b841a403
gh-94622: Add more references to the sqlite3 types anchor (#94623) 2022-07-08 02:38:38 +02:00
Erlend Egeberg Aasland fb6dccae34
gh-94321: Document sqlite3.PrepareProtocol (#94620) 2022-07-08 00:33:17 +02:00
Kumar Aditya 71697664d7
GH-90699: Move generated static initializer to pycore_runtime_generated.h (GH-94051) 2022-07-07 13:04:05 -07: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
Christian Heimes 29f86d6c28
gh-94642: Remove -D_XOPEN_SOURCE from more pkg-config CFLAGS (#94657)
Some pkg-config pc files define CFLAGS with -D_XOPEN_SOURCE=600. We always want _XOPEN_SOURCE=700.
2022-07-07 14:47:32 +02: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
Kumar Aditya 277f55cb04
GH-94644: fix test_curses ref leak (GH-94647) 2022-07-07 03:57:45 -07:00
Christian Heimes 9c60b25a0d
gh-94644: Define HAVE_NCURSESW in pkg-config branch (#94651) 2022-07-07 12:57:12 +02: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
Erlend Egeberg Aasland 3eb2b9634f
gh-94628: Add explicit parameter list to sqlite3.connect docs (#94629)
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-07-07 09:00:20 +02:00