Commit Graph

47713 Commits

Author SHA1 Message Date
Pablo Galindo 350e7a25d6 Python 3.11.0a1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmFcSLIACgkQ/+h0BBaL
 2Edt+A//euGR2lSeASHsLMeFwZkhMGOHHPZKmCcUP7CyQC6zfvajVnEORcsRhMI1
 dD1jLMv/PsednzYV+nBBdSVGCGnnAX3O5u2eB+W7cG4xvt78ok/DX5lYXJrnyAfy
 YzWv74zWR/W8HJYy7LQfrhvqfJHK/c5ar/Jk6+t7c9LqZrlkPM2rEpAWWILASQuX
 2eR/A+9TifqIPtZN5c67OObtm190ScYWUID5HjqROcEjiOh9Y9tASk0VpyDtfIHP
 imJro+JGsV3WOlRpVkfAvyC0L8LrEjVxyFyBok8+fWJQ0yjjepC+EkLGX3DKWutz
 LgS5Wx/onnCT5dDlIcda9GVuDnEbr8WvAHWwwu0nJhmZ2XzXRNMzRf8lxw9hH09X
 mvmKS+nzx12pDZs5IAdWNUyWFJx1pPLNOqRa3heTIC/yB9+rHvY3WfGYkpD+r7FJ
 JAbD/LiWfVTRnl3HIyoNCyIOHxSZaYlAN9qJeapEFoFdYCLWByQsCiMoUH+W8zKE
 kpF7yl2RaSUFIZ7b6VJ0tDk2QDTWYPHYh37zii4OtfHgY1AkqbiWA1FTfNW3ZiX0
 1QHpB89feB4TdnFP7c+piEQxHxxJnhGCfb3bpEHdofDJVpMn+pz9DRXEpWTkPhBK
 JK7z5eVBzxYfACbb/IULc79Bsnp/5P2ZQiXMNpb+/W2wwjqjOdw=
 =RF/t
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmFchnQACgkQ/+h0BBaL
 2Eekgg/+LEvtmrE0O8VgzG/+4EiMWk6AWSc0h9ZIuY+qDLSMTjJBnsG9nl7fl7Gb
 LzeDeQSWglnNsut/K63XVniADFZ4nqU9L1c9KF//4jfS8xqOv9m2GNe4ESbV4JlG
 hVP6dmKjsl1BM0rgAEF4V2lCslxwI5rGkHL7MUuST+G4yyRfo7jARw9nAOHz9OIo
 fr+S1rry2KPexUTxRFvQ+5dzV01o8ylkleIIZZIQ1Z186LvrDi7YgNqBAdi3bECc
 U+PuLvLEx1SzuuzJQNkstfGHS9Mabu5UvvGj2fZmvGhgOqxFdEtT6/QmHdFEJlnk
 65T5xT6QUE6NlRyzbb044Rs0czCs8tpVZL+LrAhJnnKxufqKUZVOxWwzMkGTG3Ia
 4SUeMr+70+Qs4Uwe3xYqfLvym4AnBDGKgHQaMiEe7gpmqQUgfKIBBORjMBezNiOQ
 DI+fAi+w4+T+aGEhSSjdgyj9NqpSkYjrP1ODpb1I7kKJfronVufUwp1afJoKaLBR
 bLAQKNIAop08zuMY7N7l1hATqpiaFyGlFU4rjH0dNEaQzaGSVqyEOpWanhqOsMPV
 l1AoTMUtJxdM1y/T1WxdKbaN/XoZYznFZbQrCDsPzAXhWHx+1thJBN7BGdCi/Krm
 2f7Kk//8uLj+BuHowMzOzArNvAfCiFPJypPhUktCFU++GvEWnjY=
 =hwKX
 -----END PGP SIGNATURE-----

Merge tag 'v3.11.0a1'

Python 3.11.0a1
2021-10-05 18:07:59 +01:00
Eric Snow 69f6dabb9c
Rearrage the finder tests. (gh-28740)
This makes the tests a bit cleaner and makes adding more tests a little simpler.

https://bugs.python.org/issue45324
2021-10-05 10:37:14 -06:00
Eric Snow c3d9ac8b34
bpo-45324: Capture data in FrozenImporter.find_spec() to use in exec_module(). (gh-28633)
Before this change we end up duplicating effort and throwing away data in FrozenImporter.find_spec().  Now we do the work once in find_spec() and the only thing we do in FrozenImporter.exec_module() is turn the raw frozen data into a code object and then exec it.

We've added _imp.find_frozen(), add an arg to _imp.get_frozen_object(), and updated FrozenImporter.  We've also moved some code around to reduce duplication, get a little more consistency in outcomes, and be more efficient.

Note that this change is mostly necessary if we want to set __file__ on frozen stdlib modules. (See https://bugs.python.org/issue21736.)

https://bugs.python.org/issue45324
2021-10-05 10:01:27 -06:00
Hai Shi b9bb74871b
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794)
Automerge-Triggered-By: GH:encukou
2021-10-05 06:19:32 -07:00
Pablo Galindo 7c12e4835e
Python 3.11.0a1 2021-10-05 13:44:05 +01:00
Jeremy Kloth de4052fe06
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712) 2021-10-05 13:17:13 +01:00
Christian Heimes ef6196028f
bpo-45371: Fix distutils' rpath support for clang (GH-28732)
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-05 02:43:46 -07:00
John Belmonte e6d1aa1ac6
bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089)
* bpo-44594: fix (Async)ExitStack handling of __context__

Make enter_context(foo()) / enter_async_context(foo()) equivalent to
`[async] with foo()` regarding __context__ when an exception is raised.

Previously exceptions would be caught and re-raised with the wrong
context when explicitly overriding __context__ with None.
2021-10-03 23:49:55 -07:00
Serhiy Storchaka a5a56154f1
Remove trailing spaces. (GH-28706) 2021-10-03 16:58:14 +03:00
Raymond Hettinger db91b058d5
bpo-45346: Keep docs consistent regarding true and false values (GH-28697) 2021-10-02 13:48:08 -05:00
Nikita Sobolev 746d648d47
bpo-45125: Improves pickling docs and tests for `shared_memory` (GH-28294) 2021-10-01 13:45:59 +03:00
Serhiy Storchaka 2f20592012
Revert "Revert "bpo-45229: Make datetime tests discoverable (GH-28615)" (GH-28650)" (GH-28667)
This reverts commit b07fddd527.
2021-10-01 10:57:58 +03:00
Serhiy Storchaka eb4495e8e2
bpo-45310: Fix parrallel shared memory tests (GH-28661)
Add a PID to names of POSIX shared memory objects to allow
running multiprocessing tests (test_multiprocessing_fork,
test_multiprocessing_spawn, etc) in parallel.
2021-10-01 10:56:32 +03:00
Eric Snow 7e5c107541
bpo-45020: Add more test cases for frozen modules. (gh-28664)
I've added a number of test-only modules. Some of those cases are covered by the recently frozen stdlib modules (and some will be once we add encodings back in). However, I figured we'd play it safe by having a set of modules guaranteed to be there during tests.

