Commit graph

24 commits

Author SHA1 Message Date
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)