| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`ast.parse` and `compile` support a `feature_version` parameter that
tells the parser to parse the input string, as if it were written in
an older Python version.
The `feature_version` is propagated to the tokenizer, which uses it
to handle the three different stages of support for `async` and
`await`. Additionally, it disallows the following at parser level:
- The '@' operator in < 3.5
- Async functions in < 3.5
- Async comprehensions in < 3.6
- Underscores in numeric literals in < 3.6
- Await expression in < 3.5
- Variable annotations in < 3.6
- Async for-loops in < 3.5
- Async with-statements in < 3.5
- F-strings in < 3.6
Closes we-like-parsers/cpython#124.
|
| |
|
|
|
|
|
| |
Replace TestFailed with support.TestFailed.
Bug spotted by pyflakes.
|
| |
|
|
|
|
|
| |
(GH-19811)" (#19821)
This reverts commit 2514a632fb7d37be24c2059d0e286d35600f9795.
|
|
|
|
|
| |
Before this commit, if an exception was active inside a generator
when calling gen.throw(), then that exception was lost (i.e. there
was no implicit exception chaining). This commit fixes that.
|
|
|
|
|
|
|
|
|
|
| |
This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile().
Closes https://github.com/we-like-parsers/cpython/issues/95.
(For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.)
The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* bpo-40394 - difflib.SequenceMatched.find_longest_match default args
Added default args to find_longest_match, as well as related tests.
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Now that the default parser is the new PEG parser, ast.parse uses it, which means that we don't actually test something in test_peg_parser. This commit introduces a new keyword argument (`oldparser`) for `_peg_parser.parse_string` for specifying that a string needs to be parsed with the old parser. This keyword argument is used in the tests to actually compare the ASTs the new parser generates with those generated by the old parser.
|
|
|
|
| |
Add support for CAN_J1939 sockets that wrap SAE J1939 protocol
functionality provided by Linux 5.4+ kernels.
|
|
|
|
|
| |
Remove _random.Random.randbytes(): the C implementation of
randbytes(). Implement the method in Python to ease subclassing:
randbytes() now directly reuses getrandbits().
|
|
|
|
|
|
| |
test.pythoninfo logs OpenSSL FIPS_mode() and Linux
/proc/sys/crypto/fips_enabled in a new "fips" section.
Co-Authored-By: Petr Viktorin <encukou@gmail.com>
|
|
|
| |
More robust frame.setlineno. Makes no assumptions about source->bytecode translation.
|
|
|
| |
test_gdb and test.pythoninfo now check gdb command exit code.
|
| |
|
| |
|
|
|
|
|
| |
After parsing is done in single statement mode, the tokenizer buffer has to be checked for additional lines and a `SyntaxError` must be raised, in case there are any.
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
| |
Fix a race condition in concurrent.futures._ThreadWakeup: access to
_ThreadWakeup is now protected with the shutdown lock.
|
|
|
| |
Add a new test.support.hashlib_helper submodule.
|
|
|
| |
`JoinedStr`s and `FormattedValue also needs to be shifted, in order to correctly compute the location information of nested f-strings.
|
|
|
|
|
| |
This PR adds the functionality requested by https://github.com/ericsnowcurrently/multi-core-python/issues/52.
Automerge-Triggered-By: @ericsnowcurrently
|
|
|
|
|
|
| |
*** File "/usr/lib64/python3.9/turtledemo/__main__.py", line 275
bg="#d00" if clear == NORMAL else"#fca")
^
SyntaxError: invalid string prefix
|
|
|
|
|
| |
This allows the caller to avoid creation of an exception when the channel is empty (just like `dict.get()` works). `ChannelEmptyError` is still raised if no default is provided.
Automerge-Triggered-By: @ericsnowcurrently
|
|
|
|
|
|
|
| |
methods in MagicMock" (GH-19734)
* Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029)"
This reverts commit 72b1004657e60c900e4cd031b2635b587f4b280e.
|
|
|
| |
require `_generate_next_value_` to be defined before members
|
|\ |
|
| | |
|
| |
| |
| | |
This test has been changed to always use the old parser, so no need for it to be skipped.
|
| |
| |
| | |
An E_EOF error was only being caught after the parser exited before this commit. There are some cases though, where the tokenizer returns ERRORTOKEN *and* has set an E_EOF error (like when EOF directly follows a line continuation character) which weren't correctly handled before.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now only test_error_during_result_unpickle_in_result_handler()
captures and ignores sys.stderr in the test process.
Tools like test.bisect_cmd don't support subTest() but only
work with the granularity of one method.
Remove unused ExecutorDeadlockTest._sleep_id() method.
|
| |
| |
| |
| | |
Process.shutdown(wait=True) of concurrent.futures now closes
explicitly the result queue.
|
| | |
|
| |
| |
| | |
This commit also allows to pass flags to the new parser in all interfaces and fixes a bug in the parser generator that was causing to inline rules with actions, making them disappear.
|
| |
| |
| |
| |
| |
| | |
Add a new close() method to multiprocessing.SimpleQueue to explicitly
close the queue.
Automerge-Triggered-By: @pitrou
|
|/ |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Import logging lazily in assertLogs() in unittest.
Move TestHandler from test.support to logging_helper.
|
|
|
|
|
|
| |
* Move socket related functions from test.support to socket_helper.
* Import socket, nntplib and urllib.error lazily in transient_internet().
* Remove importing multiprocess.
|
|
|
|
|
| |
* Import asyncio lazily in unittest (only when IsolatedAsyncioTestCase is used).
* Import asyncio.events lazily in test.support.
|
|
|
|
|
| |
Deprecate lib2to3 module in light of PEP 617.
We anticipate removal in the 3.12 timeframe.
|
|
|
|
|
|
|
|
|
|
| |
Previously every test was building an extension module and
loading it into sys.modules. The tearDown function was thus
not able to clean up correctly, resulting in memory leaks.
With this commit, every test function now builds the extension
module and runs the actual test code in a new process
(using assert_python_ok), so that sys.modules stays intact
and no memory gets leaked.
|