https://bugs.python.org/issue45020
2021-09-30 18:38:52 -06:00
Serhiy Storchaka ec4d917a6a
bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654)
* Work correctly if an additional fresh module imports other
  additional fresh module which imports a blocked module.
* Raises ImportError if the specified module cannot be imported
  while all additional fresh modules are successfully imported.
* Support blocking packages.
* Always restore the import state of fresh and blocked modules
  and their submodules.
* Fix test_decimal and test_xml_etree which depended on an undesired
  side effect of import_fresh_module().
2021-09-30 19:20:39 +03:00
Pablo Galindo Salgado b07fddd527
Revert "bpo-45229: Make datetime tests discoverable (GH-28615)" (GH-28650)
This reverts commit d441437ee7.
2021-09-30 14:46:26 +01:00
Victor Stinner 09796f2f14
bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629)
Add the _PyTime_AsTimespec_clamp() function: similar to
_PyTime_AsTimespec(), but clamp to _PyTime_t min/max and don't raise
an exception.

PyThread_acquire_lock_timed() now uses _PyTime_AsTimespec_clamp() to
remove the Py_UNREACHABLE() code path.

* Add _PyTime_AsTime_t() function.
* Add PY_TIME_T_MIN and PY_TIME_T_MAX constants.
* Replace _PyTime_AsTimeval_noraise() with _PyTime_AsTimeval_clamp().
* Add pytime_divide_round_up() function.
* Fix integer overflow in pytime_divide().
* Add pytime_divmod() function.
2021-09-30 02:11:41 +02:00
Serhiy Storchaka d441437ee7
bpo-45229: Make datetime tests discoverable (GH-28615) 2021-09-29 23:27:57 +03:00
Łukasz Langa f1ca5d7f61
[typo] Fix threading.Barrier comment that used confusing punctuation (GH-28623)
Removed extra comma in comment that indicates state of a `Barrier` as it was confusing and breaking the flow while reading.

Co-authored-by: Priyank <5903604+cpriyank@users.noreply.github.com>
2021-09-29 16:11:26 +02:00
Serhiy Storchaka eed32df5b6
bpo-24391: Better reprs for threading objects. (GH-20534)
Add reprs for Semaphore, BoundedSemaphore, Event, and Barrier.
2021-09-29 13:07:58 +03:00
Jack DeVries b6fe857250
bpo-39039: tarfile raises descriptive exception from zlib.error (GH-27766)
* during tarfile parsing, a zlib error indicates invalid data
* tarfile.open now raises a descriptive exception from the zlib error
* this makes it clear to the user that they may be trying to open a
  corrupted tar file
2021-09-29 11:25:48 +02:00
Nikita Sobolev e046aabbe3
bpo-45269: test wrong `markers` type to `c_make_encoder` (GH-28540) 2021-09-28 23:18:00 +02:00
Eric Snow 0c50b8c0b8
bpo-45211: Remember the stdlib dir during startup. (gh-28586)
During runtime startup we figure out the stdlib dir but currently throw that information away. This change preserves it and exposes it via PyConfig.stdlib_dir, _Py_GetStdlibDir(), and sys._stdlib_dir.

https://bugs.python.org/issue45211
2021-09-28 12:18:28 -06:00
Pablo Galindo Salgado 84975146a7
bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595) 2021-09-28 13:32:43 +01:00
Terry Jan Reedy e649e0658f
bpo-45296: Fix exit/quit message on Windows (GH-28577)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z.
2021-09-28 14:05:56 +02:00
Victor Stinner 95d3137082
bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549)
Fix the threading._shutdown() function when the threading module was
imported first from a thread different than the main thread: no
longer log an error at Python exit.
2021-09-27 23:09:00 +02:00
Pablo Galindo Salgado 20f439b6b9
bpo-45249: Ensure the traceback module prints correctly syntax errors with ranges (GH-28575) 2021-09-27 21:59:06 +01:00
Eric Snow ae7839bbe8
bpo-45211: Move helpers from getpath.c to internal API. (gh-28550)
This accomplishes 2 things:

* consolidates some common code between getpath.c and getpathp.c
* makes the helpers available to code in other files

FWIW, the signature of the join_relfile() function (in fileutils.c) intentionally mirrors that of Windows' PathCchCombineEx().

Note that this change is mostly moving code around. No behavior is meant to change.

https://bugs.python.org/issue45211
2021-09-27 10:00:32 -06:00
Pablo Galindo Salgado e5f13ce5b4
bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator expression in function calls (GH-28576) 2021-09-27 14:37:43 +01:00
Victor Stinner a22be4943c
bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532)
Fix a race condition in the Thread.join() method of the threading
module. If the function is interrupted by a signal and the signal
handler raises an exception, make sure that the thread remains in a
consistent state to prevent a deadlock.
2021-09-27 14:20:31 +02:00
Nikita Sobolev f56268a2cd
bpo-45280: Add test for empty `NamedTuple` in `test_typing` (GH-28559)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2021-09-26 18:32:18 +02:00
Nikita Sobolev 784905dbef
bpo-45166: fixes `get_type_hints` failure on `Final` (GH-28279)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-09-25 10:56:22 +02:00
Antony Lee 6587fc60d4
bpo-44019: Implement operator.call(). (GH-27888)
Having `operator.call(obj, arg)` mean `type(obj).__call__(obj, arg)` is
consistent with the other dunder operators.  The semantics with `*args,
**kwargs` then follow naturally from the single-arg semantics.
2021-09-24 16:22:49 +01:00
Nikita Sobolev 8d8729146f
bpo-20524: adds better error message for `.format()` (GH-28310)
It now lists the bad format_spec and the type of the object.
2021-09-24 11:18:04 -04:00
Alex Vig 3f8b23f8dd
bpo-30951: Correct co_names docstring in inspect module (GH-2743) 2021-09-24 12:05:34 +02:00
Daniel Hillier 91099e2544
bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception (GH-18031) 2021-09-23 23:37:53 +02:00
Jason Fried 86b833badd
bpo-38415: Allow using @asynccontextmanager-made ctx managers as decorators (GH-16667) 2021-09-23 23:36:03 +02:00
Alexander Böhn 8c21941dda
bpo-39549: reprlib.Repr uses a “fillvalue” attribute (GH-18343) 2021-09-22 15:45:58 -05:00
Serhiy Storchaka ecb6922ff2
bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449)
It runs now asynchronous methods and callbacks.

