Commit Graph

28175 Commits

Author SHA1 Message Date
aha79 6e7b813195
bpo-46333: Honor `module` parameter in ForwardRef (GH-30536)
The `module` parameter carries semantic information about the forward ref.
Forward refs are different if they refer to different module even if they
have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods.

Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-02-16 19:28:18 -08:00
97littleleaf11 de6043e596
bpo-46066: Deprecate kwargs syntax for TypedDict definitions (GH-31126)
Closes python/typing#981

https://bugs.python.org/issue46066
2022-02-16 19:26:07 -08:00
Hakan Çelik 562c13f573
bpo-29418: Implement inspect.ismethodwrapper and fix inspect.isroutine for cases where methodwrapper is given (GH-19261)
Automerge-Triggered-By: GH:isidentical
2022-02-16 04:46:20 -08:00
Mark Shannon 3954fcb83f
Remove offsets from expected output in test.test_dis (GH-31369) 2022-02-16 12:19:09 +00:00
Eric V. Smith ffd9f8ff84
bpo-46762: Fix an assert failure in f-strings where > or < is the last character if the f-string is missing a trailing right brace. (#31365) 2022-02-16 05:54:09 -05:00
Alex-Blade 0cb765b2ce
bpo-46730: Add more info to @property AttributeError messages (GH-31311)
On `obj.read_only_property = x`, raise `AttributeError: property 'read_only_property' of 'A' object has no setter`.
2022-02-16 02:07:34 -05:00
Guido van Rossum 602630ac18
bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)
asyncio/taskgroups.py is an adaptation of taskgroup.py from EdgeDb, with the following key changes:

- Allow creating new tasks as long as the last task hasn't finished
- Raise [Base]ExceptionGroup (directly) rather than TaskGroupError deriving from MultiError
- Instead of monkey-patching the parent task's cancel() method,
  add a new public API to Task

The Task class has a new internal flag, `_cancel_requested`, which is set when `.cancel()` is called successfully. The `.cancelling()` method returns the value of this flag. Further `.cancel()` calls while this flag is set return False. To reset this flag, call `.uncancel()`.

Thus, a Task that catches and ignores `CancelledError` should call `.uncancel()` if it wants to be cancellable again; until it does so, it is deemed to be busy with uninterruptible cleanup.

This new Task API helps solve the problem where TaskGroup needs to distinguish between whether the parent task being cancelled "from the outside" vs. "from inside".

Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-15 15:42:04 -08:00
Zackery Spytz 08ec80113b
bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360) 2022-02-15 17:12:15 -06:00
Kumar Aditya 13c10bfb77
bpo-44011: New asyncio ssl implementation (#31275)
* bpo-44011: New asyncio ssl implementation

Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com>

* fix warning

* fix typo

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-15 15:04:00 +02:00
Mark Shannon 3be1a443ca
bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)
* Make sure all backward jumps use JUMP_ABSOLUTE.

* Add news.

* Fix up news item.

* Make test use consistent style.
2022-02-15 09:35:16 +00:00
aha79 b70690bb37
bpo-46333: include `module` in `ForwardRef.__repr__` (#31283)
The module parameter carries semantic information about the forward ref.
Show to the user that forward refs with same argument but different
module are different.

Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-02-12 07:35:57 -08:00
Jacob Walls 168fd6453b
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152)
Both implementations accept target=None now.
2022-02-12 10:27:02 +02:00
Dennis Sweeney 4a66615ba7
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
Ensure strong references are acquired whenever using `set_next()`. Added randomized test cases for `__eq__` methods that sometimes mutate sets when called.
2022-02-11 11:25:08 -05:00
Petr Viktorin 204946986f
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-11 17:22:11 +01:00
Arie Bovenberg dd76b3f7d3
bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)
Confirmed with @jaraco that this indeed needs a fix.

A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own.

Automerge-Triggered-By: GH:jaraco
2022-02-10 16:56:21 -08:00
Pablo Galindo Salgado 390459de6d
Allow the parser to avoid nested processing of invalid rules (GH-31252) 2022-02-10 13:12:14 +00:00
Andrew Svetlov 012e77eb5c
Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
Pablo Galindo Salgado b71dc71905
bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241) 2022-02-10 03:37:17 +00:00
Brandt Bucher 78ae4cc6dc
bpo-46528: Attempt SWAPs at compile-time (GH-30970) 2022-02-09 15:15:36 -08:00
Joshua Root bf2d44ffb0
bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
2022-02-09 18:06:19 +01:00
Andrzej Mateja 128ab092ca
bpo-44289: Keep argument file object's current position in tarfile.is_tarfile (GH-26488) 2022-02-09 08:19:16 -08:00
Nikita Sobolev d2d1d49eac
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223) 2022-02-09 23:23:07 +09:00
Barney Gale 06e1701ad3
bpo-46556: emit `DeprecationWarning` from `pathlib.Path.__enter__()` (GH-30971)
In Python 3.9, Path.__exit__() was made a no-op and has never been documented.

