Commit Graph

48277 Commits

Author SHA1 Message Date
Jouke Witteveen c12ba6b2ff
bpo-45171: Remove tests of deprecated logger.warn(). (GH-32139) 2022-03-27 19:22:05 +01:00
Jouke Witteveen 5ca6d7469b
bpo-45171: Fix stacklevel handling in logging. (GH-28287) 2022-03-27 14:49:28 +01:00
Matthew Rahtz e8e737bcf6
bpo-43224: Implement PEP 646 grammar changes (GH-31018)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 09:55:35 -07:00
Andrew Svetlov bad6ffaa64
bpo-47062: Rename factory argument to loop_factory (GH-32113) 2022-03-26 00:26:23 +02:00
Duprat d03acd7270
bpo-43352: Add a Barrier object in asyncio lib (GH-24903)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-26 00:01:21 +02:00
Andrew Svetlov 20e6e5636a
bpo-47118: Fix asyncio.Runner tests error (32117) 2022-03-25 19:59:29 +02:00
Andrew Svetlov 4119d2d7c9
bpo-47062: Implement asyncio.Runner context manager (GH-31799)
Co-authored-by: Zachary Ware <zach@python.org>
2022-03-24 21:51:16 +02:00
Shantanu 3354245daf
bpo-46480: rephrase typing.assert_type docs (GH-32069)
The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.

The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
2022-03-23 19:15:06 -07:00
Andrew Svetlov ff619c7dfe
bpo-47104: Rewrite asyncio.to_thread tests to use IsolatedAsyncioTestCase (GH-32086) 2022-03-23 23:17:07 +02:00
Christian Heimes 48e2010d92
bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076) 2022-03-23 13:30:05 -07:00
Andrew Svetlov 0360e9f346
bpo-46829: Deprecate passing a message into Future.cancel() and Task.cancel() (GH-31840)
After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
2022-03-23 08:43:05 -07:00
Daniël van Noord 7ba7eae508
bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932)
Co-authored-by: Piet Delport
Co-authored-by: Hugo Lopes Tavares
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-22 14:01:15 -07:00
Christian Heimes e03db6d5be
bpo-45150: Fix testing under FIPS mode (GH-32046) 2022-03-22 16:40:43 +01:00
Serhiy Storchaka 492d4109f4
bpo-42885: Optimize search for regular expressions starting with "\A" or "^" (GH-32021)
Affected functions are re.search(), re.split(), re.findall(), re.finditer()
and re.sub().
2022-03-22 17:27:55 +02:00
Andrew Svetlov 32e77154dd
bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-22 16:02:51 +02:00
Andrew Svetlov 673755bfba
bpo-47076: Make asyncio.Queue stable on slow test boxes (GH-32040) 2022-03-22 16:00:23 +02:00
Jeremy Kloth 88872a29f1
bpo-47084: Clear Unicode cached representations on finalization (GH-32032) 2022-03-22 13:53:51 +01:00
Pablo Galindo Salgado 7d810b6a4e
bpo-46838: Syntax error improvements for function definitions (GH-31590) 2022-03-22 11:38:41 +00:00
Christian Heimes deeaac49e2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests
- Skip extension import tests if dlopen is not available
- Don't assume that _testcapi is a shared extension
- Skip a lot of socket tests that don't work on Emscripten
- Skip mmap tests, mmap emulation is incomplete
- venv does not work yet
- Cannot get libc from executable

The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
2022-03-22 03:04:36 -07:00
Serhiy Storchaka a25a985535
bpo-28080: Add support for the fallback encoding in ZIP files (GH-32007)
* Add the metadata_encoding parameter in the zipfile.ZipFile constructor.
* Add the --metadata-encoding option in the zipfile CLI.

Co-authored-by: Stephen J. Turnbull <stephen@xemacs.org>
2022-03-22 11:52:55 +02:00
Serhiy Storchaka c6cd3cc93c
bpo-47081: Replace "qualifiers" with "quantifiers" in the re module documentation (GH-32028)
It is a more commonly used term.
2022-03-22 11:44:47 +02:00
Christian Heimes 4f97d64c83
bpo-45150: Add hashlib.file_digest() for efficient file hashing (GH-31930) 2022-03-22 02:37:00 -07:00
Jeremy Kloth 19058b9f62
bpo-44336: Prevent tests hanging on child process handles on Windows (GH-26578)
Replace the child process `typeperf.exe` with a daemon thread that reads the performance counters directly.  This prevents the issues that arise from inherited handles in grandchild processes (see issue37531 for discussion).