If it fails, doCleanups() can be called for cleaning up.
2021-09-22 17:43:23 +02:00
Mohamad Mansour 8f943ca257
[codemod] Fix non-matching bracket pairs (GH-28473)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-22 01:09:00 +02:00
andrei kulakov a007347100
[tests] Add missing assert against expected tracebacks in test_exceptions.py (GH-28484) 2021-09-22 00:06:13 +02:00
andrei kulakov b7eac52b46
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421)
This was a regression from fixing BPO-43219.
2021-09-21 23:53:07 +02:00
Nikita Sobolev 06e1773c8d
bpo-45216: Remove extraneous method docs from `difflib` (GH-28445) 2021-09-21 23:31:12 +02:00
Nikita Sobolev f604cf1c37
bpo-45209: fix `UserWarning: resource_tracker` in test_multiprocessing (GH-28377) 2021-09-21 19:49:42 +02:00
Erlend Egeberg Aasland 3e3ff09058
bpo-44958: Fix ref. leak introduced in GH-27844 (GH-28490)
Modify managed_connect() helper to support in-memory databases. Use it
for the regression tests added in GH-27844.

Automerge-Triggered-By: GH:pablogsal
2021-09-21 06:15:54 -07:00
Erlend Egeberg Aasland 050d103595
bpo-44958: Only reset `sqlite3` statements when needed (GH-27844) 2021-09-21 12:20:34 +01:00
nullptr 0bfa1106ac
bpo-45021: Fix a hang in forked children (GH-28007)
_global_shutdown_lock should be reinitialized in forked children
2021-09-20 11:30:19 -07:00
Raymond Hettinger 9510e6f3c7
bpo-45155: Apply new byteorder default values for int.to/from_bytes (GH-28465) 2021-09-20 13:22:55 -05:00
Serhiy Storchaka e6ba992288
bpo-45229: Make pickle tests discoverable (GH-28467) 2021-09-20 18:21:33 +03:00
Rémi Lapeyre 4d2957c1b9
bpo-40497: Fix handling of check in subprocess.check_output() (GH-19897)
Co-authored-by: Tal Einat <taleinat@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-20 17:09:05 +02:00
Serhiy Storchaka a856364cc9
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
Alo use load_tests() for adding tests.
2021-09-20 11:36:57 +03:00
Victor Stinner 5e2c32e08e
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466)
Calling Py_InitializeFromConfig()+Py_RunMain() multiple times must
not crash.

Cleanup also test_get_argc_argv().
2021-09-20 10:30:02 +02:00
Raymond Hettinger fcbf9b176b
Docs: Clarify the before_and_after() example (GH-28458) 2021-09-19 19:52:27 -05:00
Nikita Sobolev 1d42408495
bpo-45128: fixes `test_multiprocessing_fork` mysterious crash (GH-28387) 2021-09-19 23:50:04 +01:00
Serhiy Storchaka a624177386
bpo-45229: Fix setUpModule in test_ssl (GH-28454) 2021-09-19 16:18:16 +03:00
Serhiy Storchaka 40348acc18
bpo-45229: Remove test_main in many tests (GH-28405)
Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.

load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests.
2021-09-19 15:27:33 +03:00
Serhiy Storchaka 664448d81f
bpo-30856: Update TestResult early, without buffering in _Outcome (GH-28180)
TestResult methods addFailure(), addError(), addSkip() and
addSubTest() are now called immediately after raising an exception
in test or finishing a subtest.  Previously they were called only
after finishing the test clean up.
2021-09-19 15:24:38 +03:00
Serhiy Storchaka dea59cf88a
bpo-36674: Honour the skipping decorators in TestCase.debug() (GH-28446)
unittest.TestCase.debug() raises now a SkipTest if the class or
the test method are decorated with the skipping decorator.