Co-authored-by: Brett Cannon <brett@python.org>
2022-02-08 13:01:37 -08:00
Jelle Zijlstra 243436f377
bpo-46475: Add typing.Never and typing.assert_never (GH-30842) 2022-02-08 10:50:26 -08:00
Mark Shannon 25db2b361b
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191) 2022-02-08 11:50:38 +00:00
Gregory Beauregard c8b62bbe46
bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) 2022-02-08 09:46:58 +02:00
Jason Wilkes da576e0829
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204)
In [Lib/test/support/import_helper.py](https://github.com/python/cpython/blob/master/Lib/test/support/import_helper.py), the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
2022-02-07 17:09:07 -08:00
Victor Stinner 7a0486eaa9
bpo-46659: calendar uses locale.getlocale() (GH-31166)
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar
classes module now use locale.getlocale(), instead of using
locale.getdefaultlocale(), if no locale is specified.
2022-02-08 00:24:09 +01:00
James Hilton-Balfe 7ba1cc8049
bpo-46534: Implement PEP 673 Self in typing.py (GH-30924)
Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-07 12:47:48 -08:00
Nikita Sobolev 8e98175a03
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet
and use the local HTTP server rather than an external HTTP server.
2022-02-07 13:48:43 +01:00
Nikita Sobolev 067c03bf40
bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078) 2022-02-06 17:35:48 -08:00
Gregory Beauregard 77b025be4a
bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156) 2022-02-06 15:16:22 -08:00
Victor Stinner 06b8f1615b
bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)
skip_if_buggy_ucrt_strfptime() of test.support now uses
locale.getpreferredencoding(False) instead of
locale.getdefaultlocale() to get the Windows code page.
2022-02-06 21:51:56 +01:00
Victor Stinner 04dd60e50c
bpo-46659: Update the test on the mbcs codec alias (GH-31168)
encodings registers the _alias_mbcs() codec search function before
the search_function() codec search function. Previously, the
_alias_mbcs() was never used.

Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code
page, not a fake ANSI code page number.

Remove the test_site.test_aliasing_mbcs() test: the alias is now
implemented in the encodings module, no longer in the site module.
2022-02-06 21:50:09 +01:00
Serhiy Storchaka 3da5526136
Add more tests for variable substitution in generics (GH-31170) 2022-02-06 21:52:39 +02:00
Victor Stinner 1578de2fcd
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
POST requests to http://www.example.com/ fail randomly.
2022-02-06 15:08:54 +01:00
Christian Heimes 96b344c2f1
bpo-40280: Address more test failures on Emscripten (GH-31050)
Co-authored-by: Brett Cannon <brett@python.org>
2022-02-05 20:52:01 +01:00
Manish Kumar ⛄ ba650af7d6
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2022-02-04 15:49:43 +09:00
Miro Hrončok 6baa98e538
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098) 2022-02-03 07:48:13 -06:00
Zackery Spytz b4bd1e1422
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
2022-02-03 11:43:25 +02:00
Nikita Sobolev 7ffe7ba30f
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-02-03 11:25:10 +02:00
Nikita Sobolev 0cbdd21311
bpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993) 2022-02-03 11:20:08 +02:00
Gregory P. Smith 8726067ace
bpo-45629: Improve test.support.skip_if_buildbot (GH-31094)
It was added as part of #29222 to avoid running freeze tool tests on the
buildbots but the logic was wrong so it did not skip tests on typical posix
setup buildbots where the worker is launched from cron via an @reboot task and
thus have no USER environment variable.  This uses the canonical
`getpass.getuser()` API rather than rolling its own attempt.
2022-02-02 21:36:16 -08:00
Steve Dower 89a0a90c2e
bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completion (GH-31086) 2022-02-02 19:54:27 +00:00
Hugo van Kemenade e8659b47de
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
* Revert "bpo-45173 Remove configparser deprecations"

This reverts commit df2284bc41.

* bpo-45173: Note these configparser deprecations will be removed in 3.12
2022-02-02 08:59:39 -08:00
Petr Viktorin 0ef0853012
bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696)
Automerge-Triggered-By: GH:encukou
2022-02-02 07:57:51 -08:00
Christian Heimes f66c857572
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???
2022-02-02 07:03:10 -08:00
Barney Gale 08f8301b21
bpo-43012: remove `pathlib._Accessor` (GH-25701)
Per Pitrou:

> The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there.

https://discuss.python.org/t/make-pathlib-extensible/3428/2

Accessors are:

- Lacking any internal purpose - '_NormalAccessor' is the only implementation
- Lacking any firm conceptual difference to `Path` objects themselves (inc. subclasses)
- Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor' 
- Unofficially used to implement customized `Path` objects, but once once [bpo-24132]() is addressed there will be a supported route for that.

This patch preserves all existing behaviour.
2022-02-02 04:38:25 -08:00
Jelle Zijlstra abcc3d75f6
bpo-46414: Add typing.reveal_type (#30646)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 18:48:55 -08:00
Victor Stinner 0611eafc70
bpo-44359: Fix test_ftplib unhandled thread exceptions (GH-31069)
test_ftplib now silently ignores socket errors to prevent logging
unhandled threading exceptions.
2022-02-02 02:47:40 +01:00
Brandt Bucher a0e55a571c
bpo-46528: Simplify BUILD_TUPLE/UNPACK_SEQUENCE folding (GH-31039) 2022-02-01 13:41:32 -08:00
Victor Stinner bebaa95fd0
bpo-46600: Fix test_gdb.test_pycfunction() for clang -Og (GH-31058)
Fix test_gdb.test_pycfunction() for Python built with clang -Og.
Tolerate inlined functions in the gdb traceback.

When _testcapimodule.c is built by clang -Og, _null_to_none() is
inlined in meth_varargs() and so gdb returns _null_to_none() as
the frame #1. If it's not inlined, meth_varargs() is the frame #1.
2022-02-01 18:12:26 +01:00
Irit Katriel 108e66b6d2
bpo-44031: fix test_tabnanny failure in non-ascii CWD (GH-31014) 2022-02-01 10:31:57 +00:00
Nikita Sobolev 4c0612ad00
bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821) 2022-02-01 17:58:41 +08:00
Brett Cannon 8b1b27f193
Fix a `UnboundLocalError` bug in `test_sysconfig` (GH-31000)
Accidentally introduced by GH-24502
2022-01-29 00:43:36 +00:00
Barney Gale 18cb2ef46c
bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Brian Helba <brian.helba@kitware.com>
2022-01-28 15:40:55 -08:00
Natanael Copa 1f036ede59
bpo-43112: detect musl as a separate SOABI (GH-24502)
musl libc and gnu libc are not ABI compatible so we need set different
SOABI for musl and not simply assume that all linux is linux-gnu.

