Serhiy Storchaka
7c3e8e5af0
[3.12] gh-110628: Add tests for PyLong C API (GH-110629) (GH-110854)
...
(cherry picked from commit 9d40ebf190 )
2023-10-14 10:20:24 +03:00
Miss Islington (bot)
1c44f881c7
[3.12] gh-110815: Improve tests for PyArg_ParseTupleAndKeywords() (GH-110817) (GH-110825)
...
(cherry picked from commit 548ce0923b )
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-13 13:41:43 +00:00
Serhiy Storchaka
5afac0cf8d
[3.12] gh-110549: Remove unused includes of <stddef.h> in _testcapi (GH-110552) (GH-110553)
...
(cherry picked from commit 89df5b73d0 )
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-10-09 11:43:35 +00:00
Miss Islington (bot)
b2419eff95
[3.12] gh-110525: Cover PySet_Add corner case with frozenset objects (GH-110544) (GH-110554)
...
(cherry picked from commit ea39c877c0 )
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-10-09 11:40:53 +00:00
Nikita Sobolev
3ed5cb0de3
[3.12] gh-110525: Add CAPI tests for set and frozenset objects (GH-110526). (GH-110547)
...
(cherry picked from commit c49edd7d9c )
2023-10-09 10:04:09 +00:00
Miss Islington (bot)
ddc0adcdb3
[3.12] gh-109469: Silence compiler warnings on string comparisons in _testcapi (GH-109533) ( #109558 )
...
gh-109469: Silence compiler warnings on string comparisons in _testcapi (GH-109533)
(cherry picked from commit ed582a2ed9 )
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-02 16:59:43 +02:00
Serhiy Storchaka
e65401d245
[3.12] C API tests: use special markers to test that output parameters were set (GH-109014) ( #109023 )
...
[3.12] C API tests: use special markers to test that output parameters were set (GH-109014).
(cherry picked from commit bf414b7fcb )
2023-09-08 15:09:49 +02:00
Miss Islington (bot)
ba7e06bb63
[3.12] Add Modules/_testcapi/util.h header (GH-108774) ( #108780 )
...
Add Modules/_testcapi/util.h header (GH-108774)
It contains common macros used in C API tests.
(cherry picked from commit 0e01fac315 )
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-02 23:43:14 +02:00
Miss Islington (bot)
97d67e9dab
[3.12] gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918) ( #108134 )
...
* gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918)
Such C API functions as PyErr_SetString(), PyErr_Format(),
PyErr_SetFromErrnoWithFilename() and many others no longer crash or
ignore errors if it failed to format the error message or decode the
filename. Instead, they keep a corresponding error.
(cherry picked from commit 633ea217a8 )
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Define PY_SSIZE_T_CLEAN.
---------
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-20 23:07:24 +02:00
Serhiy Storchaka
9c8dfcec64
[3.12] gh-107178: Add the C API tests for the Abstract Objects Layer (GH-107179) ( #107728 )
...
Cover all the Mapping Protocol, almost all the Sequence Protocol
(except PySequence_Fast) and a part of the Object Protocol.
Move existing tests to Lib/test/test_capi/test_abstract.py and
Modules/_testcapi/abstract.c.
Add also tests for PyDict C API..
(cherry picked from commit 16c9415fba )
2023-08-16 14:29:08 +02:00
Miss Islington (bot)
98dd9d9725
[3.12] gh-91054: make code watcher tests resilient to other watchers (GH-107821) ( #107835 )
...
gh-91054: make code watcher tests resilient to other watchers (GH-107821)
(cherry picked from commit 2ec16fed14 )
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-08-11 16:13:14 +02:00
Miss Islington (bot)
4be0f157ea
[3.12] gh-47146: Fix reference counting in _testcapi.structmember initializer (GH-106862) (GH-106953)
...
(cherry picked from commit 8d397ee825 )
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-21 14:48:50 +03:00
Serhiy Storchaka
2da967ea14
[3.12] gh-99593: Add tests for Unicode C API (part 3) (GH-104728) (GH-106595)
...
Add tests for codecs.
(cherry picked from commit 51ea664d18 )
2023-07-10 20:58:58 +03:00
Miss Islington (bot)
887a7e6036
[3.12] gh-91053: make func watcher tests resilient to other func watchers (GH-106286) ( #106365 )
...
gh-91053: make func watcher tests resilient to other func watchers (GH-106286)
(cherry picked from commit 58906213cc )
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-07-03 09:13:21 -06:00
Serhiy Storchaka
9cd366462b
[3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and Py… ( #106041 )
...
[3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)
These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt. They should not be
used in new code.
(cherry picked from commit 1d33d53780 )
2023-06-24 16:36:34 -07:00
Miss Islington (bot)
2eed1f5868
[3.12] gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386) (GH-105697)
...
gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386)
(cherry picked from commit 2b90796be6 )
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-06-12 16:24:21 +00:00
Miss Islington (bot)
4fbbf699c0
[3.12] gh-105375: Harden error handling in _testcapi/heaptype.c (GH-105608) ( #105615 )
...
Bail on first error in heapctypesubclasswithfinalizer_finalize()
(cherry picked from commit d636d7dfe7 )
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-09 23:21:42 +00:00
Irit Katriel
b45df737d4
[3.12] gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* implementation in the unstable API (GH-105072) ( #105095 )
...
(cherry picked from commit b7aadb4583 )
2023-05-30 16:50:23 +01:00
Serhiy Storchaka
f3466bc040
gh-98836: Extend PyUnicode_FromFormat() (GH-98838)
...
* Support for conversion specifiers o (octal) and X (uppercase hexadecimal).
* Support for length modifiers j (intmax_t) and t (ptrdiff_t).
* Length modifiers are now applied to all integer conversions.
* Support for wchar_t C strings (%ls and %lV).
* Support for variable width and precision (*).
* Support for flag - (left alignment).
2023-05-22 00:32:39 +03:00
Mark Shannon
93923793f6
GH-101291: Add low level, unstable API for pylong (GH-101685)
...
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-05-21 14:45:48 +01:00
Dong-hee Na
2e91c7e626
gh-104469: Convert _testcapi/exceptions to use AC (gh-104502)
2023-05-21 18:39:45 +09:00
Dong-hee Na
b58bc8c2a9
gh-104469: Update README.txt for _testcapi (gh-104529)
...
* gh-104469: Update README.txt for _testcapi
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2023-05-17 12:56:20 +09:00
Nikita Sobolev
456d56698d
gh-104469: Convert _testcapi/watchers.c to use Argument Clinic ( #104503 )
...
Remove boilerplate code by converting the following functions:
- _testcapi.watch_dict
- _testcapi.unwatch_dict
- _testcapi.watch_type
- _testcapi.unwatch_type
- _testcapi.set_func_defaults_via_capi
- _testcapi.set_func_kwdefaults_via_capi
2023-05-15 22:59:41 +02:00
Dong-hee Na
48b3617de4
gh-104469 Convert _testcapi/float.c to use AC (gh-104470)
2023-05-15 12:44:00 +09:00
Jurica Bradarić
19ee53d52e
gh-93649: Split gc- and allocation tests from _testcapimodule.c (GH-104403)
2023-05-12 10:26:07 +01:00
Hugo van Kemenade
d513ddee94
Trim trailing whitespace and test on CI ( #104275 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-08 17:03:52 +03:00
Serhiy Storchaka
2ba931ff72
gh-99593: Add tests for Unicode C API (part 2) ( #99868 )
...
Add tests for lower-level functions.
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-04 15:25:09 +00:00
Jelle Zijlstra
04f6733275
gh-102500: Implement PEP 688 ( #102521 )
...
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-05-04 07:59:46 -07:00
Petr Viktorin
cd9a56c2b0
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
...
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-04 09:56:53 +02:00
Petr Viktorin
524a7f77fd
gh-103968: Deprecate creating heap types whose metaclass has custom tp_new. (GH-103972)
...
(That's a mouthful of an edge case!)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-03 15:17:14 +02:00
Dong-hee Na
d81ca7ec02
gh-84436: Add integration C API tests for immortal objects (gh-103962)
2023-05-03 00:05:30 +09:00
Liyang Zhang
11ed70b1dc
Fix typos in faulthandler, testcapi error messages ( #103020 )
2023-03-25 14:27:02 -07:00
Mark Shannon
7559f5fda9
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
...
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.
* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.
* Add functions to hide some internals of long object, and for setting sign and digit count.
* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
2023-03-22 14:49:51 +00:00
Artem Mukhin
0a60deaeaf
GH-94808: Cover PyOS_mystrnicmp and PyOS_mystricmp (gh-102469)
2023-03-22 20:35:27 +09:00
Irit Katriel
5c471f3f2a
gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover PyErr_Display as well (GH-102849)
2023-03-21 10:36:18 +01:00
Irit Katriel
3f9285a8c5
gh-102755: Add PyErr_DisplayException(exc) ( #102756 )
2023-03-16 22:18:04 +00:00
Irit Katriel
51d693c584
gh-102594: PyErr_SetObject adds note to exception raised on normalization error ( #102675 )
2023-03-16 10:16:01 +00:00
Carl Meyer
1e703a4733
gh-102381: don't call watcher callback with dead object ( #102382 )
...
Co-authored-by: T. Wouters <thomas@python.org>
2023-03-07 17:10:58 -07:00
Irit Katriel
a33ca2ad1f
gh-102493: fix normalization in PyErr_SetObject ( #102502 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-03-07 13:27:46 -08:00
Dong-hee Na
ed55c69ebd
gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)
2023-03-02 20:32:05 +09:00
Petr Viktorin
6b2d7c0ddb
gh-101101: Unstable C API tier (PEP 689) (GH-101102)
2023-02-28 09:31:01 +01:00
Irit Katriel
2db23d10bf
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Modules/) ( #102196 )
2023-02-24 21:43:03 +00:00
Erlend E. Aasland
efc985a714
gh-93649: Split exception tests from _testcapimodule.c (GH-102173)
...
Automerge-Triggered-By: GH:erlend-aasland
2023-02-23 07:03:13 -08:00
Mark Shannon
feec49c407
GH-101578: Normalize the current exception (GH-101607)
...
* Make sure that the current exception is always normalized.
* Remove redundant type and traceback fields for the current exception.
* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException
* Add new API functions: PyException_GetArgs, PyException_SetArgs
2023-02-08 09:31:12 +00:00
Erlend E. Aasland
2b38a9aa74
gh-93649: Split tracemalloc tests from _testcapimodule.c ( #99551 )
2022-12-17 09:53:36 +01:00
colorfulappl
efbb1eb9f5
gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing ( #99890 )
...
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-17 12:07:44 +05:30
Itamar Ostricher
ae83c78215
GH-100000: Cleanup and polish various watchers code (GH-99998)
...
* Initialize `type_watchers` array to `NULL`s
* Optimize code watchers notification
* Optimize func watchers notification
2022-12-14 19:14:16 +00:00
Itamar Ostricher
1012dc1b43
GH-91054: Reset static events counts in code watchers tests ( #99978 )
2022-12-04 12:38:21 +00:00
Itamar Ostricher
3c137dc613
GH-91054: Add code object watchers API (GH-99859)
...
* Add API to allow extensions to set callback function on creation and destruction of PyCodeObject
Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
2022-12-02 17:28:27 +00:00
Serhiy Storchaka
f08e52ccb0
gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data (GH-99613)
...
Previously *consumed was not set in this case.
2022-12-01 14:54:51 +02:00