Previously it only raised a SkipTest if the test method was decorated
with other decorator in addition to the skipping decorator, or
if SkipTest was explicitly raised in the test or setup methods.
2021-09-18 15:34:22 +03:00
Adam Schwalm a6e8db5e8e
bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) 2021-09-17 23:20:31 -05:00
Brett Cannon 209b7035f7
bpo-45183: don't raise an exception when calling zipimport.zipimporter.find_spec() when the zip file is missing and the internal cache has been reset (GH-28435)
This can occur when the zip file gets deleted, you call zipimport.zipimporter.invalidate_cache(), and then try to use zipimport.zipimporter.find_spec() (i.e. you left the zip file path on sys.path).
2021-09-17 16:48:17 -07:00
Eric Snow 090591636c
bpo-45020: Freeze os, site, and codecs. (gh-28398)
https://bugs.python.org/issue45020
2021-09-17 16:31:31 -06:00
Daniel Hahler 74cc2453ae
Fix missing space with help for `-m compileall -o` (GH-27591) 2021-09-18 00:28:09 +02:00
Serhiy Storchaka 51ebb7f4f5
bpo-45187: Fix dangling threads in test_socket.CreateServerFunctionalTest (GH-28422) 2021-09-17 21:56:41 +03:00
Omer Katz 778b07565e
Remove compatibility check for Python versions below 2.2. (GH-28314)
`os.path.realpath()` already exists in all our supported Python versions.
There's no longer a need to check if it exists or not.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-17 15:36:41 +02:00
Serhiy Storchaka 54a1760cde
bpo-45212: Add a comment for time.sleep() in tests (GH-28414)
Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-17 16:20:15 +03:00
Serhiy Storchaka b0a6ede3d0
bpo-45162: Remove many old deprecated unittest features (GH-28268)
* "fail*" and "assert*" aliases of TestCase methods.
* Broken from start TestCase method assertDictContainsSubset().
* Ignored TestLoader.loadTestsFromModule() parameter use_load_tests.
* Old alias _TextTestResult of TextTestResult.
2021-09-17 13:33:27 +03:00
Serhiy Storchaka 0361335b80
bpo-45187: Collect test_socket tests using unittest (GH-28317)
Previously, test classes ISOTPTest, J1939Test, BasicUDPLITETest and
UDPLITETimeoutTest were not included in the list of tests and
were not run by regrtest.
2021-09-17 12:13:09 +02:00
Serhiy Storchaka b2b035a949
bpo-5846: Fix deprecations for obsolete unittest functions and add tests. (GH-28382) 2021-09-17 12:09:32 +03:00
speedrun-program a59ede2447
bpo-45225: use map function instead of genexpr in capwords (GH-28342) 2021-09-16 14:49:38 -05:00
Serhiy Storchaka 7dacb70485
bpo-45212: Fix dangling threads in skipped tests in test_socket (GH-28361)
tearDown() is not called if setUp() raises an exception
(including SkipTest). addCleanup() should be used for guaranteed
execution of the cleanup code.
2021-09-16 13:30:00 +03:00
Barry Warsaw 07e737d002
bpo-45155 : Default arguments for int.to_bytes(length=1, byteorder=sys.byteorder) (#28265)
Add default arguments for int.to_bytes() and int.from_bytes()

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2021-09-15 19:55:24 -07:00
Hubert Badocha a75a257725
bpo-39710: Remove Python 2-specific sentence from calendar documentation (GH-26985) 2021-09-15 22:36:38 +02:00
Eric Snow 3814e2036d
bpo-45019: Clean up the frozen __hello__ module. (gh-28374)
Here's one more small cleanup that should have been in PR gh-28319. We eliminate stdout side-effects from importing the frozen __hello__ module, and update tests accordingly. We also move the module's source file into Lib/ from Toos/freeze/flag.py.

https://bugs.python.org/issue45019
2021-09-15 14:15:32 -06:00
Konstantin Popov d081eab7df
Fix typo in Lib/sqlite3/test/test_types.py (GH-28226)
preceeding -> preceding

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-15 22:09:08 +02:00
Eric Snow 4b30aaa0c9
bpo-45019: Silence a warning in test_ctypes. (gh-28362)
This was missed in PR gh-28319.

https://bugs.python.org/issue45019
2021-09-15 13:33:05 -06:00
Erlend Egeberg Aasland ff6d2cc55a
bpo-5846: Deprecate obsolete methods in `unittest` (GH-28299)
Deprecate makeSuite, findTestCases, and getTestCaseNames. Scheduled for removal in Python 3.13.
2021-09-15 20:33:31 +02:00
Serhiy Storchaka 5dce51a887
bpo-45167: Fix deepcopying of GenericAlias (GH-28324) 2021-09-15 20:25:41 +02:00
Victor Stinner 84a6061e29
bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355)
test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:

    Function "meth_varargs" not defined.
2021-09-15 20:21:06 +02:00
Victor Stinner cc057ff522
bpo-45205: Make test_compileall quiet (GH-28356)
Make test_compileall quiet: test_year_2038_mtime_compilation() and
test_larger_than_32_bit_times() of test_compileall no longer log
"Compiling ..." messages to stdout.
2021-09-15 20:20:45 +02:00
Victor Stinner e08e491a6c
bpo-45208: Make test_pdb.test_checkline_is_not_executable() quiet (GH-28354)
test_pdb.test_checkline_is_not_executable() no longer writes output
to stdout.

Remove also unused variables 'f'.
2021-09-15 20:19:31 +02:00
Pablo Galindo Salgado 764e6823a7
bpo-45204: Reduce verbosity of test_peg_generator (GH-28360) 2021-09-15 20:16:51 +02:00
Nikita Sobolev d897579a80
bpo-45185: enables `TestEnumerations` in `test_ssl` (GH-28330) 2021-09-15 19:57:03 +03:00
Eric Snow cbeb819710
bpo-45020: Freeze some of the modules imported during startup. (gh-28335)
Doing this provides significant performance gains for runtime startup (~15% with all the imported modules frozen). We don't yet freeze all the imported modules because there are a few hiccups in the build systems we need to sort out first. (See bpo-45186 and bpo-45188.)

Note that in PR GH-28320 we added a command-line flag (-X frozen_modules=[on|off]) that allows users to opt out of (or into) using frozen modules. The default is still "off" but we will change it to "on" as soon as we can do it in a way that does not cause contributors pain.

https://bugs.python.org/issue45020
2021-09-15 10:19:30 -06:00
Irit Katriel 40d2ac92f9
bpo-45152: refactor the dis module to make handling of hasconst opcodes more generic (GH-28258) 2021-09-15 10:14:15 +01:00
Terry Jan Reedy 1afc7b3219
bpo-45193: Restore IDLE completion boxes on Ubuntu (GH-28343)
The line that should not have been needed on macOS tk 8.6.8 but was,
should not be a problem on Ubuntu, but is.  It is not needed on macOS
tk 8.6.11, installed with 3.10.  Disable it but leave it for
now in case some system needs it.
2021-09-15 03:13:23 -04:00
Terry Jan Reedy 369bf949cc
bpo-45020: Don't test IDLE with frozen module. (GH-28344)
Otherwise, test would need special import.
2021-09-15 03:08:44 -04:00
Eric Snow a65c86889e
bpo-45020: Add -X frozen_modules=[on|off] to explicitly control use of frozen modules. (gh-28320)
Currently we freeze several modules into the runtime. For each of these modules it is essential to bootstrapping the runtime that they be frozen. Any other stdlib module that we later freeze into the runtime is not essential. We can just as well import from the .py file.  This PR lets users explicitly choose which should be used, with the new "-X frozen_modules=[on|off]" CLI flag. The default is "off" for now.

https://bugs.python.org/issue45020
2021-09-14 17:31:45 -06:00
junyixie b668cdfa09
bpo-45196: prevent unittest crash on address sanitizer builds (GH-28331) 2021-09-14 11:31:50 -07:00
Benjamin Peterson 024fda47d4
closes bpo-45190: Update Unicode data to version 14.0.0. (GH-28336) 2021-09-14 11:00:38 -07:00
Victor Stinner 797c8eb9ef
bpo-45195: Fix test_readline.test_nonascii() (GH-28329)
Fix test_readline.test_nonascii(): sometimes, the newline character
is not written at the end, so don't expect it in the output.
2021-09-14 17:38:04 +02:00
Nikita Sobolev 7f60c9e1c6
bpo-45156: Fixes inifite loop on unittest.mock.seal() (GH-28300)
Fixes infinite loop on unittest.mock.seal() of mocks created by
unittest.create_autospec().

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2021-09-14 12:20:40 +02:00
Irit Katriel c99fc4e53a
bpo-45168: change dis output to omit missing values rather than replacing them by their index (GH-28313) 2021-09-14 10:09:05 +01:00
Hugo van Kemenade 9f93018b69
bpo-42135 Correct version slated for importlib.find_loader removal (GH-28312)
importlib.find_loader should also be slated for 3.12 like the others in GH-25169 and as documented in https://docs.python.org/3.11/whatsnew/3.10.html#deprecated.
2021-09-13 15:57:50 -07:00
Eric Snow a2d8c4b81b
bpo-45019: Do some cleanup related to frozen modules. (gh-28319)
There are a few things I missed in gh-27980. This is a follow-up that will make subsequent PRs cleaner. It includes fixes to tests and tools that reference the frozen modules.