Replace linux-gnu with the detected os for the build from config.guess
for linux-musl*.
2022-01-28 15:02:54 -08:00
Kumar Aditya 24cc6411ad
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288) 2022-01-28 14:24:35 -08:00
Irit Katriel 36f538c809
bpo-46458: Add tests for context of exception in finally block (GH-30986) 2022-01-28 20:41:58 +00:00
Gregory Beauregard 5445e173e7
bpo-46553: allow bare typing.ClassVar annotations (#30983)
These are used in the wild and covered by dataclasses unit tests.
Several static type checkers support this pattern.
2022-01-28 08:58:39 -08:00
Mark Shannon 89fd7c3452
bpo-46329: Split calls into precall and call instructions. (GH-30855)
* Add PRECALL_FUNCTION opcode.

* Move 'call shape' varaibles into struct.

* Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.

* Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.

* Allow kwnames for specialized calls to builtin types.

* Specialize calls to tuple(arg) and str(arg).
2022-01-28 12:42:30 +00:00
Nikita Sobolev c27a33132b
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913) 2022-01-27 21:43:00 -08:00
Victor Stinner e7a6285f1b
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
Fix test_json tests checking for RecursionError: modify these tests
to use support.infinite_recursion().
2022-01-28 01:35:13 +01:00
Russel Webber 183f8d57fa
bpo-46098: Add test for multiline syntax error traceback (GH-30695) 2022-01-27 14:13:12 +00:00
Karolina Surma aa78287bc6
bpo-44734: Fix floating point precision in test_turtle (GH-30910) 2022-01-27 14:57:55 +01:00
Irit Katriel 3d2ce34716
bpo-46458: emit code for else of a try block immediately after the try body (GH-30751) 2022-01-27 13:40:44 +00:00
Serhiy Storchaka ecfacc362d
bpo-44791: Fix substitution of ParamSpec in Concatenate with different parameter expressions (GH-27518)
* Substitution with a list of types returns now a tuple of types.
* Substitution with Concatenate returns now a Concatenate with
  concatenated lists of arguments.
* Substitution with Ellipsis is not supported.
2022-01-27 14:34:55 +02:00
Kinshuk Dua 08c0ed2d9c
bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236) 2022-01-27 10:24:48 +00:00
Gregory Beauregard ced50051bb
bpo-46539: Pass status of special typeforms to forward references (GH-30926)
Previously this didn't matter because there weren't any valid code paths
that could trigger a type check with a special form, but after the bug
fix for `Annotated` wrapping special forms it's now possible to annotate
something like `Annotated['ClassVar[int]', (3, 4)]`. This change would
also be needed for proposed future changes, such as allowing `ClassVar`
and `Final` to nest each other in dataclasses.
2022-01-26 19:11:51 -08:00
Brandt Bucher 8548366864
bpo-46528: Simplify the VM's stack manipulations (GH-30902) 2022-01-26 12:47:45 -08:00
Erlend Egeberg Aasland 3eb3b4f270
bpo-43853: Expand test suite for SQLite UDF's (GH-27642) 2022-01-26 08:26:16 -08:00
Jelle Zijlstra ac0c6e128c
bpo-46527: allow calling enumerate(iterable=...) again (GH-30904) 2022-01-27 00:46:48 +09:00
Nikita Sobolev d0c690b5f8
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911) 2022-01-26 18:13:02 +08:00
Nikita Sobolev 84f093918a
bpo-45578: add a test case for `dis.findlabels` (GH-30058) 2022-01-26 19:05:35 +09:00
Irit Katriel 072f4a473e
bpo-46431: use raw string for regex in test (GH-30901) 2022-01-25 23:52:43 +00:00
Pablo Galindo Salgado a27505345e
Add skips to crashing tests under sanitizers instead of manually skipping them (GH-30897) 2022-01-25 23:14:03 +00:00
Pablo Galindo Salgado a0efc0c196
bpo-46091: Correctly calculate indentation levels for whitespace lines with continuation characters (GH-30130) 2022-01-25 22:12:14 +00:00
Pablo Galindo Salgado b1cb843050
Refactor sanitiser skip tests into test.support (GH-30889)
* Refactor sanitizer skip tests into test.support

* fixup! Refactor sanitizer skip tests into test.support

