Commit Graph

38 Commits

Author SHA1 Message Date
Alex Waygood 19601efa36
gh-109653: Remove unused imports in the `Lib/` directory (#109803) 2023-09-24 15:07:23 +01:00
Pablo Galindo Salgado b28ffaa193
gh-109596: Ensure repeated rules in the grammar are not allowed and fix incorrect soft keywords (#109606) 2023-09-22 19:03:23 +01:00
Victor Stinner 7a6cc3eb66
test_peg_generator and test_freeze require cpu (#108386)
The test_peg_generator and test_tools.test_freeze tests now require
the 'cpu' resource. Skip these tests unless the 'cpu' resource is
enabled (it is disabled by default).

These tests are no longer skipped if Python is built with ASAN or
MSAN sanitizer.
2023-08-24 00:52:48 +02:00
Victor Stinner a541e01537
gh-90791: Enable test___all__ on ASAN build (#108286)
* Only skip modules and tests related to X11 on ASAN builds: run
  other tests with ASAN.
* Use print(flush=True) to see output earlier when it's redirected to
  a pipe.
* Update issue reference: replace bpo-46633 with gh-90791.
2023-08-22 15:52:32 +02:00
Pablo Galindo Salgado da8f87b7ea
gh-107015: Remove async_hacks from the tokenizer (#107018) 2023-07-26 16:34:15 +01:00
Erlend E. Aasland 41ad4dfc04
gh-105063: Disable test_peg_generator.TestCParser bco. ref leaks (#106024)
Since gh-104798 (Use setuptools in peg-generator and reenable
tests), the TestCParser test case has been producing ref leaks.
2023-06-23 19:04:17 +02:00
Pablo Galindo Salgado d7f46bcd98
gh-105564: Don't include artificial newlines in the line attribute of tokens (#105565) 2023-06-09 17:01:26 +01:00
Lysandros Nikolaou 95f1b1fef7
gh-104983: Fix test_peg_generator (#104985) 2023-05-26 18:06:45 +01:00
Lysandros Nikolaou afa759fb80
gh-100238: Use setuptools in peg-generator and reenable tests (#104798) 2023-05-26 15:32:03 +02:00
Alex Waygood 401d7a7f00
gh-102515: Remove unused imports in the `Lib/` directory (#102516) 2023-03-08 11:45:38 +00:00
Victor Stinner 0faa0ba240
gh-92584: Remove the distutils package (#99061)
Remove the distutils package. It was deprecated in Python 3.10 by PEP
632 "Deprecate distutils module". For projects still using distutils
and cannot be updated to something else, the setuptools project can
be installed: it still provides distutils.

* Remove Lib/distutils/ directory
* Remove test_distutils
* Remove references to distutils
* Skip test_check_c_globals and test_peg_generator since they use
  distutils
2022-11-03 19:27:27 +01:00
Akuli a4974003ec
gh-93124: Fix typos in comments (GH-93125)
Fixes #93124

Automerge-Triggered-By: GH:rhettinger
2022-05-25 08:34:14 -07:00
Serhiy Storchaka 086c6b1b0f
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
2022-05-08 17:49:09 +03:00
Jeremy Kloth 612e422c6e
bpo-46576: Speed up test_peg_generator by using a static library for shared sources (GH-32338)
Speed up test_peg_generator by using a static library for shared sources to avoid recompiling as much code.
2022-04-06 14:55:58 -07:00
Christian Heimes deeaac49e2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests
- Skip extension import tests if dlopen is not available
- Don't assume that _testcapi is a shared extension
- Skip a lot of socket tests that don't work on Emscripten
- Skip mmap tests, mmap emulation is incomplete
- venv does not work yet
- Cannot get libc from executable

The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
2022-03-22 03:04:36 -07:00
Victor Stinner 9204bb72a2
bpo-46633: Skip tests on ASAN and/or MSAN builds (GH-31632)
Skip tests on ASAN and/or MSAN builds:

* multiprocessing tests
* test___all__
* test_concurrent_futures
* test_decimal
* test_peg_generator
* test_tools

The ASAN job of GitHub Actions no longer excludes these tests.
2022-03-01 15:44:08 +01:00
Pablo Galindo Salgado 764e6823a7
bpo-45204: Reduce verbosity of test_peg_generator (GH-28360) 2021-09-15 20:16:51 +02: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
Pablo Galindo Salgado 953d27261e
Update pegen to use the latest upstream developments (GH-27586) 2021-08-12 17:37:30 +01:00
Dong-hee Na 736ed6f7a9
bpo-43425: Update test_c_parser not to use TempdirManager (GH-26693) 2021-06-13 07:07:24 +09:00
Lumír 'Frenzy' Balhar 90d02e5e63
bpo-41282: (PEP 632) Deprecate distutils.sysconfig (partial implementation of the PEP) (GH-23142)
This change:
* merges `distutils.sysconfig` into `sysconfig` while keeping the original functionality and
* marks `distutils.sysconfig` as deprecated

https://bugs.python.org/issue41282
2021-04-23 14:02:41 +02:00
Matthew Suozzo 75a06f067b
bpo-43798: Add source location attributes to alias (GH-25324)
* Add source location attributes to alias.
* Move alias star construction to pegen helper.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-04-10 22:56:28 +02:00
Victor Stinner d27f8d2e07
bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)
Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix.
Remove macros creating aliases without prefix. For example, Module()
becomes _PyAST_Module(). Update Grammar/python.gram to use
_PyAST_xxx() functions.
2021-04-07 21:34:22 +02:00
Pablo Galindo 3bcc4ead3f
Add small validator utility for PEG grammars (GH-23519) 2020-12-26 19:11:29 +00:00
serge-sans-paille 100964e031
Disable peg generator tests when building with PGO (GH-23141)
Otherwise, when running the testsuite, test_peg_generator tries to compile C
code using the optimized flags and fails because it cannot find the profile
data.
2020-11-04 23:01:08 +00:00
Pablo Galindo c111355480
bpo-41826: Fix compiler warnings in test_peg_generator (GH-22455)
Co-authored-by: Skip Montanaro
2020-10-03 17:28:51 +03:00
Pablo Galindo e55a0e971b
Fix 'gather' rules in the python parser generator (GH-22021)
Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
2020-09-03 15:29:55 +01:00
Hai Shi 4660597b51
bpo-40275: Use new test.support helper submodules in tests (GH-21448) 2020-08-03 18:49:18 +02:00
Serhiy Storchaka aad8f0eeca
bpo-41112: Fix test_peg_generator on non-UTF-8 locales. (GH-21138) 2020-06-25 14:31:30 +03:00
Batuhan Taskaya 55460ee6dc
bpo-41044: Generate valid PEG python parsers for opt+seq rules (GH-20995)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-20 18:40:06 +01:00
Pablo Galindo 404b23b85b
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
2020-05-26 16:15:52 -07:00
Guido van Rossum b45af1a569
Add soft keywords (GH-20370)
These are like keywords but they only work in context; they are not reserved except when there is an exact match.

This would enable things like match statements without reserving `match` (which would be bad for the `re.match()` function and probably lots of other places).

Automerge-Triggered-By: @gvanrossum
2020-05-26 10:58:44 -07:00
Pablo Galindo ac7a92cc0a
bpo-40334: Avoid collisions between parser variables and grammar variables (GH-19987)
This is for the C generator:
- Disallow rule and variable names starting with `_`
- Rename most local variable names generated by the parser to start with `_`

Exceptions:
- Renaming `p` to `_p` will be a separate PR
- There are still some names that might clash, e.g.
  - anything starting with `Py`
  - C reserved words (`if` etc.)
  - Macros like `EXTRA` and `CHECK`
2020-05-09 21:34:50 -07:00
Pablo Galindo 9dbaa8d9f0
Fix some scripts in the peg generator folder (GH-19853) 2020-05-02 05:23:06 +01:00
Lysandros Nikolaou 24ffe705c3
bpo-40334: Rewrite test_c_parser to avoid memory leaks (GH-19694)
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.
2020-04-24 14:51:09 +01:00
Pablo Galindo 9e6a1312c1
bpo-40370: Use the same compile and link args as the interpreter used in test_peg_generator (GH-19674) 2020-04-23 14:46:22 +01:00
Lysandros Nikolaou 8d1cbfffea
bpo-40334: Suppress all output in test_peg_generator (GH-19675) 2020-04-23 13:22:16 +01:00
Pablo Galindo c5fc156852
bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-04-22 23:29:27 +01:00