https://bugs.python.org/issue45019
2021-09-13 16:18:37 -06:00
Hugo van Kemenade 1fc41ae870
bpo-45173 Remove configparser deprecations (GH-28292)
In the configparser module, these have been deprecated since Python 3.2:

* the SafeConfigParser class,
* the filename property of the ParsingError class,
* the readfp method of the ConfigParser class,
2021-09-13 19:12:36 +02:00
Serhiy Storchaka 3e19409d64
bpo-45181: Simplify loading sqlite3 tests (GH-28304)
Use unittest discover instead of manually enumerating all
test modules and classes.
Also add support for filtering them by pattern.
2021-09-13 14:16:26 +03:00
Serhiy Storchaka 9260e67398
bpo-45182: Fix incorrect use of requires_zlib in test_bdist_rpm (GH-28305)
It is a decorator factory and should be always followed by "()".
2021-09-13 14:10:16 +03:00
Serhiy Storchaka 851811f577
bpo-5846: Do not use obsolete unittest functions. (GH-28303)
Get rid of use of makeSuite() and findTestCases().
Also make test_math and test_threading_local discoverable.
2021-09-13 10:49:53 +03:00
Serhiy Storchaka 92bf8691fb
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes (GH-26456)
* Constructors of subclasses of some buitin classes (e.g. tuple, list,
  frozenset) no longer accept arbitrary keyword arguments.
* Subclass of set can now define a __new__() method with additional
  keyword parameters without overriding also __init__().
2021-09-12 13:27:50 +03:00
Serhiy Storchaka 97ea18eced
bpo-35474: Fix mimetypes.guess_all_extensions() potentially mutating list (GH-28286)
* Calling guess_all_extensions() with strict=False potentially
  mutated types_map_inv.
* Mutating the result of guess_all_extensions() mutated types_map_inv.
2021-09-11 17:44:44 +03:00
giovanniwijaya b74c819fab
IDLE: adjust Python version in doc url for 3.10+ (GH-28228)
Expression 'python_version()[:3]' truncated '3.10.0' to '3.1' instead of '3.10'.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-09-10 17:10:28 -04:00
Irit Katriel f8d624d6a5
bpo-45144: use subTests in test_peepholer (GH-28247) 2021-09-10 18:29:21 +02:00
Serhiy Storchaka f0f29f328d
bpo-25894: Always report skipped and failed subtests separately (GH-28082)
* In default mode output separate characters for skipped and failed subtests.
* In verbose mode output separate lines (including description) for skipped
   and failed subtests.
