Commit Graph

116467 Commits

Author SHA1 Message Date
Raymond Hettinger 0a22aa0528
Simplify and speed-up math.hypot() and math.dist() (GH-102734) 2023-03-15 15:15:23 -05:00
Martin Breuss 00d1ef73d6
Fix typo in code comment (#102726) 2023-03-15 19:18:18 +00:00
Alex Waygood 215007b576
Exclude `ceval.c` from the C-analyzer tool (#102735)
The "check if generated files are up to date" CI check appears to be currently failing on all PRs (but not on pushes to main) 

See, for example:
- https://github.com/python/cpython/pull/94468
- https://github.com/python/cpython/pull/94468
- https://github.com/python/cpython/pull/102731

This appears to be because the C-analyzer tool doesn't like the `#line` directives introduced in 70185de1ab. I'm advised by the message printed to the terminal in https://github.com/python/cpython/actions/runs/4428706945/jobs/7768216988#step:14:84 that this is the appropriate short-term fix!
2023-03-15 18:19:07 +00:00
Guido van Rossum 70185de1ab
gh-102654: Insert #line directives in generated_cases.c.h (#102669)
This behavior is optional, because in some extreme cases it
may just make debugging harder. The tool defaults it to off,
but it is on in Makefile.pre.in.

Also note that this makes diffs to generated_cases.c.h noisier,
since whenever you insert or delete a line in bytecodes.c,
all subsequent #line directives will change.
2023-03-15 08:37:36 -07:00
Julien Palard 61b9ff35cb
gh-101100: Documenting --prefix and --exec-prefix. (GH-102695)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-03-15 16:10:03 +01:00
Max Bachmann afa6092ee4
gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282) 2023-03-15 21:58:43 +09:00
Nikita Sobolev 2b5781d659
gh-102615: Use `list` instead of `tuple` in `repr` of paramspec (#102637)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-15 09:33:41 +00:00
Tom Levy 8647ba4b63
Remove misformatted exclamation marks in docs (#102694)
Remove the exclamation mark from :program:`!foo` in .rst files because
it inadvertently shows up in the rendered HTML.

(Sphinx's cross-referencing roles use a '!' prefix to suppress
hyperlinking[1], but :program: is not a cross-referencing role so the
'!' is displayed verbatim.)

The exclamation marks in venv.rst were introduced in #98350. See
comments [2] and [3] for additional discussion.

[1]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#cross-referencing-syntax
[2]: https://github.com/python/cpython/pull/98350#issuecomment-1285965759
[3]: https://github.com/python/cpython/pull/98350#issuecomment-1286394047

Reported-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2023-03-15 09:06:32 +02:00
Andre Hora 5e0865f22e
gh-101377: improving test_locale_calendar_formatweekday of calendar (#101378)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-03-14 22:36:31 -04:00
JosephSBoyle e94edab727
gh-102560 Add docstrings to asyncio.TaskGroup (#102565) 2023-03-14 17:33:19 -07:00
Steve Dower 5fce813d8e
gh-102519: Avoid failing tests due to inaccessible volumes (GH-102706) 2023-03-15 00:07:30 +00:00
Robert Prater (B. Eng) 0a539b5db3
gh-102703: Fix typo in modules tutorial documentation (GH-102707)
**Before**
This prevents directories with a common name, such as ``string``, unintentionally hiding ...
**After**
This prevents directories with a common name, such as ``string``, from unintentionally hiding ...
2023-03-14 17:03:43 -07:00
Irit Katriel 152292b98f
gh-101578: mention in what's new in 3.12 that exceptions are now normalized before stored (#102702) 2023-03-14 22:38:15 +00:00
JosephSBoyle a028778d4c
Rename redundant enum tests so that they run (#102535) 2023-03-14 15:16:45 -07:00
Dong-hee Na d77c48740f
gh-102674: Remove _specialization_stats from Lib/opcode.py (#102685)
It's not use except in a test, so move it there instead.
2023-03-14 13:20:14 -07:00
Eric Snow cdb21ba74d
gh-102660: Handle m_copy Specially for the sys and builtins Modules (gh-102661)
It doesn't make sense to use multi-phase init for these modules. Using a per-interpreter "m_copy" (instead of PyModuleDef.m_base.m_copy) makes this work okay. (This came up while working on gh-101660.)

Note that we might instead end up disallowing re-load for sys/builtins since they are so special.

https://github.com/python/cpython/issues/102660
2023-03-14 14:01:35 -06:00
Paul Watson 80abd62647
gh-102354: change python3 to python in docs examples (#102696) 2023-03-14 12:40:12 -06:00
Eric Snow 1ff81c0cb6
gh-81057: Add a CI Check for New Unsupported C Global Variables (gh-102506)
This will keep us from adding new unsupported (i.e. non-const) C global variables, which would break interpreter isolation.

FYI, historically it is very uncommon for new global variables to get added. Furthermore, it is rare for new code to break the c-analyzer. So the check should almost always pass unnoticed.

Note that I've removed test_check_c_globals. A test wasn't a great fit conceptually and was super slow on debug builds. A CI check is a better fit.

This also resolves gh-100237.

https://github.com/python/cpython/issues/81057
2023-03-14 10:05:54 -06:00
Kumar Aditya a703f743db
GH-94851: check unicode consistency of static strings in debug mode (#102684) 2023-03-14 15:21:38 +05:30
T 88c262c086
gh-100315: clarification to `__slots__` docs. (#102621)
refer to tp_itemsize in discussion on "variable-length" built-in types
2023-03-14 09:23:52 +00:00
Kumar Aditya 3d872a74c8
GH-100227: cleanup initialization of global interned dict (#102682) 2023-03-14 14:22:21 +05:30
Joongi Kim 7bdb331b67
doc: Remove a duplicate 'versionchanged' in library/asyncio-task (gh-102677) 2023-03-14 11:07:59 +09:00
Jacob Bower cbd3fbfb6e
gh-102013: Add PyUnstable_GC_VisitObjects (#102014) 2023-03-14 01:35:54 +00:00
Raymond Hettinger 457e4d1a51
GH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions (GH-102649) 2023-03-13 20:06:43 -05:00
Blind4Basics 61479d4684
gh-102627: Replace address pointing toward malicious web page (#102630)
* Replace known bad address pointing toward a malicious web page.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-03-13 15:35:37 -07:00
Guido van Rossum 392f2ad3cb
gh-98831: Use DECREF_INPUTS() more (#102409) 2023-03-13 15:08:45 -07:00
Eric Snow 959ea2f9e9
gh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters Module (gh-102659)
https://github.com/python/cpython/issues/101659
2023-03-13 16:01:44 -06:00
Eric Snow 74885a08db
gh-101524: Fix the ChannelID tp_name (gh-102655)
https://github.com/python/cpython/issues/101524
2023-03-13 15:50:16 -06:00
Nikita Sobolev d97757f793
gh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (#102075) 2023-03-13 15:42:05 -06:00
T 71e37d9079
gh-98169 dataclasses.astuple support DefaultDict (#98170)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2023-03-13 14:46:35 -06:00
chgnrdv 85ba8a3e03
gh-102650: Remove duplicate include directives from multiple source files (#102651)
Remove duplicate include directives from multiple source files
2023-03-13 13:25:17 -06:00
Mark Shannon 2d370da570
GH-100987: Don't cache references to the names and consts array in `_PyEval_EvalFrameDefault`. (#102640)
* Rename local variables, names and consts, from the interpeter loop. Will allow non-code objects in frames for better introspection of C builtins and extensions.

* Remove unused dummy variables.
2023-03-13 18:35:37 +00:00
Irit Katriel 634cb61909
gh-87092: refactor assemble() to a number of separate functions, which do not need the compiler struct (#102562) 2023-03-13 15:59:20 +00:00
Irit Katriel ca01cae1e9
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (#102631) 2023-03-13 15:56:24 +00:00
谭九鼎 9a8b66b58c
Fix broken link to MSDN (#102355) 2023-03-13 15:15:52 +02:00
Mark Shannon 233e32f936
GH-102300: Reuse objects with refcount == 1 in float specialized binary ops. (GH-102301) 2023-03-13 10:34:54 +00:00
Hugo van Kemenade 78e4e6c3d7
gh-101100: Fix Sphinx warnings in `turtle` module (#102340)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-03-13 11:24:52 +02:00
gaogaotiantian 5d677c556f
GH-101673: Fix pdb bug where local variable changes are lost after longlist (#101674) 2023-03-12 23:09:55 +00:00
Виталий Дмитриев f6ca71a422
Fix duplicated words in the docs (GH-102629)
With grep utility found some duplicated words

Automerge-Triggered-By: GH:AlexWaygood
2023-03-12 11:03:59 -07:00
Raymond Hettinger 6cd7572f85
Optimize fmean() weighted average (#102626) 2023-03-12 12:48:25 -05:00
Guido van Rossum e6210621be
Fixes duplicated word (#102623)
In line 1627, the end of the sentence reads "only that that it may be." but it should read "only that it may be" (or alternatively "only that that may be").

Co-authored-by: Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com>
2023-03-12 09:58:02 -07:00
Nikita Sobolev bb396eece4
gh-101821: Test coverage for `ast.main` function (#101822) 2023-03-11 11:10:52 -08:00
Thomas Krennwallner 534660f168
gh-79940: skip `TestGetAsyncGenState` on wasm as it requires working sockets (GH-102605)
Skip `TestGetAsyncGenState` and restoring of the default event loop policy in `test_inspect` if platform lacks working socket support.

Fixes #11590

Automerge-Triggered-By: GH:kumaraditya303
2023-03-11 10:36:49 -08:00
Thomas Krennwallner ced13c96a4
gh-79940: add introspection API for asynchronous generators to `inspect` module (#11590) 2023-03-11 18:49:40 +05:30
wangxiang-hz aa0a73d1bc
gh-102213: Optimize the performance of `__getattr__` (GH-102248)
When __getattr__ is defined, python with try to find an attribute using _PyObject_GenericGetAttrWithDict
find nothing is reasonable so we don't need an exception, it will hurt performance.
2023-03-11 19:11:37 +08:00
Alex Waygood 5ffdaf748d
gh-102433: Add tests for how classes with properties interact with `isinstance()` checks on `typing.runtime_checkable` protocols (#102449)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-03-11 01:20:20 +00:00
Brandt Bucher 08b67fb34f
GH-90997: Shrink the LOAD_GLOBAL caches (#102569) 2023-03-10 17:01:16 -08:00
Ilya V. Schurov 767d3a8f6f
gh-88071: Update docstrings of dataclass' astuple and asdict (#101806)
Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
2023-03-10 17:27:41 -07:00
Nikita Sobolev b48be8fa18
gh-102103: add `module` argument to `dataclasses.make_dataclass` (#102104) 2023-03-10 17:26:46 -07:00
Xuehai Pan ee6f8413a9
gh-102578: Optimise setting and deleting mutable attributes on non-dataclass subclasses of frozen dataclasses (gh-102573) 2023-03-10 19:21:22 -05:00