summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [3.10] bpo-44654: Refactor and clean up the union type implementation ↵Miss Islington (bot)2021-07-171-17/+25
| | | | | | (GH-27196) (GH-27219) (cherry picked from commit 0fd27375cabd12e68a2f12cfeca11a2d5043429e)
* [3.10] bpo-44490: Add __parameters__ and __getitem__ to types.Union ↵Serhiy Storchaka2021-07-171-0/+13
| | | | | | | | | | | (GH-26980) (GH-27207) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>. (cherry picked from commit c45fa1a5d9b419cf13ad4b5a7cb453956495b83e) Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (#27204)Miss Islington (bot)2021-07-172-0/+28
| | | | | | | | | | This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules. This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation. Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 889036f7ef7290ef15b6c3373023f6a35387af0c) Co-authored-by: Germán Méndez Bravo <german.mb@gmail.com>
* bpo-44655: Include the name of the type in unset __slots__ attribute errors ↵Miss Islington (bot)2021-07-171-0/+6
| | | | | | | | | (GH-27199) (GH-27201) (cherry picked from commit f783428a2313a729ca8b539c5a86ff114b9ff375) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44655: Don't include suggestions for attributes that are the same as the ↵Miss Islington (bot)2021-07-161-0/+12
| | | | | | | missing one (GH-27197) (GH-27198) (cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* Revert "bpo-44645: Check for interrupts on any potentially backwards edge. ↵Miss Islington (bot)2021-07-161-25/+0
| | | | | | | | (GH-27167)" (GH-27194) (#27195) This reverts commit 000e70ad5246732fcbd27cf59268185cbd5ad734. (cherry picked from commit c90c591e5158ab7b531dcd6e2a5f00bc70ba7637) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44647: Add a permanent Unicode-valued env var to regrtest (GH-27187) ↵Miss Islington (bot)2021-07-162-1/+19
| | | | | | | (#27191) (cherry picked from commit 7915c96ffd7ddc5cb6d54015ee4c31255a416892) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.10] bpo-44652: Preserve natural order of args in the union type. ↵Serhiy Storchaka2021-07-161-5/+33
| | | | | | | (GH-27185) (GH-27190) (cherry picked from commit 0cd2d51aadcd2a0c0739a5df0a6235d64f35619e) Automerge-Triggered-By: GH:ambv
* bpo-40897:Give priority to using the current class constructor in ↵Miss Islington (bot)2021-07-161-0/+41
| | | | | | | | `inspect.signature` (GH-27177) (#27189) Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 6aab5f9bf303a8e4cd8377fabcdcb499e0541f9a) Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
* [3.10] bpo-44636: Collapse union of equal types (GH-27178) (GH-27181)Serhiy Storchaka2021-07-161-1/+3
| | | | | | | | The result of `int | int` is now `int`. Fix comparison of the union type with non-hashable objects. `int | str == {}` no longer raises a TypeError. (cherry picked from commit d9f923280f204204f8703756aef4f655b579b4b8)
* bpo-44626: Merge basic blocks earlier to enable better handling of exit ↵Mark Shannon2021-07-162-8/+37
| | | | | blocks without line numbers (GH-27138) (GH-27182) (cherry picked from commit a86f7dae0acf918d54086cb85e5a0b0bedeedce7)
* [3.10] bpo-44645: Check for interrupts on any potentially backwards edge. ↵Mark Shannon2021-07-161-0/+25
| | | | | | | (GH-27167) (GH-27183) (cherry picked from commit 000e70ad5246732fcbd27cf59268185cbd5ad734) Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-44646: Fix the hash of the union type. (GH-27179) (#27180)Miss Islington (bot)2021-07-161-0/+4
| | | | | | | | | It no longer depends on the order of arguments. hash(int | str) == hash(str | int) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com> (cherry picked from commit aeaa553d650786afc6e68df1f4813ae1a5b71d05) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44647: Fix test_httpservers failing on Unicode characters in os.environ ↵Miss Islington (bot)2021-07-151-4/+13
| | | | | | | | on Windows (GH-27161) (#27169) GH-23638 introduced a new test for Accept: headers in CGI HTTP servers. This test serializes all of os.environ on the server side. For non-UTF8 locales this can fail for some Unicode characters found in environment variables. This change fixes the HTTP_ACCEPT test. (cherry picked from commit 82b218f36ce6ef910bda5af227a9fd5be613c94f) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. ↵Mark Shannon2021-07-151-1/+11
| | | | | (GH-27160) (GH-27163) (cherry picked from commit f333ab0f2edec26a769ed558263ac662e5475451)
* bpo-42073: allow classmethod to wrap other classmethod-like descriptors ↵Miss Islington (bot)2021-07-151-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-27115) (GH-27162) Patch by Erik Welch. bpo-19072 (GH-8405) allows `classmethod` to wrap other descriptors, but this does not work when the wrapped descriptor mimics classmethod. The current PR fixes this. In Python 3.8 and before, one could create a callable descriptor such that this works as expected (see Lib/test/test_decorators.py for examples): ```python class A: @myclassmethod def f1(cls): return cls @classmethod @myclassmethod def f2(cls): return cls ``` In Python 3.8 and before, `A.f2()` return `A`. Currently in Python 3.9, it returns `type(A)`. This PR make `A.f2()` return `A` again. As of GH-8405, classmethod calls `obj.__get__(type)` if `obj` has `__get__`. This allows one to chain `@classmethod` and `@property` together. When using classmethod-like descriptors, it's the second argument to `__get__`--the owner or the type--that is important, but this argument is currently missing. Since it is None, the "owner" argument is assumed to be the type of the first argument, which, in this case, is wrong (we want `A`, not `type(A)`). This PR updates classmethod to call `obj.__get__(type, type)` if `obj` has `__get__`. Co-authored-by: Erik Welch <erik.n.welch@gmail.com> (cherry picked from commit b83861f0265e07207a6ae2c49c40fa8f447893f2)
* bpo-44632: Fix support of TypeVar in the union type (GH-27139) (GH-27143)Miss Islington (bot)2021-07-151-1/+7
| | | | | | | | int | TypeVar('T') returns now an instance of types.Union instead of typing.Union. (cherry picked from commit a158b20019b50e3ece6e4743ec4e6ae8d818b690) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] bpo-44635: Convert None to NoneType in the union type constructor ↵Serhiy Storchaka2021-07-151-0/+13
| | | | | | (GH-27136). (GH-27142) (cherry picked from commit b81cac05606c84958b52ada09f690463a3c7e949)
* [3.10] bpo-44589: raise a SyntaxError when mapping patterns have duplicate ↵Miss Islington (bot)2021-07-151-11/+34
| | | | | | | | | | literal keys (GH-27131) (GH-27157) (cherry picked from commit 2693132292b2acf381ac6fa729bf3acf41d9d72b) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com> Automerge-Triggered-By: GH:brandtbucher
* bpo-34932: Add socket.TCP_KEEPALIVE for macOS (GH-25079)Miss Islington (bot)2021-07-141-0/+7
| | | | | (cherry picked from commit d59d7374a364c4e5c2b9a83d8e4543ee494285b8) Co-authored-by: Shane Harvey <shnhrv@gmail.com>
* bpo-44616: Mark all clean up instructions at end of named exception block as ↵Mark Shannon2021-07-141-0/+23
| | | | | artificial (GH-27109) (GH-27135) (cherry picked from commit e5862f79c16e28f1ec51d179698739a9b2d8c1d2)
* bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)Miss Islington (bot)2021-07-141-1/+7
| | | | | | if it is called with a sequence or set, but not list or tuple. (cherry picked from commit f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. ↵Miss Islington (bot)2021-07-141-2/+35
| | | | | | | | | | | | (GH-27120) * Fix issubclass() for None. E.g. issubclass(type(None), int | None) returns now True. * Fix issubclass() for virtual subclasses. E.g. issubclass(dict, int | collections.abc.Mapping) returns now True. * Fix crash in isinstance() if the check for one of items raises exception. (cherry picked from commit 81989058de381108dfd0a4255b93d4fb34417002) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] bpo-44630: Fix assertion errors in csv module (GH-27127) (GH-27129)Miss Islington (bot)2021-07-131-0/+6
| | | | | | | | | | | | | | | | | | | Fix incorrect handling of exceptions when interpreting dialect objects in the csv module. Not clearing exceptions between calls to PyObject_GetAttrString() causes assertion failures in pydebug mode (or with assertions enabled). Add a minimal test that would've caught this (passing None as dialect, or any object that isn't a csv.Dialect subclass, which the csv module allows and caters to, even though it is not documented.) In pydebug mode, the test triggers the assertion failure in the old code. Contributed-By: T. Wouters [Google] (cherry picked from commit 0093876328afa330224c9d887c18dee0b3117852) Co-authored-by: T. Wouters <thomas@python.org> Automerge-Triggered-By: GH:gpshead
* bpo-38741: Definition of multiple ']' in header configparser (GH-17129) (#27110)Miss Islington (bot)2021-07-131-0/+7
| | | | | | | Co-authored-by: Jason Killen <jason.killen@windsorcircle.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 2924bb1a566977efd45f335d6a94cd84d8047edf) Co-authored-by: jsnklln <jsnklln@gmail.com>
* bpo-43219: shutil.copyfile, raise a less confusing exception instead of ↵Miss Islington (bot)2021-07-101-0/+9
| | | | | | | | IsADirectoryError (GH-27049) Fixes the misleading IsADirectoryError to be FileNotFoundError. (cherry picked from commit 248173cc0483a9ad9261353302f1234cf9eb2ebe) Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
* bpo-44317: Improve tokenizer errors with more informative locations ↵Miss Islington (bot)2021-07-101-2/+2
| | | | | | | (GH-26555) (GH-27079) (cherry picked from commit f24777c2b329974b69d2a3bf5cfc37e0fcace36c) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-43897: ast validation for pattern matching nodes (GH-27074)Batuhan Taskaya2021-07-101-1/+142
| | | | | (cherry picked from commit 8dcb7d98086888230db94a1eb07bae1b5db82bc9) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* bpo-44570: Fix line tracing for forward jumps to duplicated tails (GH-27067)Mark Shannon2021-07-082-2/+37
|
* [3.10] bpo-44446: support lineno being None in traceback.FrameSummary ↵Pablo Galindo2021-07-081-0/+4
| | | | | | | | | | | | | (GH-26781) (GH-27072) As of 088a15c49d99ecb4c3bef93f8f40dd513c6cae3b, lineno is None instead of -1 if there is no line number. Signed-off-by: Filipe Laíns <lains@riseup.net>. (cherry picked from commit 91a8f8c16ca9a7e2466a8241d9b41769ef97d094) Co-authored-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Filipe Laíns <lains@riseup.net>
* bpo-44582: Accelerate mimetypes.init on Windows with a native accelerator ↵Miss Islington (bot)2021-07-081-1/+20
| | | | | | | (GH-27059) (cherry picked from commit bbf2fb6c7ae78f40483606f467739a58cd747270) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007)Miss Islington (bot)2021-07-071-0/+5
| | | | | (cherry picked from commit 6bd3ecfc272b122b55a6adec50dd7a7c868f262f) Co-authored-by: Rupert Tombs <rupert.tombs@gmail.com>
* bpo-44558: Make the implementation consistency of operator.indexOf (GH-27012)Miss Islington (bot)2021-07-051-0/+3
| | | | | (cherry picked from commit 09302405d22e86884d6058226790c0cdf5b72f14) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* [3.10] bpo-44559: [Enum] revert enum module to 3.9 (GH-27010)Ethan Furman2021-07-0411-1565/+254
| | | * [Enum] revert enum module to 3.9
* [3.10] bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) ↵Irit Katriel2021-07-031-0/+15
| | | | | | | (GH-27006) (cherry picked from commit d968a638fcbf9030c999cfacd4c9bf0656e779c4) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* bpo-44553 : Implement GC methods for types.Union (GH-26993)Miss Islington (bot)2021-07-031-1/+19
| | | | | (cherry picked from commit 1097384ce964dd63686b1aac706cd0fa764c2dc9) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-30256: Add manager_owned keyword arg to AutoProxy (GH-16341) (#26987)Miss Islington (bot)2021-07-021-0/+10
| | | | | | | Co-authored-by: Jordan Speicher <jordan@jspeicher.com> (cherry picked from commit 85b920498b42c69185540ecc2f5c4907fd38d877) Co-authored-by: finefoot <33361833+finefoot@users.noreply.github.com>
* bpo-41180: Replace marshal code.__new__ audit event with marshal.load[s] and ↵Steve Dower2021-06-302-0/+32
| | | | marshal.dumps (GH-26970)
* bpo-44523: Remove the pass-through for hash() in weakref proxy objects ↵Miss Islington (bot)2021-06-291-4/+10
| | | | | | | (GH-26950) (cherry picked from commit e2fea101fd5517f33371b04432842b971021c3bf) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.10] bpo-44468: Never skip base classes in `typing.get_type_hints()`, even ↵Miss Islington (bot)2021-06-261-7/+18
| | | | | | | | | | with invalid `.__module__`. (GH-26862) (GH-26920) (cherry picked from commit 7569c0fe91dfcf562dee8c29798ecda74d738aa8) Co-authored-by: will-ca <willchencontact@gmail.com> Automerge-Triggered-By: GH:gvanrossum
* bpo-43977: Properly update the tp_flags of existing subclasses when their ↵Miss Islington (bot)2021-06-251-23/+87
| | | | | | | parents are registered (GH-26864) (cherry picked from commit ca2009d72a52a98bf43aafa9ad270a4fcfabfc89) Co-authored-by: Brandt Bucher <brandt@python.org>
* bpo-44498: suppress DeprecationWarnings for asynchat, asyncore and smtpd in ↵Miss Islington (bot)2021-06-249-16/+51
| | | | | | | | tests (GH-26905) (GH-26907) (cherry picked from commit 22e7effad571f8e524d2f71ff55bbf2a25306753) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.10] bpo-44498: Issue a deprecation warning on asynchat, asyncore and ↵Miss Islington (bot)2021-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | smtpd import (GH-26882) (GH-26904) * Issue a deprecation warning on smtpd import * Also issue DeprecationWarnings for asynchat and asyncore * Fix some tests * test___all__ requires the word 'module' or 'package' in the deprecation warning text, so add those to smtpd, asynchat, and asyncore. * In test_support, use pprint now instead of asyncore as the landmark. * Add What's New * Use ..deprecated:: * Use ..deprecated:: * Update Lib/smtpd.py Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Update Doc/library/smtpd.rst Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Import async{hat,ore} after the DeprecationWarning for this module Co-authored-by: Miro Hrončok <miro@hroncok.cz> (cherry picked from commit 8488b85c6397fe58f17fc00e047044c959ac0b04) Co-authored-by: Barry Warsaw <barry@python.org> Automerge-Triggered-By: GH:warsaw
* bpo-44456: Improve the syntax error when mixing keyword and positional ↵Miss Islington (bot)2021-06-241-0/+24
| | | | | | | patterns (GH-26793) (cherry picked from commit 0acc258fe6f0ec200ca2f6f9294adbf52a244802) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-44229: Ignore spurious EPROTOTYPE on macOS in test_ssl (GH-26893)Miss Islington (bot)2021-06-241-3/+8
| | | | | (cherry picked from commit b5a52eef67997246b4235b5407e52a01e822ce56) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-43916: Use test.support.check_disallow_instantiation() in test_tcl ↵Miss Islington (bot)2021-06-241-3/+3
| | | | | | | (GH-26412) (GH-26888) (cherry picked from commit e90e0422182f4ca7faefd19c629f84aebb34e2ee) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-44297: Add a regression test for line numbers in with statements (GH-26891)Mark Shannon2021-06-241-7/+24
|
* [3.10] bpo-43988: Add test.support.check_disallow_instantiation() (GH-25757) ↵Erlend Egeberg Aasland2021-06-2314-51/+48
| | | | | | | | | (GH-26885) (cherry picked from commit 4f725261c6cf23d259e8fdc205e12b76ef4d2d31, fbff5387c3e1f3904420fa5a27738c6c5881305b, and 8cec740820fc875117bfa7b6bdb10202ebeb8fd5) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Automerge-Triggered-By: GH:vstinner
* bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26877)Victor Stinner2021-06-231-3/+14
| | | | | | | Py_RunMain() now resets PyImport_Inittab to its initial value at exit. It must be possible to call PyImport_AppendInittab() or PyImport_ExtendInittab() at each Python initialization. (cherry picked from commit 489699ca05bed5cfd10e847d8580840812b476cd)
* bpo-28395: Remove unnecessary semicolons in tests (GH-26868)Miss Islington (bot)2021-06-238-31/+32
| | | | | (cherry picked from commit 5a3108044d2e5b694da2d1f4176c9bbaef15c142) Co-authored-by: Dong-hee Na <donghee.na@python.org>