* In verbose mode output test description for errors in test cleanup.
2021-09-10 17:55:05 +02:00
Henry-Joseph Audéoud 707137b863
bpo-40563: Support pathlike objects on dbm/shelve (GH-21849)
Co-authored-by: Hakan Çelik <hakancelik96@outlook.com>
2021-09-10 15:26:16 +03:00
Irit Katriel 04676b6946
bpo-45017: move opcode-related logic from modulefinder to dis (GH-28246) 2021-09-09 14:04:12 +01:00
Victor Stinner 49acac00c0
bpo-44860: Update test_sysconfig for posix_user platlib (GH-28235)
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
2021-09-09 11:02:48 +02:00
Raymond Hettinger 4a5cccb02b
bpo-20499: Rounding error in statistics.pvariance (GH-28230) 2021-09-08 22:00:12 -05:00
Erlend Egeberg Aasland f235dd0784
bpo-38371: Remove deprecated `tkinter` split() method (GH-28237) 2021-09-08 23:02:19 +03:00
Hugo van Kemenade 59ea704df7
bpo-45129 Remove deprecated reuse_address (GH-28207)
Due to significant security concerns, the reuse_address parameter of
asyncio.loop.create_datagram_endpoint, deprecated in Python 3.9, is
now removed. This is because of the behavior of the socket option
SO_REUSEADDR in UDP.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-08 18:58:43 +02:00
andrei kulakov a561005761
bpo-19113: Remove unused test_errors from ctypes tests (GH-28008)
This test was forever shadowed by another test method named `test_errors`.
2021-09-08 17:28:32 +02:00
Yurii Karabas c11956a8bd
bpo-45121: Fix RecursionError when calling Protocol.__init__ from a subclass' __init__ (GH-28206) 2021-09-08 18:25:09 +08:00
Hugo van Kemenade d003a5bd25
bpo-45132 Remove deprecated __getitem__ methods (GH-28225)
Remove deprecated __getitem__ methods of xml.dom.pulldom.DOMEventStream,
wsgiref.util.FileWrapper and fileinput.FileInput, deprecated since Python 3.9.
2021-09-08 13:07:40 +03:00
Raymond Hettinger 750368cbcd
Add more itertool recipes (GH-28165) 2021-09-07 12:29:00 -05:00
Victor Stinner c4ea45d7d2
bpo-45118: Fix regrtest second summary for re-run tests (GH-28183)
Fix regrtest second summary when using -w/--verbose2 command line
option: lists re-run tests in the second test summary.
2021-09-07 18:21:00 +02:00
Nikita Sobolev 8ca6b61e3f
bpo-45034: Fix how upper limit is formatted for `struct.pack("H", ...)` (GH-28178)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-07 13:18:46 +01:00
Pablo Galindo Salgado 97b754d4b4
Revert "bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011)" (GH-28201)
This reverts commit 4f88161f07.
2021-09-07 12:46:25 +01:00
Hugo van Kemenade eb254b43d2
bpo-45124: Remove the bdist_msi command (GH-28195)
The bdist_msi command, deprecated in Python 3.9, is now removed.
Use bdist_wheel (wheel packages) instead.
2021-09-07 12:34:27 +02:00
Pablo Galindo Salgado 533e725821
bpo-44963: Implement send() and throw() methods for anext_awaitable objects (GH-27955)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2021-09-07 11:30:14 +01:00
Tzu-ping Chung 4f88161f07
bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011) 2021-09-07 11:27:48 +01:00
Tzu-ping Chung a5c6bcf244
Make sysconfig posix_user not depend on platlibdir (GH-27655) 2021-09-07 11:26:42 +02:00
Terry Jan Reedy f05ad92028
Update idlelib/help.html to include idle.rst spelling fix (GH-28191)
The idle.rst fix was GH-27903 two weeks ago.
2021-09-07 00:04:54 -04:00
Nikita Sobolev 19871fce3b
bpo-45052: Unskips a failing `test_shared_memory_basics` test (GH-28182) 2021-09-06 17:55:34 +01:00
Irit Katriel 9e31b3952f
bpo-41031: Match C and Python code formatting of unprintable exceptions and exceptions in the __main__ module. (GH-28139) 2021-09-05 18:54:13 +03:00
Pablo Galindo Salgado b01fd533fe
Extract visitors from the grammar nodes and call makers in the peg generator (GH-28172)
Simplify the peg generator logic by extracting as much visitors as possible to disentangle the flow and separate concerns.
2021-09-05 14:58:52 +01:00
Serhiy Storchaka 28264269de
bpo-45102: unittest: add tests for skipping and errors in cleanup (GH-28166) 2021-09-05 10:34:14 +03:00
Raymond Hettinger 91be41ad93
bpo-44571: Add itertool recipe for a variant of takewhile() (GH-28167) 2021-09-05 00:09:26 -05:00
Nikita Sobolev dd7b816ac8
bpo-45042: Now test classes decorated with `requires_hashdigest` are not skipped (GH-28060)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-04 23:42:36 +03:00
Serhiy Storchaka 936f6a16b9
bpo-45030: Fix integer overflow in __reduce__ of the range iterator (GH-28000)
It happened with fast range iterator  when the calculated stop = start + step * len
was out of the C long range.
2021-09-04 21:02:21 +03:00
Serhiy Storchaka c2970fdec5
bpo-45097: Add more tests for shutdown_asyncgens() (GH-28154) 2021-09-04 20:55:20 +03:00
Brandt Bucher 3beef86e22
Handle different string hash algorithms correctly (#28147) 2021-09-04 07:14:27 -07:00
Irit Katriel 0b58e863df
bpo-45075: distinguish between frame and FrameSummary in traceback mo… (GH-28112) 2021-09-03 22:39:23 +01:00
Dong-hee Na bc1c49fa94
bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11 (GH-27837)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-03 18:21:03 +02:00
Batuhan Taskaya 85ea2d6165
bpo-43950: support positions for dis.Instructions created through dis.Bytecode (GH-28142) 2021-09-03 18:29:09 +03:00
Irit Katriel b4b6342848
bpo-45083: Include the exception class qualname when formatting an exception (GH-28119)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-09-03 09:30:17 +02:00
Victor Stinner a1e15a7a60
bpo-45082: Cleanup ctypes.c_buffer alias (GH-28129)
* Remove commented deprecation of ctypes.c_buffer.
* Remove references to ctypes.c_string which doesn't exist.
* Remove StringTestCase: it only had skipped test methods.
2021-09-02 19:02:03 +02:00
Yurii Karabas 0635e201be
bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-09-02 18:17:13 +02:00
Ruben Vorderman ea23e7820f
bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-02 17:02:59 +02:00
Inada Naoki 55c4a92fc1
bpo-45056: Remove trailing unused constants from co_consts (GH-28109) 2021-09-02 13:02:06 +02:00
Victor Stinner 19ba2122ac
bpo-37330: open() no longer accept 'U' in file mode (GH-28118)
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
2021-09-02 12:58:00 +02:00
Victor Stinner a806608705
bpo-45085: Remove the binhex module (GH-28117)
The binhex module, deprecated in Python 3.9, is now removed. The
following binascii functions, deprecated in Python 3.9, are now also
removed:

* a2b_hqx(), b2a_hqx();
* rlecode_hqx(), rledecode_hqx().

The binascii.crc_hqx() function remains available.
2021-09-02 12:10:08 +02:00
Victor Stinner d589a7e7eb
bpo-40360: Deprecate the lib2to3 package (GH-28116) 2021-09-02 11:46:47 +02:00
Victor Stinner 679cb4781e
bpo-44895: libregrtest: refleak check clears types later (GH-28113)
libregrtest now clears the type cache later to reduce the risk of
false alarm when checking for reference leaks. Previously, the type
cache was cleared too early and libregrtest raised a false alarm
about reference leaks under very specific conditions.

Move also support.gc_collect() outside clear/cleanup functions to
make the garbage collection more explicit.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-09-01 17:45:27 +02:00
Irit Katriel 863154c929
bpo-31299: make it possible to filter out frames from tracebacks (GH-28067) 2021-08-31 21:42:08 +01:00
Terry Jan Reedy 22fe0eb13c
bpo-45059: Add module cleanup to IDLE test_macosx (GH-28102) 2021-08-31 14:59:35 -04:00
Serhiy Storchaka 2b76a5322f
bpo-45057: Simplify RegressionTestResult (GH-28081)
Remove code which duplicates the functionality of TextTestResult.
2021-08-31 20:45:09 +03:00
Serhiy Storchaka 54f100514b
bpo-45059: Fix IDLE test typo: using "==" instead of "=" (GH-28086) 2021-08-31 13:32:01 -04:00
Serhiy Storchaka 3c65457156
bpo-45060: Get rid of few uses of the equality operators with None (GH-28087) 2021-08-31 16:59:52 +03:00
Raymond Hettinger 793f55bde9
bpo-39218: Improve accuracy of variance calculation (GH-27960) 2021-08-30 20:57:30 -05:00
Erlend Egeberg Aasland e34bb40919
bpo-45041: Increase coverage for sqlite3.Cursor.executescript() (GH-28074) 2021-08-30 22:14:27 +01:00
Erlend Egeberg Aasland 86d8b46523
bpo-16379: expose SQLite error codes and error names in `sqlite3` (GH-27786) 2021-08-30 19:32:21 +01:00
Erlend Egeberg Aasland f62763d267
bpo-43398: Add test for defect connection factories (GH-27966) 2021-08-30 18:49:34 +01:00
Serhiy Storchaka 08d9e597c8
bpo-43913: Fix bugs in cleaning up classes and modules in unittest. (GH-28006)
* Functions registered with addModuleCleanup() were not called unless
  the user defines tearDownModule() in their test module.
* Functions registered with addClassCleanup() were not called if
  tearDownClass is set to None.
* Buffering in TestResult did not work with functions registered
  with addClassCleanup() and addModuleCleanup().
* Errors in functions registered with addClassCleanup() and
  addModuleCleanup() were not handled correctly in buffered and
  debug modes.
* Errors in setUpModule() and functions registered with
  addModuleCleanup() were reported in wrong order.
* And several lesser bugs.
2021-08-30 18:25:59 +02:00
Serhiy Storchaka 7e246a3a7b
bpo-41620: TestCase.run() now always return a TestResult instance (GH-28030)
Previously it returned None if the test class or method was
decorated with a skipping decorator.

Co-authored-by: Iman Tabrizian <iman.tabrizian@gmail.com>
2021-08-30 15:16:25 +02:00
Dong-hee Na e6497fe698
bpo-45045: Optimize mapping patterns of structural pattern matching (GH-28043) 2021-08-30 19:02:32 +09:00
Miguel Brito 0897253f42
bpo-43124: Fix smtplib multiple CRLF injection (GH-25987)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-29 16:10:50 +02:00
E-Paine c9227df5a9
bpo-42278: Use tempfile.TemporaryDirectory rather than tempfile.mktemp in pydoc (GH-23200)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-29 13:07:51 +02:00
Serhiy Storchaka 2a8127cafe
bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) 2021-08-29 14:04:40 +03:00
Serhiy Storchaka 07d3d54f4e
bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021) 2021-08-29 13:07:40 +03:00
Carl Friedrich Bolz-Tereick eb263f9a35
bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002)
PyPy and potentially other implementations have different or no
contraints on the number of blocks that can be statically nested. move
the test that checks for this behaviour into a unit test and mark it as
CPython-only.
2021-08-28 21:33:50 +03:00
Thomas Grainger 206b21ed9f
bpo-44962: Fix a race in WeakKeyDict, WeakValueDict and WeakSet when two threads attempt to commit the last pending removal (GH-27921)
Fixes:
Traceback (most recent call last):
  File "/home/graingert/projects/asyncio-demo/demo.py", line 36, in <module>
    sys.exit(main())
  File "/home/graingert/projects/asyncio-demo/demo.py", line 30, in main
    test_all_tasks_threading()
  File "/home/graingert/projects/asyncio-demo/demo.py", line 24, in test_all_tasks_threading
    results.append(f.result())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 438, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.10/asyncio/runners.py", line 47, in run
    _cancel_all_tasks(loop)
  File "/usr/lib/python3.10/asyncio/runners.py", line 56, in _cancel_all_tasks
    to_cancel = tasks.all_tasks(loop)
  File "/usr/lib/python3.10/asyncio/tasks.py", line 53, in all_tasks
    tasks = list(_all_tasks)
  File "/usr/lib/python3.10/_weakrefset.py", line 60, in __iter__
    with _IterationGuard(self):
  File "/usr/lib/python3.10/_weakrefset.py", line 33, in __exit__
    w._commit_removals()
  File "/usr/lib/python3.10/_weakrefset.py", line 57, in _commit_removals
    discard(l.pop())