We only use the load tracker when running tests in multiprocess mode. This prevents inadvertent interactions with tests expecting a single threaded environment.  Displaying load is really only helpful for buildbots running in multiprocess mode anyway.
2022-03-22 00:06:55 +00:00
Tim Peters 5c3201e146
bpo-47080: Use atomic groups to simplify fnmatch (GH-32029)
Use re's new atomic groups to greatly simplify the construction of worst-case linear-time patterns.
2022-03-21 12:49:43 -05:00
Serhiy Storchaka 345b390ed6
bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)
* Atomic grouping: (?>...).
* Possessive quantifiers: x++, x*+, x?+, x{m,n}+.
  Equivalent to (?>x+), (?>x*), (?>x?), (?>x{m,n}).

Co-authored-by: Jeffrey C. Jacobs <timehorse@users.sourceforge.net>
2022-03-21 18:28:22 +02:00
Brandt Bucher 2bde6827ea
bpo-46841: Quicken code in-place (GH-31888)
* Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place.

* Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches

* _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms.

* _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches

* _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup

* _Py_Quicken is renamed to _PyCode_Quicken

* _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview).

* Do not emit unused nonzero opargs anymore in the compiler.
2022-03-21 11:11:17 +00:00
Gregory P. Smith 9d1c4d69db
bpo-38256: Fix binascii.crc32() when inputs are 4+GiB (GH-32000)
When compiled with `USE_ZLIB_CRC32` defined (`configure` sets this on POSIX systems), `binascii.crc32(...)` failed to compute the correct value when the input data was >= 4GiB. Because the zlib crc32 API is limited to a 32-bit length.

This lines it up with the `zlib.crc32(...)` implementation that doesn't have that flaw.

**Performance:** This also adopts the same GIL releasing for larger inputs logic that `zlib.crc32` has, and causes the Windows build to always use zlib's crc32 instead of our slow C code as zlib is a required build dependency on Windows.
2022-03-20 12:28:15 -07:00
Oleg Iarygin 3ae975f1ac
bpo-47015: Update test_os from asyncore to asyncio (GH-31876) 2022-03-20 16:39:12 +02:00
Kevin Mehall e730ae7eff
bpo-42369: Fix thread safety of zipfile._SharedFile.tell (GH-26974)
The `_SharedFile` tracks its own virtual position into the file as
`self._pos` and updates it after reading or seeking. `tell()` should
return this position instead of calling into the underlying file object,
since if multiple `_SharedFile` instances are being used concurrently on
the same file, another one may have moved the real file position.
Additionally, calling into the underlying `tell` may expose thread
safety issues in the underlying file object because it was called
without taking the lock.
2022-03-20 16:26:09 +02:00
Arie Bovenberg 82e9b0bb0a
bpo-46382 dataclass(slots=True) now takes inherited slots into account (GH-31980)
Do not include any members in __slots__ that are already in a base class's __slots__.
2022-03-19 17:01:17 -04:00
Serhiy Storchaka 383a3bec74
bpo-46996: IDLE: Drop workarounds for old Tk versions (GH-31962) 2022-03-19 17:14:21 +02:00
Serhiy Storchaka 92a6abf72e
bpo-47066: Convert a warning about flags not at the start of the regular expression into error (GH-31994) 2022-03-19 16:10:44 +02:00
Serhiy Storchaka 4142961b9f
bpo-39394: Improve warning message in the re module (GH-31988)
A warning about inline flags not at the start of the regular
expression now contains the position of the flag.
2022-03-19 14:13:31 +02:00
Hugo van Kemenade 7747384643
bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891)
Document the deprecation of asyncore, asynchat, and smtpd with a slated removal in Python 3.12 thanks to PEP 594.
2022-03-18 12:45:37 -07:00
Jelle Zijlstra 3a2b89580d
bpo-43224: Add TypeVarTuple.__name__ (GH-31954)
I noticed that TypeVar and ParamSpec put their name in a __name__
attribute, but TypeVarTuple doesn't. Let's be consistent.
2022-03-18 10:56:36 -07:00
Christian Heimes d190a9351b
bpo-47037: Don't test for strftime('%4Y') on Windows (GH-31945) 2022-03-18 11:27:20 +00:00
Miro Hrončok 48d9262699
bpo-45413: Define "posix_venv", "nt_venv" and "venv" sysconfig installation schemes (GH-31034)
Define *posix_venv* and *nt_venv* sysconfig installation schemes
to be used for bootstrapping new virtual environments.
Add *venv* sysconfig installation scheme to get the appropriate one of the above.
The schemes are identical to the pre-existing
*posix_prefix* and *nt* install schemes.
The venv module now uses the *venv* scheme to create new virtual environments
instead of hardcoding the paths depending only on the platform. Downstream
Python distributors customizing the *posix_prefix* or *nt* install
scheme in a way that is not compatible with the install scheme used in
virtual environments are encouraged not to customize the *venv* schemes.
When Python itself runs in a virtual environment,
sysconfig.get_default_scheme and
sysconfig.get_preferred_scheme with `key="prefix"` returns
*venv*.
2022-03-18 10:53:29 +01:00
Serhiy Storchaka cd44afc573
bpo-40296: Fix supporting generic aliases in pydoc (GH-30253) 2022-03-18 11:05:18 +02:00
Bader Zaidan a0db11b10f
bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654) 2022-03-17 16:37:52 -07:00
Andrew Svetlov 903f0a02c1
bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-03-17 22:51:40 +02:00
Serhiy Storchaka a5d246066b
bpo-47042: Fix testing the HTML output in test_pydoc (GH-31959)
Previously it tested that that the actual output contains every non-whitespace
character from the expected output (ignoring order and repetitions).