* fixup! fixup! Refactor sanitizer skip tests into test.support
2022-01-25 22:01:10 +00:00
Victor Stinner cef0a5458f
bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) 2022-01-25 20:02:23 +01:00
Irit Katriel ec7c17ea23
bpo-46510: Add missing test for types.TracebackType/FrameType. Calculate them directly from the caught exception. (GH-30880) 2022-01-25 18:00:57 +00:00
Raymond Hettinger ee60550e9b
Move doctests to the main docs. Eliminate duplication. Improve coverage. (GH-30869) 2022-01-25 06:56:53 -06:00
Christian Heimes 8464fbc42e
bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615) 2022-01-25 08:09:06 +01:00
Gregory Beauregard e1abffca45
bpo-46491: Allow Annotated on outside of Final/ClassVar (GH-30864)
We treat Annotated type arg as class-level annotation. This exempts it from checks against Final and ClassVar in order to allow using them in any nesting order.

Automerge-Triggered-By: GH:gvanrossum
2022-01-24 22:37:15 -08:00
Eric V. Smith 0daf72194b
bpo-46503: Prevent an assert from firing when parsing some invalid \N sequences in f-strings. (GH-30865)
* bpo-46503: Prevent an assert from firing.  Also fix one nearby tiny PEP-7 nit.

* Added blurb.
2022-01-24 21:53:27 -05:00
Irit Katriel 573b545157
bpo-46431: improve error message on invalid calls to BaseExceptionGroup.__new__ (GH-30854) 2022-01-24 21:47:40 +00:00
Kumar Aditya 1c705fda8f
fixed flaky test (GH-30845) 2022-01-24 21:04:47 +00:00
Mario Corchero d7c6863979
bpo-41906: Accept built filters in dictConfig (GH-30756)
When configuring the logging stack, accept already built filters (or
just callables) in the filters array of loggers and handlers.
This facilitates passing quick callables as filters.

Automerge-Triggered-By: GH:vsajip
2022-01-24 04:39:50 -08:00
Nikita Sobolev 58f3d98098
bpo-46422: use `dis.Positions` in `dis.Instruction` (GH-30716)
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-01-24 14:09:20 +03:00
Raymond Hettinger 270a09184d
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837) 2022-01-23 14:31:10 -06:00
Weipeng Hong 691506f4e9
bpo-46103: Fix inspect.getmembers to only get __bases__ from class (GH-30147) 2022-01-23 09:40:38 -08:00
Dong-hee Na 76dc047a0e
bpo-46481: Implement vectorcall for weakref.ref.__call__ method. (GH-30820) 2022-01-24 00:39:45 +09:00
Nikita Sobolev 1f715d5bd3
bpo-46483: change `PurePath.__class_getitem__` to return `GenericAlias` (GH-30822) 2022-01-23 17:48:43 +03:00
Victor Stinner b0898f4aa9
bpo-45382: test.pythoninfo logs more Windows versions (GH-30817)
Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.
2022-01-23 04:03:43 +01:00
Jason R. Coombs 443dec6c9a
bpo-46474: Apply changes from importlib_metadata 4.10.0 (GH-30802) 2022-01-22 21:39:00 -05:00
Jason R. Coombs d888ff5381
bpo-46425: Partially revert "bpo-46425: fix direct invocation of `test_importlib` (GH-30682)" (GH-30799)
This reverts commit 57316c52ba for files pertaining to importlib.metadata and importlib.resources.
2022-01-22 21:38:26 -05:00
Ethan Furman 353e3b2820
bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816) 2022-01-22 18:27:52 -08:00
Victor Stinner 12f4ac3bc8
bpo-46417: Clear symtable identifiers at exit (GH-30809)
Add _PySymtable_Fini() function, called by finalize_interp_clear().

Update test_cmd_line.test_showrefcount() to tolerate negative
reference count.
2022-01-23 00:06:56 +01:00
Nikita Sobolev 1ded8ed8e8
bpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801) 2022-01-22 23:52:26 +01:00
Victor Stinner f1bcdeaca6
bpo-46417: Factorize _PyExc_InitTypes() code (GH-30804)
Add 'static_exceptions' list to factorize code between
_PyExc_InitTypes() and _PyBuiltins_AddExceptions().

_PyExc_InitTypes() does nothing if it's not the main interpreter.

Sort exceptions in Lib/test/exception_hierarchy.txt.
2022-01-22 21:48:56 +01:00
Jason R. Coombs a941e5927f
bpo-46126: Disable 'descriptions' when running tests internally. (GH-30194) 2022-01-22 10:49:38 -08:00
Nikita Sobolev 1f8014c5b4
bpo-46425: fix direct invocation of `test_fileutils` and `test_zoneinfo` (GH-30792) 2022-01-22 18:05:43 +02:00
Nikita Sobolev 57316c52ba
bpo-46425: fix direct invocation of `test_importlib` (GH-30682) 2022-01-22 18:05:05 +02:00
Nikita Sobolev 55f4ec460e
bpo-46425: use absolute imports in `test_sqlite3` (GH-30676) 2022-01-22 18:03:56 +02:00
Nikita Sobolev 101a184d49
bpo-46425: fix direct invocation of `test_traceback` (GH-30746) 2022-01-22 18:03:13 +02:00
Victor Stinner 2d03b73cc9
bpo-46417: remove_subclass() clears tp_subclasses (GH-30793)
The remove_subclass() function now deletes the dictionary when
removing the last subclass (if the dictionary becomes empty) to save
memory: set PyTypeObject.tp_subclasses to NULL. remove_subclass() is
called when a type is deallocated.