IndexError: pop from empty list

Also fixes:
Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0>
Traceback (most recent call last):
  File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove
    del self.data[k]
KeyError: <weakref at 0x00007fe76e8d8180; dead>
Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0>
Traceback (most recent call last):
  File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove
    del self.data[k]
KeyError: <weakref at 0x00007fe76e8d81a0; dead>
Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0>
Traceback (most recent call last):
  File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove
    del self.data[k]
KeyError: <weakref at 0x000056548f1e24a0; dead>

See: https://github.com/agronholm/anyio/issues/362#issuecomment-904424310
See also: https://bugs.python.org/issue29519

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-28 19:07:37 +02:00
chilaxan 94a3d2a632
bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-27 12:27:19 +02:00
Mark Shannon d3eaf0cc5b
bpo-44945: Specialize BINARY_ADD (GH-27967) 2021-08-27 09:21:01 +01:00
andrei kulakov fdcb675eed
bpo-40635: Fix getfqdn() docstring and docs (GH-27971)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-26 20:40:28 +02:00
Serhiy Storchaka f9cd40f5e2
bpo-45010: Remove support of special method __div__ in unittest.mock (GH-27965) 2021-08-26 20:19:47 +02:00
wouter bolsterlee 989f6a3800
bpo-45001: Make email date parsing more robust against malformed input (GH-27946)
Various date parsing utilities in the email module, such as
email.utils.parsedate(), are supposed to gracefully handle invalid
input, typically by raising an appropriate exception or by returning
None.

The internal email._parseaddr._parsedate_tz() helper used by some of
these date parsing routines tries to be robust against malformed input,
but unfortunately it can still crash ungracefully when a non-empty but
whitespace-only input is passed. This manifests as an unexpected
IndexError.

In practice, this can happen when parsing an email with only a newline
inside a ‘Date:’ header, which unfortunately happens occasionally in the
real world.

