summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-43998: Fix testing without ssl module (GH-25790)Christian Heimes2021-05-011-3/+4
| | | Signed-off-by: Christian Heimes <christian@python.org>
* bpo-43998: Default to TLS 1.2 and increase cipher suite security (GH-25778)Christian Heimes2021-05-011-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ssl module now has more secure default settings. Ciphers without forward secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based on Hynek Schlawack's research. ``` $ openssl version OpenSSL 1.1.1k FIPS 25 Mar 2021 $ openssl ciphers -v '@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM' TLS_AES_256_GCM_SHA384 TLSv1.3 Kx=any Au=any Enc=AESGCM(256) Mac=AEAD TLS_CHACHA20_POLY1305_SHA256 TLSv1.3 Kx=any Au=any Enc=CHACHA20/POLY1305(256) Mac=AEAD TLS_AES_128_GCM_SHA256 TLSv1.3 Kx=any Au=any Enc=AESGCM(128) Mac=AEAD TLS_AES_128_CCM_SHA256 TLSv1.3 Kx=any Au=any Enc=AESCCM(128) Mac=AEAD ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(256) Mac=AEAD ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(128) Mac=AEAD ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(128) Mac=AEAD ECDHE-ECDSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH Au=ECDSA Enc=CHACHA20/POLY1305(256) Mac=AEAD ECDHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH Au=RSA Enc=CHACHA20/POLY1305(256) Mac=AEAD ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA384 ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA384 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AES(128) Mac=SHA256 ECDHE-RSA-AES128-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(128) Mac=SHA256 DHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=DH Au=RSA Enc=AESGCM(256) Mac=AEAD DHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=DH Au=RSA Enc=AESGCM(128) Mac=AEAD DHE-RSA-AES256-SHA256 TLSv1.2 Kx=DH Au=RSA Enc=AES(256) Mac=SHA256 DHE-RSA-AES128-SHA256 TLSv1.2 Kx=DH Au=RSA Enc=AES(128) Mac=SHA256 ``` Signed-off-by: Christian Heimes <christian@python.org>
* If using a frozen class with slots, add __getstate__ and __setstate__ to set ↵Eric V. Smith2021-05-011-0/+13
| | | | the instance values. (GH-25786)
* bpo-43989: Temporarily disable warnings in ssltests (GH-25780)Christian Heimes2021-05-011-1/+1
| | | -Werror is currently broken.
* bpo-42269: Add slots parameter to dataclass decorator (GH-24171)Yurii Karabas2021-05-011-0/+53
| | | Add slots parameter to dataclass decorator and make_dataclass function.
* bpo-43995: Fix reference leak in test_grammar (GH-25764)Erlend Egeberg Aasland2021-04-301-4/+5
|
* bpo-43916: _md5.md5 uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25753)Victor Stinner2021-04-301-1/+32
| | | | | | | | | | The following types use Py_TPFLAGS_DISALLOW_INSTANTIATION flag: * _md5.md5 * _sha1.sha1 * _sha256.sha224 * _sha256.sha256 * _sha512.sha384 * _sha512.sha512
* bpo-43901: Fix refleaks in test_module (GH-25754)Pablo Galindo2021-04-301-1/+2
|
* bpo-43916: select.devpoll uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25751)Victor Stinner2021-04-301-0/+4
|
* bpo-43916: Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to selected types (GH-25748)Erlend Egeberg Aasland2021-04-309-4/+58
| | | | | | | | | | | | | | | | | | | | | Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to the following types: * _dbm.dbm * _gdbm.gdbm * _multibytecodec.MultibyteCodec * _sre..SRE_Scanner * _thread._localdummy * _thread.lock * _winapi.Overlapped * array.arrayiterator * functools.KeyWrapper * functools._lru_list_elem * pyexpat.xmlparser * re.Match * re.Pattern * unicodedata.UCD * zlib.Compress * zlib.Decompress
* bpo-43916: select.poll uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25750)Erlend Egeberg Aasland2021-04-301-0/+4
|
* bpo-43933: Set frame.f_lineno during call to __exit__ (GH-25719)Mark Shannon2021-04-302-2/+3
| | | * Set line number of __exit__ call in a with statement to be that of the with keyword.
* bpo-43908: check_set_special_type_attr() checks Py_TPFLAGS_IMMUTABLETYPE ↵Erlend Egeberg Aasland2021-04-301-2/+4
| | | | | | | | (GH-25743) check_set_special_type_attr() and type_set_annotations() now check for immutable flag (Py_TPFLAGS_IMMUTABLETYPE). Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25749)Victor Stinner2021-04-301-0/+56
| | | | | | | The PyStdPrinter_Type type now uses the Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation, rather than seting a tp_init method which always fail. Write also unit tests for PyStdPrinter_Type.
* bpo-43916: Remove _disabled_new() function (GH-25745)Victor Stinner2021-04-302-3/+3
| | | | | posix and _hashlib use the new Py_TPFLAGS_DISALLOW_INSTANTIATION flag on their heap types, rather than using a custom tp_new function (_disabled_new).
* bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag (GH-25721)Victor Stinner2021-04-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new Py_TPFLAGS_DISALLOW_INSTANTIATION type flag to disallow creating type instances: set tp_new to NULL and don't create the "__new__" key in the type dictionary. The flag is set automatically on static types if tp_base is NULL or &PyBaseObject_Type and tp_new is NULL. Use the flag on the following types: * _curses.ncurses_version type * _curses_panel.panel * _tkinter.Tcl_Obj * _tkinter.tkapp * _tkinter.tktimertoken * _xxsubinterpretersmodule.ChannelID * sys.flags type * sys.getwindowsversion() type * sys.version_info type Update MyStr example in the C API documentation to use Py_TPFLAGS_DISALLOW_INSTANTIATION. Add _PyStructSequence_InitType() function to create a structseq type with the Py_TPFLAGS_DISALLOW_INSTANTIATION flag set. type_new() calls _PyType_CheckConsistency() at exit.
* bpo-43817: Add inspect.get_annotations(). (#25522)larryhastings2021-04-304-5/+303
| | | | | Add inspect.get_annotations, which safely computes the annotations defined on an object. It works around the quirks of accessing the annotations from various types of objects, and makes very few assumptions about the object passed in. inspect.get_annotations can also correctly un-stringize stringized annotations. inspect.signature, inspect.from_callable, and inspect.from_function now call inspect.get_annotations to retrieve annotations. This means inspect.signature and inspect.from_callable can now un-stringize stringized annotations, too.
* Two minor fixes for accessing a module's name. (#25658)larryhastings2021-04-301-1/+1
| | | | | | | | | | | | | | | | | While working on another issue, I noticed two minor nits in the C implementation of the module object. Both are related to getting a module's name. First, the C function module_dir() (module.__dir__) starts by ensuring the module dict is valid. If the module dict is invalid, it wants to format an exception using the name of the module, which it gets from PyModule_GetName(). However, PyModule_GetName() gets the name of the module from the dict. So getting the name in this circumstance will never succeed. When module_dir() wants to format the error but can't get the name, it knows that PyModule_GetName() must have already raised an exception. So it leaves that exception alone and returns an error. The end result is that the exception raised here is kind of useless and misleading: dir(module) on a module with no __dict__ raises SystemError("nameless module"). I changed the code to actually raise the exception it wanted to raise, just without a real module name: TypeError("<module>.__dict__ is not a dictionary"). This seems more useful, and would do a better job putting the programmer who encountered this on the right track of figuring out what was going on. Second, the C API function PyModule_GetNameObject() checks to see if the module has a dict. If m->md_dict is not NULL, it calls _PyDict_GetItemIdWithError(). However, it's possible for m->md_dict to be None. And if you call _PyDict_GetItemIdWithError(Py_None, ...) it will *crash*. Unfortunately, this crash was due to my own bug in the other branch. Fixing my code made the crash go away. I assert that this is still possible at the API level. The fix is easy: add a PyDict_Check() to PyModule_GetNameObject(). Unfortunately, I don't know how to add a unit test for this. Having changed module_dir() above, I can't find any other interfaces callable from Python that eventually call PyModule_GetNameObject(). So I don't know how to trick the runtime into reproducing this error. Since both these changes are minor--each entails only a small edit to only one line--I didn't bother with a news item.
* bpo-43901: Lazy-create an empty annotations dict in all unannotated user ↵larryhastings2021-04-305-5/+165
| | | | | classes and modules (#25623) Change class and module objects to lazy-create empty annotations dicts on demand. The annotations dicts are stored in the object's `__dict__` for backwards compatibility.
* bpo-43892: Validate the first term of complex literal value patterns (GH-25735)Brandt Bucher2021-04-301-0/+32
|
* bpo-43933: Show frame.f_lineno as None, rather than -1, if there is no line ↵Mark Shannon2021-04-291-1/+10
| | | | number. (GH-25717)
* bpo-43882 - urllib.parse should sanitize urls containing ASCII newline and ↵Senthil Kumaran2021-04-291-0/+29
| | | | | | | | tabs. (GH-25595) * issue43882 - urllib.parse should sanitize urls containing ASCII newline and tabs. Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon2021-04-292-1/+7
| | | | | * Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
* bpo-43651: Fix test_logging (GH-25715)Inada Naoki2021-04-291-2/+1
|
* bpo-28254: Cleanup test_subprocess.test_preexec_gc_module_failure() (GH-25709)Victor Stinner2021-04-291-4/+0
| | | Saving/restoring gc.disable and gc.isenabled is no longer needed.
* bpo-43908: Make array.array type immutable (GH-25696)Erlend Egeberg Aasland2021-04-291-0/+6
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43908: Make re types immutable (GH-25697)Erlend Egeberg Aasland2021-04-291-0/+12
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-292-1/+18
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-41139: Deprecate `cgi.log()` (GH-25625)Inada Naoki2021-04-291-0/+2
|
* bpo-43651: Fix EncodingWarning in `os.fdopen()` and test_os (GH-25654)Inada Naoki2021-04-291-9/+12
|
* bpo-43651: Fix EncodingWarning in tests. (GH-25655)Inada Naoki2021-04-293-17/+21
| | | | | * test_httplib * test_httpservers * test_logging
* bpo-24275: Don't downgrade unicode-only dicts to mixed on lookups (GH-25186)Hristo Venev2021-04-291-0/+100
|
* bpo-28254: _posixsubprocess uses PyGC_Enable/PyGC_Disable (GH-25693)Victor Stinner2021-04-281-12/+0
|
* bpo-43757: Make pathlib use os.path.realpath() to resolve symlinks in a path ↵Barney Gale2021-04-282-3/+114
| | | | | (GH-25264) Also adds a new "strict" argument to realpath() to avoid changing the default behaviour of pathlib while sharing the implementation.
* bpo-41559: Change PEP 612 implementation to pure Python (#25449)Ken Jin2021-04-281-0/+17
|
* bpo-43955: Handle the case where the distutils warning has already been ↵Steve Dower2021-04-281-1/+1
| | | | triggered (GH-25675)
* bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684)Victor Stinner2021-04-281-1/+1
| | | | Fix test_logging.test_namer_rotator_inheritance() on Windows: use os.replace() rather than os.rename().
* bpo-43960: test_pdb resets breakpoints (GH-25673)Irit Katriel2021-04-281-0/+1
| | | | Reset global breakpoint state at the beginning of test_pdb_next_command_in_generator_for_loop() to make it deterministic.
* bpo-43776: Remove list call from args in Popen repr (GH-25338)M. Kocher2021-04-281-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the `list` call in the Popen `repr`. Current implementation: For cmd = `python --version`, with `shell=True`. ```bash <Popen: returncode: None args: ['p', 'y', 't', 'h', 'o', 'n', ' ', '-', '-',...> ``` For `shell=False` and args=`['python', '--version']`, the output is correct: ```bash <Popen: returncode: None args: ['python', '--version']> ``` With the new changes the `repr` yields: For cmd = `python --version`, with `shell=True`: ```bash <Popen: returncode: None args: 'python --version'> ``` For `shell=False` and args=`['python', '--version']`, the output: ```bash <Popen: returncode: None args: ['python', '--version']> ``` Automerge-Triggered-By: GH:gpshead
* bpo-43957: [Enum] Deprecate ``TypeError`` from containment checks. (GH-25670)Ethan Furman2021-04-272-27/+118
| | | | | In 3.12 ``True`` or ``False`` will be returned for all containment checks, with ``True`` being returned if the value is either a member of that enum or one of its members' value.
* bpo-8978: improve tarfile.open error message when lzma / bz2 are missing ↵Anthony Sottile2021-04-272-0/+12
| | | | | (GH-24850) Automerge-Triggered-By: GH:pablogsal
* bpo-43864: Silence deprecation warning in test_importlib.test_module_found ↵Shreyan Avigyan2021-04-271-2/+6
| | | | and test_importlib.test_module_not_found (GH-25656)
* bpo-43766: Implement PEP 647 (User-Defined Type Guards) in typing.py (#25282)Ken Jin2021-04-271-0/+40
|
* bpo-43312: Functions returning default and preferred sysconfig schemes ↵Tzu-ping Chung2021-04-271-5/+34
| | | | (GH-24644)
* bpo-43651: Fix EncodingWarning in fileinput and its test (GH-25648)Inada Naoki2021-04-271-26/+27
|
* bpo-43651: Fix EncodingWarning in zipfile (GH-25650)Inada Naoki2021-04-271-28/+28
|
* bpo-43945: [Enum] Deprecate non-standard mixin format() behavior (GH-25649)Ethan Furman2021-04-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | In 3.12 the enum member, not the member's value, will be used for format() calls. Format specifiers can be used to retain the current display of enum members: Example enumeration: class Color(IntEnum): RED = 1 GREEN = 2 BLUE = 3 Current behavior: f'{Color.RED}' --> '1' Future behavior: f'{Color.RED}' --> 'RED' Using d specifier: f'{Color.RED:d}' --> '1' Using specifiers can be done now and is future-compatible.
* bpo-43651: PEP 597: Fix `socket.makefile()` (GH-25645)Inada Naoki2021-04-271-3/+4
|
* bpo-38530: Require 50% similarity in NameError and AttributeError ↵Dennis Sweeney2021-04-271-0/+112
| | | | suggestions (GH-25584)
* bpo-43762: Add audit events for loading of sqlite3 extensions (GH-25246)Erlend Egeberg Aasland2021-04-262-0/+44
|