Now it will test that the actual output contains the same lines as the expected
output, in the same order, ignoring indentation and empty lines.
2022-03-17 18:32:53 +02:00
Mark Shannon 3011a097bd
Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an additional NULL. (GH-31933) 2022-03-17 16:14:57 +00:00
Christian Heimes ef1327e3b6
bpo-40280: Skip more tests on Emscripten (GH-31947)
- lchmod, lchown are not fully implemented
- skip umask tests
- cannot fstat unlinked or renamed files yet
- ignore musl libc issues that affect Emscripten
2022-03-17 12:09:57 +01:00
Serhiy Storchaka c2e3c06139
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839) 2022-03-17 13:05:52 +02:00
Inada Naoki 7aeb06f78e
Do not run test_gdb when gdb embeds Python 2. (GH-31956) 2022-03-17 18:00:56 +09:00
Serhiy Storchaka 15df8f8d89
bpo-46981: Remove typing._TypingEmpty (GH-31836)
* get_args(Tuple[()]) now returns () instead of ((),).
* Tuple[Unpack[Ts]][()] now returns the result equal to Tuple[()].
2022-03-17 09:52:24 +02:00
Erlend Egeberg Aasland 4674fd4e93
bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)
* Improve exception compliance with PEP 249
* Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE.
  If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the
  sqlite3 module are not responsible for using the SQLite C API correctly.
* Don't overwrite BufferError with ValueError when conversion to BLOB fails.
* Raise ProgrammingError instead of Warning if user tries to execute() more
  than one SQL statement.
* Raise ProgrammingError instead of ValueError if an SQL query contains null characters.
* Make sure `_pysqlite_set_result` raises an exception if it returns -1.
2022-03-16 22:58:25 -07:00
Jelle Zijlstra 96568e995d
bpo-46480: add typing.assert_type (GH-30843)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: David Foster <david@dafoster.net>
2022-03-16 20:02:26 -07:00
Carlos Damazio 7c353b7594
bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-16 19:41:02 -07:00
Andrew Svetlov 30b5d41fab
bpo-47039: Normalize repr() of asyncio future and task objects (GH-31950) 2022-03-17 03:03:09 +02:00