Here's a minimal example:

    $ python
    Python 3.9.6 (default, Jun 30 2021, 10:22:16)
    [GCC 11.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import email.utils
    >>> email.utils.parsedate('foo')
    >>> email.utils.parsedate(' ')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.9/email/_parseaddr.py", line 176, in parsedate
        t = parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 50, in parsedate_tz
        res = _parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 72, in _parsedate_tz
        if data[0].endswith(',') or data[0].lower() in _daynames:
    IndexError: list index out of range

The fix is rather straight-forward: guard against empty lists, after
splitting on whitespace, but before accessing the first element.
2021-08-26 16:49:03 +02:00
Serhiy Storchaka 7dc505b865
bpo-45011: Fix test_asyncio without C module _asyncio (GH-27968)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-26 14:48:24 +02:00
Gregory Anders 8868d48712
bpo-44967: pydoc: return non-zero exit code when query is not found (GH-27868) 2021-08-26 14:22:02 +02:00
Ken Jin 23384a1749
bpo-44524: Don't modify MRO when inheriting from typing.Annotated (GH-27841) 2021-08-25 21:13:59 +03:00
Dong-hee Na 551da597a0
bpo-45000: Raise SyntaxError when try to delete __debug__ (GH-27947)
Automerge-Triggered-By: GH:pablogsal
2021-08-25 10:54:20 -07:00
Pablo Galindo Salgado 24da544014
bpo-44929: [Enum] Fix global repr (GH-27789)
* Fix typo in __repr__ code

* Add more tests for global int flag reprs

* use last module if multi-module string
  - when an enum's `__module__` contains several module names, only
     use the last one

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-08-25 07:24:32 -07:00
Brandt Bucher 33d95c6fac
bpo-37596: Make `set` and `frozenset` marshalling deterministic (GH-27926) 2021-08-25 13:14:34 +02:00
Erlend Egeberg Aasland 7ecd3425d4
bpo-27334: roll back transaction if sqlite3 context manager fails to commit (GH-26202)
Co-authored-by: Luca Citi
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2021-08-25 11:59:42 +01:00
Pablo Galindo Salgado a24676bedc
Add tests for the C tokenizer and expose it as a private module (GH-27924) 2021-08-24 17:50:05 +01:00
Karthikeyan Singaravelan 7179930ab5
bpo-43826: Fix resource warning due to unclosed objects. (GH-25381) 2021-08-24 16:13:46 +05:30
Ammar Askar bb21e28fd0
bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int (GH-19708)
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2021-08-24 12:13:32 +03:00
Idan Moral fa6304a522
bpo-44690: Adopt binacii.a2b_base64's strict mode in base64.b64decode (GH-27272)
* Use binascii.a2b_base64 to validate b64decode input.
   This change leads to exception messages changes (mostly).
* Added more information to docstring of b64decode
* Added a reference to binascii.a2b_base64 in the docs
2021-08-23 16:44:28 -07:00
andrei kulakov 27b761a11a
bpo-44980: fix test_constructor to return None value (GH-27898) 2021-08-23 20:50:46 +02:00
Serhiy Storchaka 4d68917386
bpo-44984: Rewrite test_null_strings in _testcapi (GH-27904)
Test also PyObject_Repr(NULL) and PyObject_Bytes(NULL).
2021-08-23 20:05:07 +02:00
Mark Dickinson ae5259171b
Fix bytes.__bytes__ to not truncate at a zero byte (GH-27902) 2021-08-23 15:24:12 +01:00
Dong-hee Na 24b63c695a
bpo-24234: Implement bytes.__bytes__ (GH-27901) 2021-08-23 19:01:51 +09:00
Mark Dickinson 6082bb5add
bpo-24234: implement complex.__complex__ (GH-27887)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2021-08-23 09:15:49 +01:00
andrei kulakov b1db308c61
bpo-41322: Add unit tests for deprecation of test return values (GH-27846)
Also fix the traceback of warnings.
2021-08-22 21:32:45 +03:00
Serhiy Storchaka a9640d7553
bpo-44955: Always call stopTestRun() for implicitly created TestResult objects (GH-27831)
Method stopTestRun() is now always called in pair with method startTestRun()
for TestResult objects implicitly created in TestCase.run().
Previously it was not called for test methods and classes decorated with
a skipping decorator.
2021-08-22 10:33:52 +03:00
Serhiy Storchaka 585390fdd8
bpo-44968: Fix test_subprocess_wait_no_same_group in test_asyncio (GH-27870)
The code of the test was never executed because the test function
was unintentionally converted to a generator function.
2021-08-21 23:09:08 +03:00
Serhiy Storchaka 4ceec49559
bpo-44524: Do not set _name of _SpecialForm without need (GH-27861)
Because setting non-empty _name affects behavior of other code.

In most cases __name__ can be derived from __origin__.__name__.
2021-08-21 09:47:59 +03:00
Irit Katriel f5d7a8d29c
bpo-44960: add regression test for geometric_mean with mixed int/floa… (#27856)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2021-08-20 14:08:21 +01:00
Mark Dickinson 60b93d9e49
bpo-44954: Fix wrong result in float.fromhex corner case (GH-27834) 2021-08-20 11:40:11 +01:00
andrei kulakov 3db42fc5ac
bpo-41322: added deprecation warning for tests returning value!=None (GH-27748) 2021-08-19 11:41:04 +02:00
Pablo Galindo Salgado b2f68b1900
bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814) 2021-08-18 22:09:21 +02:00
Yurii Karabas a3a4d20d67
bpo-44524: Fix cryptic TypeError message when trying to subclass special forms in `typing` (GH-27710)
This was a Python 3.9 regression.
2021-08-18 21:08:32 +02:00
Victor Stinner 6fb62b42f4
bpo-44949: Fix test_readline auto history tests (#27813) 2021-08-18 19:38:54 +02:00
Łukasz Langa 8cf07d3db3
bpo-44852: Support filtering over warnings without a set message (GH-27793)
Additional improvements:

- messages which were compiled regular expressions aren't unpacked back into
  strings for unmatched warnings;

- removed unnecessary "if tokens:" check (there's one before the for loop);

- took `endswith` calculation out of the for loop.
2021-08-18 13:19:30 +02:00
Jakub Kulík b1930bf75f
bpo-44935: enable posix_spawn() on Solaris (GH-27795)
Enable posix_spawn() on Solaris
2021-08-17 11:09:48 -07:00
Mark Dickinson 4b9a2dcf19
bpo-44698: Restore complex pow behaviour for small integral exponents (GH-27772) 2021-08-17 17:51:28 +01:00
Ken Jin 96346cb6d0
bpo-44889: Specialize LOAD_METHOD with PEP 659 adaptive interpreter (GH-27722)
Adds four new instructions:

* LOAD_METHOD_ADAPTIVE
* LOAD_METHOD_CACHED
* LOAD_METHOD_MODULE
* LOAD_METHOD_CLASS
2021-08-17 15:55:55 +01:00
Maximilian Hils 1512bc21d6
bpo-38956: don't print BooleanOptionalAction's default twice (GH-27672)
Co-authored-by: Micky Yun Chan <michan@redhat.com>
2021-08-16 23:42:21 +02:00
Ken Jin d84d2c4985
bpo-44914: Add tests for some invariants of tp_version_tag (GH-27774) 2021-08-16 20:18:36 +01:00
Guido van Rossum 62bd97303e
Fix a SystemError in code.replace() (#27771)
While the comment said 'We don't bother resizing localspluskinds',
this would cause .replace() to crash when it happened.
(Also types.CodeType(), but testing that is tedious, and this tests all
code paths.)
2021-08-16 11:34:23 -07:00
Łukasz Langa a0a6d39295
bpo-44852: Support ignoring specific DeprecationWarnings wholesale in regrtest (GH-27634) 2021-08-16 20:13:51 +02:00
Mark Shannon 4f51fa9e2d
bpo-44900: Add five superinstructions. (GH-27741)
* LOAD_FAST LOAD_FAST
* STORE_FAST LOAD_FAST
* LOAD_FAST LOAD_CONST
* LOAD_CONST LOAD_FAST
* STORE_FAST STORE_FAST
2021-08-16 12:23:13 +01:00