summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-112716: Fix SystemError when __builtins__ is not a dict ↵Serhiy Storchaka2023-12-141-0/+26
| | | | | | | | | (GH-112770) (GH-113105) It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc. (cherry picked from commit 1161c14e8c68296fc465cd48970b32be9bee012e)
* [3.11] gh-112625: Protect bytearray from being freed by misbehaving iterator ↵Miss Islington (bot)2023-12-041-0/+17
| | | | | | | inside bytearray.join (GH-112626) (GH-112694) (cherry picked from commit 0e732d0997cff08855d98c17af4dd5527f10e419) Co-authored-by: chilaxan <chilaxan@gmail.com>
* [3.11] gh-110393: Remove watchdog with hardcoded timeout (GH-110400) (#110444)Miss Islington (bot)2023-10-051-2/+0
| | | | | | | | | | | | | gh-110393: Remove watchdog with hardcoded timeout (GH-110400) test_builtin and test_socketserver no longer use signal.alarm() to implement a watchdog with a hardcoded timeout (2 and 60 seconds). Python test runner regrtest has two watchdogs: faulthandler and timeout on running worker processes. Tests using short hardcoded timeout can fail on slowest buildbots just because the timeout is too short. (cherry picked from commit 1328fa31fe9c72748fc6fd11d017c82aafd48a49) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.11] gh-108416: Mark slow test methods with @requires_resource('cpu') ↵Serhiy Storchaka2023-09-031-0/+1
| | | | | | | (GH-108421) (GH-108799) Only mark tests which spend significant system or user time, by itself or in subprocesses. (cherry picked from commit f3ba0a74cd50274acdcd592d4ce8395b92492b7c)
* [3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594) (#104195)Lysandros Nikolaou2023-05-071-2/+1
|
* gh-102356: Add thrashcan macros to filter object dealloc (GH-102426)Miss Islington (bot)2023-03-051-0/+10
| | | | | | Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters. (cherry picked from commit 66aa78cbe604a7c5731f074b869f92174a8e3b64) Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
* gh-99124: use concrete exception types in `test_builtin` (GH-99125)Miss Islington (bot)2022-11-081-3/+3
| | | | | (cherry picked from commit c32bc1bffd9d63ede0d0505abab983247a3ad0c6) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.11] gh-94808: Cover `LOAD_GLOBAL` for custom dict subtypes (GH-96767) ↵Miss Islington (bot)2022-11-041-0/+31
| | | | (GH-99091)
* GH-94808: Test __build_class__ inside non-dict __builtins__ (GH-95932) (#96004)Miss Islington (bot)2022-09-081-5/+9
| | | | | | | (cherry picked from commit 3adb4d864bb18a51334c922a732e5e3602799ba1) Co-authored-by: Michael Droettboom <mdboom@gmail.com> Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-90473: Increase stack size, disable obmalloc on WASI (GH-92732)Miss Islington (bot)2022-05-131-1/+4
| | | | | (cherry picked from commit d81d57e9598dea741e049f3876ccd87072a38906) Co-authored-by: Christian Heimes <christian@python.org>
* gh-92203: Add closure support to exec(). (#92204)larryhastings2022-05-061-1/+79
| | | Add a closure keyword-only parameter to exec(). It can only be specified when exec-ing a code object that uses free variables. When specified, it must be a tuple, with exactly the number of cell variables referenced by the code object. closure has a default value of None, and it must be None if the code object doesn't refer to any free variables.
* gh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)Inada Naoki2022-04-221-1/+1
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40280: Address more test failures on Emscripten (GH-31050)Christian Heimes2022-02-051-0/+2
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)Géry Ogam2022-01-181-4/+14
| | | | | | Use common error message for non-string attribute name in the builtin functions getattr and hasattr. The special check no longer needed since Python 3.0.
* bpo-46411: Remove unnecessary calls to sys.exc_info() in tests (GH-30638)Irit Katriel2022-01-181-2/+2
|
* bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631)Victor Stinner2022-01-171-2/+14
| | | | | | | | | | Skip test_builtin PTY tests on non-ASCII characters if the readline module is loaded. The readline module changes input() behavior, but test_builtin is not intented to test the readline module. When the readline module is loaded, PyOS_Readline() uses the readline implementation. In some cases, the Python readline callback rlhandler() is called by readline with a string without non-ASCII characters.
* bpo-45346: Keep docs consistent regarding true and false values (GH-28697)Raymond Hettinger2021-10-021-1/+1
|
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)Inada Naoki2021-04-021-6/+8
| | | | | | | | | | | | | * test__xxsubinterpreters * test_builtin * test_doctest * test_exceptions * test_opcodes * test_support * test_argparse * test_baseexception * test_bdb * test_bool * test_asdl_parser
* bpo-40636: Remove overly-strict zip pickling tests (GH-24109)Brandt Bucher2021-01-051-42/+0
|
* bpo-42536: GC track recycled tuples (GH-23623)Brandt Bucher2020-12-051-0/+13
| | | | | | | | | | | | | | | | Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector: - collections.OrderedDict.items - dict.items - enumerate - functools.reduce - itertools.combinations - itertools.combinations_with_replacement - itertools.permutations - itertools.product - itertools.zip_longest - zip Previously, they could have become untracked by a prior garbage collection.
* bpo-40275: Use new test.support helper submodules in tests (GH-21449)Hai Shi2020-08-031-3/+3
|
* bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro ↵Pablo Galindo2020-07-061-3/+5
| | | | (GH-21363)
* bpo-41218: Only mark async code with CO_COROUTINE. (#21357)Matthias Bussonnier2020-07-061-0/+19
| | | | | 3.8.3 had a regression where compiling with ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are coroutine even if there were not.
* bpo-40636: PEP 618: add strict parameter to zip() (GH-20921)Guido van Rossum2020-06-191-0/+150
| | | | | | | | zip() now supports PEP 618's strict parameter, which raises a ValueError if the arguments are exhausted at different lengths. Patch by Brandt Bucher. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com> Co-authored-by: Ram Rachum <ram@rachum.com>
* bpo-40140: test_builtin.PtyTests registers SIGHUP handler (GH-19314)Victor Stinner2020-04-021-5/+18
| | | | | | | | test_builtin.PtyTests now registers an handler for SIGHUP signal. Closing the PTY file descriptor can emit a SIGHUP signal: just ignore it. run_child() now also closes the PTY file descriptor before waiting for the process completition, otherwise the test hangs on AIX.
* bpo-31160: Fix race condition in test_os.PtyTests (GH-19263)Victor Stinner2020-03-311-2/+9
| | | | bpo-31160, bpo-40094: Wait until the process completes before closing the PTY to prevent sending SIGHUP to the child process.
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-1/+2
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-39562: Allow executing asynchronous comprehensions in the asyncio REPL ↵Batuhan Taşkaya2020-03-191-1/+8
| | | | | (GH-18968) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39965: Correctly raise SyntaxError if await is used outside async ↵Pablo Galindo2020-03-151-0/+38
| | | | functions when PyCF_ALLOW_TOP_LEVEL_AWAIT is set (GH-19010)
* bpo-35712: Make using NotImplemented in a boolean context issue a ↵MojoVampire2020-03-031-0/+14
| | | | deprecation warning (GH-13195)
* bpo-39200: Correct the error message for min/max builtin function (GH-17814)Dong-hee Na2020-01-101-2/+12
| | | | Correct the error message when calling the min() or max() with no arguments.
* bpo-38839: Fix some unused functions in tests (GH-17189)Adam Johnson2019-11-191-0/+1
|
* bpo-38237: Make pow's arguments have more descriptive names and be keyword ↵Ammar Askar2019-09-211-0/+13
| | | | | | | | | | | | passable (GH-16302) Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
* Fix the ImportWarning regarding __spec__ and __package__ being None (GH-16003)Xtreak2019-09-121-3/+4
|
* bpo-37409: fix relative import with no parent (#14956)Ben Lewis2019-09-111-0/+4
| | | | | | | | | | | | | Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If __package__ (and __spec__.parent) are missing then import uses __name__, truncating the last segment if the module is a submodule rather than a package __init__.py (which it guesses from whether __path__ is defined). The __name__ attempt should fail if there is no parent package (top level modules), if __name__ is '__main__' (-m entry points), or both (scripts). That is, if both __name__ has no subcomponents and the module does not seem to be a package __init__ module then import should fail.
* bpo-36781: Optimize sum() for bools. (#13074)Serhiy Storchaka2019-09-101-0/+21
| | | | | | | | * Optimize sum() for bools. * Fix sum([], False). * Add a NEWS entry.
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-011-3/+3
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)Sergey Fedoseev2019-08-301-0/+12
|
* bpo-37417: Fix error handling in bytearray.extend. (GH-14407)Brandt Bucher2019-06-261-0/+5
|
* bpo-36027: Extend three-argument pow to negative second argument (GH-13266)Mark Dickinson2019-06-021-1/+2
|
* bpo-34616: Fix code style and unbreak buildbots (GH-13473)Yury Selivanov2019-05-211-18/+20
| | | See also PR GH-13148.
* bpo-34616: Add PyCF_ALLOW_TOP_LEVEL_AWAIT to allow top-level await (GH-13148)Matthias Bussonnier2019-05-211-1/+72
| | | Co-Authored-By: Yury Selivanov <yury@magic.io>
* bpo-35742: Fix test_envar_unimportable in test_builtin. (GH-11561)Serhiy Storchaka2019-01-151-0/+1
| | | | | Handle the case of an empty module name in PYTHONBREAKPOINT. Fixes a regression introduced in bpo-34756.
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Serhiy Storchaka2018-11-051-1/+1
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
* bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624)INADA Naoki2018-09-261-0/+9
| | | | | | | When dict subclass overrides order (`__iter__()`, `keys()`, and `items()`), `dict(o)` should use it instead of dict ordering. https://bugs.python.org/issue34320
* bpo-34637: Make the *start* argument for *sum()* visible as a keyword ↵Raymond Hettinger2018-09-121-0/+3
| | | | argument. (GH-9208)
* bpo-34149: Behavior of the min/max with key=None (GH-8328)Alexander Marshalov2018-07-241-0/+4
| | | Improve consistency with the signature for sorted(), heapq.nsmallest(), heapq.nlargest(), and itertools.groupby().
* bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)Serhiy Storchaka2017-12-151-8/+8
| | | This fixes also bpo-22091.
* bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)Victor Stinner2017-12-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | * Add -X utf8 command line option, PYTHONUTF8 environment variable and a new sys.flags.utf8_mode flag. * If the LC_CTYPE locale is "C" at startup: enable automatically the UTF-8 mode. * Add _winapi.GetACP(). encodings._alias_mbcs() now calls _winapi.GetACP() to get the ANSI code page * locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8 mode. As a side effect, open() now uses the UTF-8 encoding by default in this mode. * Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding in the UTF-8 Mode. * Update subprocess._args_from_interpreter_flags() to handle -X utf8 * Skip some tests relying on the current locale if the UTF-8 mode is enabled. * Add test_utf8mode.py. * _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to return also the length (number of wide characters). * pymain_get_global_config() and pymain_set_global_config() now always copy flag values, rather than only copying if the new value is greater than the old value.
* PEP 553 built-in breakpoint() function (bpo-31353) (#3355)Barry Warsaw2017-10-051-1/+109
| | | Implement PEP 553, built-in breakpoint() with support from sys.breakpointhook(), along with documentation and tests. Closes bpo-31353