_PyType_GetSubclasses() no longer holds a reference to tp_subclasses:
its loop cannot modify tp_subclasses.
2022-01-22 16:53:30 +01:00
Kumar Aditya ea5b96842e
bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)
* bpo-46469: Make asyncio generic classes return GenericAlias

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-01-22 13:28:53 +02:00
Kumar Aditya ab8fe22e5e
fix DeprecationWarning when running asyncio tests (GH-30486) 2022-01-22 13:20:10 +02:00
Nikita Sobolev 5a5340044c
bpo-46425: fix direct invocation of `asyncio` tests (#30725) 2022-01-22 13:06:27 +02:00
Yellow Dusk 82c53229e1
bpo-46442: improve and rename testExceptionCleanupNames (GH-30758)
The test tested that explicitly deleting the local variable bound to the exception
did not cause problems, but it did not test what it actually claimed to test, i.e.
that the variable is deleted automatically.
2022-01-22 02:09:34 -05:00
Nikita Sobolev 65b88d5e01
bpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719) 2022-01-21 13:38:23 -08:00
Weipeng Hong 881a763cfe
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' (GH-30285) 2022-01-21 13:24:33 -08:00
Tom Sparrow 60705cff70
bpo-46434: Handle missing docstrings in pdb help (GH-30705) 2022-01-21 17:00:48 +00:00
Serhiy Storchaka 54610bb448
bpo-46426: Improve tests for the dir_fd argument (GH-30668)
Ensure that directory file descriptors refer to directories different
from the current directory, and that src_dir_fd and dst_dir_fd refer
to different directories.

Add context manager open_dir_fd() in test.support.os_helper.
2022-01-21 09:54:50 +02:00
andrei kulakov cfadcc31ea
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283) 2022-01-21 09:40:32 +02:00
Nikita Sobolev 22f73bd9f1
bpo-46425: Fix direct invocation of `test_contextlib` (GH-30681) 2022-01-21 09:36:19 +02:00
Victor Stinner 1781d55eb3
bpo-46417: _curses uses PyStructSequence_NewType() (GH-30736)
The _curses module now creates its ncurses_version type as a heap
type using PyStructSequence_NewType(), rather than using a static
type.

* Move _PyStructSequence_FiniType() definition to pycore_structseq.h.
* test.pythoninfo: log curses.ncurses_version.
2022-01-21 03:30:20 +01:00
Victor Stinner 6415e2ee49
bpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)
* _testembed_Py_Initialize() now uses the PyConfig API, rather than
  deprecated Py_SetProgramName().
* Reduce INIT_LOOPS from 16 to 4: test_embed now takes 8.7 seconds
  rather than 14.7 seconds.
2022-01-21 02:12:18 +01:00
Victor Stinner e9e3eab0b8
bpo-46417: Finalize structseq types at exit (GH-30645)
Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc()
functions to finalize a structseq static type in Py_Finalize().
Currrently, these functions do nothing if Python is built in release
mode.

Clear static types:

* AsyncGenHooksType: sys.set_asyncgen_hooks()
* FlagsType: sys.flags
* FloatInfoType: sys.float_info
* Hash_InfoType: sys.hash_info
* Int_InfoType: sys.int_info
* ThreadInfoType: sys.thread_info
* UnraisableHookArgsType: sys.unraisablehook
* VersionInfoType: sys.version
* WindowsVersionType: sys.getwindowsversion()
2022-01-21 01:42:25 +01:00
Felix Fontein 9e87c0e03f
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
2022-01-21 00:48:48 +02:00
Batuhan Taskaya 30fb6d073d
bpo-46441: Add a boilerplate to test syntax errors in interactive mode (GH-30720) 2022-01-20 23:07:43 +03:00
Christian Heimes c02e860ee7
bpo-40280: Misc fixes for wasm32-emscripten (GH-30722) 2022-01-20 18:56:33 +01:00
Mark Shannon b04dfbbe4b
bpo-46409: Make generators in bytecode (GH-30633)
* Add RETURN_GENERATOR and JUMP_NO_INTERRUPT opcodes.

* Trim frame and generator by word each.

* Minor refactor of frame.c

* Update test.test_sys to account for smaller frames.

