Commit graph

39 commits

Author SHA1 Message Date
neonene
9f4ae13d2a
[3.12] gh-117613: Argument Clinic: ensure that defining class params are positional-only (#117939) 2024-04-17 21:11:17 +00:00
Victor Stinner
c80d13838d
[3.12] gh-117347: Fix test_clinic side effects (#117363) (#117365)
gh-117347: Fix test_clinic side effects (#117363)

Save/restore converters in ClinicWholeFileTest and
ClinicExternalTest.

(cherry picked from commit 35b6c4a4da)
2024-03-29 12:04:25 +01:00
Erlend E. Aasland
6f5e360acd
[3.12] gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) (#115067)
(cherry picked from commit 09096a1647)
2024-02-06 11:20:16 +01:00
Miss Islington (bot)
55d607683f
[3.12] gh-110558: Enable ruff's pyupgrade rules when running on Argument Clinic (GH-110603) (#110609)
gh-110558: Enable ruff's pyupgrade rules when running on Argument Clinic (GH-110603)
(cherry picked from commit fc811c8d20)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-10 12:35:21 +02:00
Alex Waygood
36886726a2
[3.12] gh-110558: Run ruff on Argument Clinic in CI (#110559) (#110598) 2023-10-10 08:58:56 +00:00
Miss Islington (bot)
f66b992e27
[3.12] gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (GH-107496) (#107499)
(cherry picked from commit 2c5d206b33)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-31 15:57:25 +00:00
Miss Islington (bot)
2827ad2f31
[3.12] gh-106368: Argument clinic tests: improve failure message when tests in ClinicExternalTests fail (GH-107364) (#107365)
gh-106368: Argument clinic tests: improve failure message when tests in `ClinicExternalTests` fail (GH-107364)
(cherry picked from commit 76c26eaca4)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-28 00:39:51 +00:00
Miss Islington (bot)
ef808517f4
[3.12] gh-106368: Increase Argument Clinic CLI test coverage (GH-107277) (#107282)
(cherry picked from commit 579100f6d7)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-26 07:13:22 +00:00
Miss Islington (bot)
69d4e8c090
[3.12] gh-106368: Increase Argument Clinic CLI test coverage (GH-107156) (#107189)
Instead of hacking into the Clinic class, use the Argument Clinic tool
to run the ClinicExternalTest test suite.

(cherry picked from commit 83a2837b32)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-24 19:19:36 +00:00
Miss Islington (bot)
76fd98a675
[3.12] gh-106368: Increase coverage for Argument Clinic output directive (GH-106979) (#106994)
(cherry picked from commit ee5c01b473)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-22 12:48:35 +02:00
Miss Islington (bot)
67748f18c9
[3.12] gh-106970: Fix Argument Clinic 'destination <name> clear' command (GH-106972) (#106983)
Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
(cherry picked from commit 3372bcba98)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-22 11:06:46 +02:00
Miss Islington (bot)
807afdac41
[3.12] gh-106368: Increase Argument Clinic test coverage for IndentStack (GH-106933) (#106943)
(cherry picked from commit 8d228cf66f)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-21 06:32:30 +00:00
Miss Islington (bot)
941ac1e19d
[3.12] gh-106368: Increase Argument Clinic test coverage for cpp.Monitor (GH-106833) (#106838)
(cherry picked from commit 22379c60ab)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-17 21:20:59 +00:00
Miss Islington (bot)
1fe841254e
[3.12] gh-106368: Increase Argument Clinic BlockParser test coverage (GH-106759) (#106769)
(cherry picked from commit 2d7d1aa4bc)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-15 09:55:25 +00:00
Miss Islington (bot)
6a1a660158
[3.12] gh-106368: Increase Argument Clinic test coverage (GH-106728) (#106730)
- improve output_parameter() coverage
- improve coverage for Function.kind
(cherry picked from commit ec45c513d3)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-13 22:52:21 +00:00
Erlend E. Aasland
b72601e7e5
[3.12] gh-64595: Fix regression in file write logic in Argument Clinic (#106449) (#106452)
Revert the two commits that introduced the regressions:

 - gh-104152
 - gh-104507

(cherry picked from commit 9d1d4f9c73)
2023-07-05 13:17:09 +00:00
Miss Islington (bot)
00c522a81c
[3.12] gh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (GH-106443) (#106444)
gh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (GH-106443)
(cherry picked from commit a941bd6c53)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-05 08:57:59 +00:00
Miss Islington (bot)
6f684044a9
[3.12] gh-106368: Add tests for formatting helpers in Argument Clinic (GH-106415) (#106438)
gh-106368: Add tests for formatting helpers in Argument Clinic (GH-106415)
(cherry picked from commit 2fb9480c83)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 23:00:32 +00:00
Miss Islington (bot)
fda297031b
[3.12] gh-106368: Add tests for permutation helpers in Argument Clinic (GH-106407) (#106409)
Added new test class PermutationTests()
(cherry picked from commit 8f6df5e9cb)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-04 14:17:05 +02:00
Miss Islington (bot)
b84365fe3e
[3.12] gh-106368: Increase Argument Clinic test coverage (GH-106389) (#106390)
Add:

- test_disallowed_gropuing__no_matching_bracket
- test_double_slash
(cherry picked from commit 3406f8cce5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-04 00:26:44 +00:00
Miss Islington (bot)
6720003dae
[3.12] gh-106368: Harden Argument Clinic parser tests (GH-106384) (#106387)
(cherry picked from commit 648688c137)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-03 23:37:47 +00:00
Erlend E. Aasland
38fe0e7c2d
[3.12] gh-106368: Clean up Argument Clinic tests (#106373) (#106379)
(cherry picked from commit 3ee8dac7a1)
2023-07-03 22:27:34 +00:00
Miss Islington (bot)
ddff4737bd
[3.12] gh-106368: Increase Argument Clinic test coverage (GH-106369) (#106370)
Add tests for 'self' and 'defining_class' converter requirements.
(cherry picked from commit 7f4c8121db)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-03 20:45:49 +00:00
Miss Islington (bot)
5f20152f01
[3.12] gh-106359: Fix corner case bugs in Argument Clinic converter parser (GH-106361) (#106364)
gh-106359: Fix corner case bugs in Argument Clinic converter parser (GH-106361)

DSLParser.parse_converter() could return unusable kwdicts in some rare cases

(cherry picked from commit 0da4c883cf)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 13:42:20 +00:00
Alex Waygood
64d1b44a54
gh-104683: clinic.py: Improve coverage for the parse_converter method (#104729) 2023-05-21 23:00:47 +00:00
Erlend E. Aasland
86ee49f469
gh-104629: Don't skip test_clinic if _testclinic is missing (#104630)
Just skip the tests that depend on the _testclinic extension module;
we can still run the Python tests.
2023-05-19 00:56:34 +02:00
Erlend E. Aasland
b2c1b4da19
gh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)
Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/
2023-05-12 10:34:00 +02:00
Erlend E. Aasland
45a9e3834a
gh-64595: Argument Clinic: Touch source file if any output file changed (#104152) 2023-05-05 12:38:38 +00:00
Erlend E. Aasland
d0b4abedfb
gh-64631: Test exception messages in cloned Argument Clinic funcs (#104167) 2023-05-05 14:08:24 +02:00
colorfulappl
0da728387c
gh-64490: Fix bugs in argument clinic varargs processing (#32092) 2022-11-24 20:56:50 +01:00
colorfulappl
8dbe08eb7c
gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241)
Fix double-free bug mentioned at https://github.com/python/cpython/issues/99240,
by moving memory clean up out of "exit" label.

Automerge-Triggered-By: GH:erlend-aasland
2022-11-24 06:01:26 -08:00
colorfulappl
69f6cc77d0
gh-64490: Fix refcount error when arguments are packed to tuple in argument clinic (#99233) 2022-11-24 17:54:18 +05:30
colorfulappl
c450c8c9ed
gh-96002: Add functional test for Argument Clinic (#96178)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-21 15:08:45 +01:00
Irit Katriel
34e6f3567e
gh-92886: [clinic.py] raise exception on invalid input instead of assertion (GH-98051)
Tests should pass with -O (assertions off).

Automerge-Triggered-By: GH:iritkatriel
2022-10-07 14:41:35 -07:00
Victor Stinner
8fba9523cf
bpo-42398: Fix "make regen-all" race condition (GH-23362)
Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.

The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:

* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
  from source files (ex: Modules/_weakref.c) and clinic files (ex:
  Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
  (ex: Modules/clinic/_weakref.c.h)

Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).

Fix clinic.py to make all file writes atomic:

* Add write_file() function to ensure that all file writes are
  atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
  content does not change to avoid modifying the file modification
  file.
* Update test_clinic to verify these assertions with a functional
  test.
* Remove Clinic.force attribute which was no longer used, whereas
  Clinic.verify remains useful.
2020-11-18 15:36:27 +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
Eric Snow
ee536b2020
bpo-36876: Add a tool that identifies unsupported global C variables. (#15877) 2019-09-11 19:49:45 +01:00
Serhiy Storchaka
837c7dc1ed
bpo-35578: Add an example file for testing Argument Clinic converters. (GH-11306) 2018-12-25 10:17:28 +02:00
Victor Stinner
65fc98e7b1
bpo-26901: Fix the Argument Clinic test suite (GH-8879)
* Fix Tools/clinic/clinic_test.py: add missing
  FakeClinic.destination_buffers attribute and pass a file argument
  to Clinic().
* Rename Tools/clinic/clinic_test.py to Lib/test/test_clinic.py:
  add temporary Tools/clinic/ to sys.path to import the clinic
  module.

Co-Authored-By: Pablo Galindo <pablogsal@gmail.com>
2018-09-03 23:17:20 +02:00
Renamed from Tools/clinic/clinic_test.py (Browse further)