* Treat generator functions as normal functions when evaluating and specializing.
2022-01-20 11:46:39 +00:00
Nikita Sobolev 263c0dd160
bpo-46437: remove useless `hasattr` from `test_typing` (#30704) 2022-01-19 13:24:27 -08:00
Nikita Sobolev 0a49148e87
bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-01-19 23:32:25 +08:00
Nikita Sobolev 2792d6d18e
bpo-46416: Allow direct invocation of `Lib/test/test_typing.py` (GH-30641)
Use `__name__`
2022-01-19 22:13:38 +08:00
Victor Stinner a847785b40
bpo-43869: Time Epoch is the same on all platforms (GH-30664) 2022-01-19 11:27:11 +01:00
Ethan Furman 7c0914d35e
bpo-45535: [Enum] include special dunders in dir() (GH-30677)
Include the `__dunders__` in `dir()` that make `Enum` special:

- `__contains__`
- `__getitem__`
- `__iter__`
- `__len__`
- `__members__`
2022-01-18 15:13:13 -08:00
Géry Ogam 16bf9bd157
bpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)
Use common error message for non-string attribute name in the builtin
functions getattr and hasattr.
The special check no longer needed since Python 3.0.
2022-01-18 22:46:26 +02:00
Nikita Sobolev 1292aa6db5
bpo-46425: Fix direct invocation of multiple test modules (GH-30666) 2022-01-18 21:28:18 +02:00
Steve Dower 7407fe4c25
bpo-46028: Calculate base_executable by resolving symlinks in a venv (GH-30144) 2022-01-18 15:46:26 +00:00
Nikita Sobolev 32398294fb
bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663) 2022-01-18 22:43:51 +08:00
Raymond Hettinger 243c31667c
bpo-42161: Hoist the _PyLong_GetOne() call out of the inner loop. (GH-30656) 2022-01-18 00:02:35 -08:00
Irit Katriel a287b31bcb
bpo-46411: Remove unnecessary calls to sys.exc_info() in tests (GH-30638) 2022-01-18 07:05:16 +00:00
Nikita Sobolev 596cf51a4d
bpo-46418: [Enum] simplify `MODULE` declaration in tests (GH-30647) 2022-01-17 12:16:56 -08:00
zq1997 c118c2455c
bpo-46161: Fix bug in starunpack_helper in compile.c (GH-30235) 2022-01-17 17:45:44 +00:00
Ethan Furman 62a6594e66
bpo-40066: [Enum] fix tests (GH-30643)
- skip doctest that changes depending on target system
- skip doctest that only fails on CI
- substitute in values that change depending on target system
2022-01-17 08:52:42 -08:00
Kumar Aditya 83d544b929
bpo-40066: [Enum] skip failing doc test (GH-30637) 2022-01-17 07:18:13 -08:00
Victor Stinner 16901c0482
bpo-44133: Skip PyThread_get_thread_native_id() if not available (GH-30636)
test_capi.test_export_symbols() doesn't check if Python exports the
"PyThread_get_thread_native_id" symbol if the _thread.get_native_id()
function is not available (if the PY_HAVE_THREAD_NATIVE_ID macro is
not defined).
2022-01-17 14:49:20 +01:00
Victor Stinner ad6e640f91
bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631)
Skip test_builtin PTY tests on non-ASCII characters if the readline
module is loaded. The readline module changes input() behavior, but
test_builtin is not intented to test the readline module.

When the readline module is loaded, PyOS_Readline() uses the readline
implementation. In some cases, the Python readline callback
rlhandler() is called by readline with a string without non-ASCII
characters.
2022-01-17 14:00:50 +01:00
Victor Stinner 42a64c03ec
Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" (GH-30632)
This reverts commit acf7403f9b.
2022-01-17 13:58:40 +01:00
Christian Heimes 91e33ac3d0
bpo-40280: Add requires_fork test helper (GH-30622) 2022-01-16 22:52:43 +01:00
Brandt Bucher 5cd9a162cd
bpo-46361: Fix "small" `int` caching (GH-30583) 2022-01-16 16:06:37 +00:00
Nikita Sobolev 09087b8519
bpo-46386: improve `test_typing:test_immutability_by_copy_and_pickle` (GH-30613) 2022-01-16 16:32:11 +09:00
Ethan Furman acf7403f9b
bpo-40066: [Enum] update str() and format() output (GH-30582)
Undo rejected PEP-663 changes:

- restore `repr()` to its 3.10 status
- restore `str()` to its 3.10 status

New changes:

- `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result
- zero-valued flags without a name have a slightly changed repr(), e.g. `repr(Color(0)) == '<Color: 0>'`
- update `dir()` for mixed-in types to return all the methods and attributes of the mixed-in type
- added `_numeric_repr_` to `Flag` to control display of unnamed values
- enums without doc strings have a more comprehensive doc string added
- `ReprEnum` added -- inheriting from this makes it so only `__repr__` is replaced, not `__str__` nor `__format__`; `IntEnum`, `IntFlag`, and `StrEnum` all inherit from `ReprEnum`
2022-01-15 22:41:43 -08:00
Nikita Sobolev 37eab55ac9
bpo-46387: test all pickle protos in `test_field_descriptor` in `test_collections` (GH-30614) 2022-01-15 22:33:28 -06:00
Russel Webber 0a28118324
bpo-46388: Test NotImplemented code path for functools.total_ordering (GH-30616) 2022-01-15 14:15:32 -08:00
Nikita Sobolev e674e48ddc
bpo-46242: [Enum] better error message for extending `Enum` with members (GH-30357) 2022-01-14 14:18:00 -08:00
Nikita Sobolev c5640ef875
bpo-46380: Apply tests to both C and Python version (GH-30606) 2022-01-14 13:13:45 -08:00
neonene 71c0b859ae
bpo-46362: Ensure abspath() tests pass through environment variables to subprocess (GH-30595) 2022-01-14 15:31:15 +00:00
neonene d4e64cd4b0
bpo-46362: Ensure ntpath.abspath() uses the Windows API correctly (GH-30571)
This makes ntpath.abspath()/getpath_abspath() follow normpath(), since some WinAPIs such as PathCchSkipRoot() require backslashed paths.
2022-01-13 23:35:42 +00:00
Victor Stinner 6be848922b
bpo-44133: Link Python executable with object files (GH-30556)
When Python is built without --enable-shared, the "python" program is
now linked to object files, rather than being linked to the Python
library (libpython.a), to make sure that all symbols are exported.
Previously, the linker omitted some symbols like the Py_FrozenMain()
function.

When Python is configured with --without-static-libpython, the Python
static library (libpython.a) is no longer built.

* Check --without-static-libpython earlier in configure.ac
* Add LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variables to Makefile.
* test_capi now ensures that the "Py_FrozenMain" symbol is exported.
2022-01-13 19:24:28 +01:00
Nikita Sobolev f779faccd3
bpo-46358: modernize `test_asyncio` (GH-30562) 2022-01-13 23:28:02 +09:00
Nikita Sobolev 8c49d057bf
bpo-46359: Modernize `test_typing` by removing checks for EOL Python versions (GH-30563)
Also removes unused tests meant for older versions of Python.
2022-01-13 21:09:40 +08:00
Irit Katriel c590b581bb
bpo-46328: Add sys.exception() (GH-30514) 2022-01-13 12:35:58 +00:00
Irit Katriel 9c2ebb906d
bpo-46344: Fix trace bug in else of try and try-star blocks (GH-30544) 2022-01-13 12:34:38 +00:00
Christian Heimes 443b308fee
bpo-40479: Fix hashlib's usedforsecurity for OpenSSL 3.0.0 (GH-30455) 2022-01-13 09:46:38 +01:00
Nikita Sobolev 1de60155d5
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535) 2022-01-12 15:35:44 -08:00
Jelle Zijlstra 0bbf30e2b9
bpo-46342: make @typing.final introspectable (GH-30530)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-01-12 11:38:25 -08:00
Nikita Sobolev e2a9c8ef09
bpo-46348: modernize `test_typing` (GH-30547) 2022-01-12 08:48:10 -08:00
Ben Kehoe dce642f244
bpo-46307: Add string.Template.get_identifiers() method (GH-30493)
Add `string.Template.get_identifiers()` method that returns the identifiers within the template. By default, raises an error if it encounters an invalid identifier (like `substitute()`). The keyword-only argument `raise_on_invalid` can be set to `False` to ignore invalid identifiers (like `safe_substitute()`).

Automerge-Triggered-By: GH:warsaw
2022-01-11 11:15:42 -08:00
Pablo Galindo Salgado cedec19be8
bpo-46339: Fix crash in the parser when computing error text for multi-line f-strings (GH-30529)
Automerge-Triggered-By: GH:pablogsal
2022-01-11 08:30:39 -08:00
Mark Shannon bd04fac7eb
bpo-46331: Do not set line number of instruction storing doc-string. (GH-30518) 2022-01-11 11:28:30 +00:00
Victor Stinner ea1a54506b
bpo-46303: Move fileutils.h private functions to internal C API (GH-30484)
Move almost all private functions of Include/cpython/fileutils.h to
the internal C API Include/internal/pycore_fileutils.h.

Only keep _Py_fopen_obj() in Include/cpython/fileutils.h, since it's
used by _testcapi which must not use the internal C API.

Move EncodeLocaleEx() and DecodeLocaleEx() functions from _testcapi
to _testinternalcapi, since the C API moved to the internal C API.
2022-01-11 11:56:16 +01:00
Sam Gross e13cdca0f5
bpo-46205: exit if no workers are alive in runtest_mp (GH-30470) 2022-01-11 12:03:09 +09:00
Nikita Sobolev 13e4659276
bpo-46327: [Enum] remove skipped tests (GH-30512) 2022-01-10 11:12:34 -08:00
Nikita Sobolev 582286d71c
bpo-46301: [Enum] fix refleak tests (GH30510) 2022-01-10 11:09:00 -08:00
Mark Shannon ec0c392f34
bpo-46314: Remove extra RESUME when compiling a lamdba. (GH-30513) 2022-01-10 12:29:02 +00:00
Serhiy Storchaka 2d787971c6
bpo-37295: Use constant-time comb() and perm() for larger n depending on k (GH-30305) 2022-01-09 15:32:25 +02:00
Nikita Sobolev 8d59d2563b
bpo-46301: [Enum] test uncomparable values in `_convert_` (GH-30472)
add tests that cover different types, and same non-comparable types
2022-01-08 11:43:42 -08:00
Dong-hee Na 45d44b950f
bpo-46299: Improve test_descr (GH-30475) 2022-01-08 17:14:40 +09:00
Nikita Sobolev e63066cfed
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471) 2022-01-08 12:51:51 +09:00
Pablo Galindo Salgado 6fa8b2ceee
bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463) 2022-01-08 00:23:40 +00:00
Daniel c9dc1f491e
bpo-46297: Fix interpreter crash on startup with multiple PythonPaths set in registry (GH-30466) 2022-01-07 22:26:00 +00:00
Nikita Sobolev 74d1663580
bpo-46296: [Enum] add a test for missing `value` recovery (GH-30458)
In `__set_name__` there is a check for the `_value_` attribute and an attempt to add it if missing; this adds a test to cover the case for simple enums with a custom `__new__` method.
2022-01-07 13:44:21 -08:00
andrei kulakov f4e325c21d
bpo-41011: venv -- add more variables to pyvenv.cfg (GH-30382) 2022-01-07 06:50:30 +00:00
Christian Heimes c9137d4b63
bpo-46263: Fix second location that needs MALLOC_CONF on FreeBSD (GH-30440)
Automerge-Triggered-By: GH:tiran
2022-01-06 11:49:03 -08:00
neonene 9c5fa9c97c
bpo-46208: Fix normalization of relative paths in _Py_normpath()/os.path.normpath (GH-30362) 2022-01-06 19:13:10 +00:00
Eric Snow 68c76d9766
bpo-46263: Do not ever expect "use_frozen_modules" to be -1. (gh-30438)
The condition is no longer valid.  This should resolve the buildbot failure on FreeBSD.

https://bugs.python.org/issue46263
2022-01-06 11:56:13 -07:00
Christian Heimes a4aa52dc28
bpo-46263: FreeBSD 14.0 jemalloc workaround for junk bytes of freed memory (GH-30434)
Automerge-Triggered-By: GH:tiran
2022-01-06 07:14:49 -08:00
Mark Shannon e028ae99ec
bpo-45923: Handle call events in bytecode (GH-30364)
* Add a RESUME instruction to handle "call" events.
2022-01-06 13:09:25 +00:00
Nikita Sobolev e5894ca8fd
bpo-46266: Add calendar day of week constants to __all__ (GH-30412) 2022-01-05 14:21:04 -06:00
Brandt Bucher 332e6b9725
bpo-45256: Don't track the exact depth of each `InterpreterFrame` (GH-30372) 2022-01-05 11:30:26 +00:00
Nikita Sobolev 91bc6f9615
bpo-46262: [Enum] test error path in `Flag._missing_` (GH-30408)
add tests that exercise the `_missing_` error path for `Flag` and `IntFlag`

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-01-04 16:11:06 -08:00
Kumar Aditya 7d7817cf0f
bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
* bpo-20369: concurrent.futures.wait() now deduplicates futures given as arg.

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-01-04 13:36:13 +00:00
Pablo Galindo Salgado 70f415fb8b
bpo-46240: Correct the error for unclosed parentheses when the tokenizer is not finished (GH-30378) 2022-01-04 10:41:22 +00:00
Irit Katriel a94461d718
bpo-46202: Remove opcode POP_EXCEPT_AND_RERAISE (GH-30302)
* bpo-46202: remove opcode POP_EXCEPT_AND_RERAISE

* do not assume that an exception group is truthy
2022-01-04 10:37:12 +00:00
Tim Peters 3aa5242b54
bpo-46233: Minor speedup for bigint squaring (GH-30345)
x_mul()'s squaring code can do some redundant and/or useless
work at the end of each digit pass. A more careful analysis
of worst-case carries at various digit positions allows
making that code leaner.
2022-01-03 20:41:16 -06:00
Pablo Galindo Salgado dd6c35761a
bpo-46110: Restore commit e9898bf153
This restores commit e9898bf153 .
2022-01-03 19:54:06 +00:00
Erlend Egeberg Aasland 9d6a239a34
bpo-44092: Don't reset statements/cursors before rollback (GH-26026)
In SQLite versions pre 3.7.11, pending statements would block a rollback.  This is no longer the case, so remove the workaround.
2022-01-03 19:02:39 +00:00
Pablo Galindo Salgado 9d35dedc5e
Revert "bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser (GH-30177)" (GH-30363)
This reverts commit e9898bf153 temporarily as we want to confirm if this commit is the cause of a slowdown at startup time.
2022-01-03 18:29:18 +00:00
Irit Katriel 65e7c1f90e
bpo-46219, 46221: simplify except* implementation following exc_info changes. Move helpers to exceptions.c. Do not assume that exception groups are truthy. (GH-30289) 2022-01-02 23:22:42 +00:00
Tim Peters 863729e9c6
bpo-46218: Change long_pow() to sliding window algorithm (GH-30319)
* bpo-46218: Change long_pow() to sliding window algorithm

The primary motivation is to eliminate long_pow's reliance on that the number of bits in a long "digit" is a multiple of 5. Now it no longer cares how many bits are in a digit.

But the sliding window approach also allows cutting the precomputed table of small powers in half, which reduces initialization overhead enough that the approach pays off for smaller exponents too. Depending on exponent bit patterns, a sliding window may also be able to save some bigint multiplies (sometimes when at least 5 consecutive exponent bits are 0, regardless of their starting bit position modulo 5).

Note: boosting the window width to 6 didn't work well overall. It give marginal speed improvements for huge exponents, but the increased overhead (the small-power table needs twice as many entries) made it a loss for smaller exponents.

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2022-01-02 13:18:20 -06:00
Irit Katriel a82baed0e9
bpo-45615: Add missing test for printing traceback for non-exception. Fix traceback.py (GH-30091) 2022-01-02 09:34:03 +00:00
Jason R. Coombs e712a5b277
bpo-46118: Move importlib.resources to its own package. (#30176)
* bpo-46118: Move importlib.resources to its own package.

* Expand compatibility shims with documentation and explicit imports.
2021-12-30 21:00:48 -05:00
Hugo van Kemenade 2cf7d02b99
bpo-46178: Remove/rename redundant Travis CI code (#30309) 2021-12-30 16:16:27 -08:00
Nikita Sobolev d12bec6993
bpo-43424: Deprecate `webbrowser.MacOSXOSAScript._name` attribute (GH-30241) 2021-12-30 10:30:13 +09:00
Xinhang Xu 3581c7abbe
bpo-46055: Speed up binary shifting operators (GH-30044)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2021-12-27 18:36:55 +00:00
Serhiy Storchaka ad4857884b
bpo-43413: Revert changes in set.__init__ (GH-28403)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-12-26 13:27:01 +02:00
Kumar Aditya a23ab7b6d8
bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) 2021-12-26 13:13:14 +02:00
Serhiy Storchaka 078abb676c
bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050)
The registry() method of functools.singledispatch() functions checks now
the first argument or the first parameter annotation and raises a TypeError if it is
not supported. Previously unsupported "types" were ignored (e.g. typing.List[int])
or caused an error at calling time (e.g. list[int]).
2021-12-25 14:16:14 +02:00