cpython/Objects/stringlib
Victor Stinner be5e8a0103
gh-110964: Remove private _PyArg functions (#110966)
Move the following private functions and structures to
pycore_modsupport.h internal C API:

* _PyArg_BadArgument()
* _PyArg_CheckPositional()
* _PyArg_NoKeywords()
* _PyArg_NoPositional()
* _PyArg_ParseStack()
* _PyArg_ParseStackAndKeywords()
* _PyArg_Parser structure
* _PyArg_UnpackKeywords()
* _PyArg_UnpackKeywordsWithVararg()
* _PyArg_UnpackStack()
* _Py_ANY_VARARGS()

Changes:

* Python/getargs.h now includes pycore_modsupport.h to export
  functions.
* clinic.py now adds pycore_modsupport.h when one of these functions
  is used.
* Add pycore_modsupport.h includes when a C extension uses one of
  these functions.
* Define Py_BUILD_CORE_MODULE in C extensions which now include
  directly or indirectly (via code generated by Argument Clinic)
  pycore_modsupport.h:

  * _csv
  * _curses_panel
  * _dbm
  * _gdbm
  * _multiprocessing.posixshmem
  * _sqlite.row
  * _statistics
  * grp
  * resource
  * syslog

* _testcapi: bad_get() no longer uses METH_FASTCALL calling
  convention but METH_VARARGS. Replace _PyArg_UnpackStack() with
  PyArg_ParseTuple().
* _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined
  by _testcapi sub-modules which need the internal C API
  (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c,
  watchers.c.
* Remove Include/cpython/modsupport.h header file.
  Include/modsupport.h no longer includes the removed header file.
* Fix mypy clinic.py
2023-10-17 14:30:31 +02:00
..
clinic gh-110964: Remove private _PyArg functions (#110966) 2023-10-17 14:30:31 +02:00
asciilib.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
codecs.h gh-92536: Remove PyUnicode_READY() calls (#105210) 2023-06-02 01:33:17 +02:00
count.h gh-97982: Remove asciilib_count() (#98164) 2022-10-11 17:59:58 +02:00
ctype.h bpo-35081: Move bytes_methods.h to the internal C API (GH-18492) 2020-02-12 22:32:34 +01:00
eq.h gh-89653: PEP 670: Convert PyUnicode_KIND() macro to function (#92705) 2022-05-13 11:49:56 +02:00
fastsearch.h gh-94808: improve comments and coverage of fastsearch.h (GH-96760) 2022-09-13 14:25:10 -04:00
find.h Issue #26765: Moved common code and docstrings for bytes and bytearray methods 2016-05-04 22:23:26 +03:00
find_max_char.h bpo-43179: Generalise alignment for optimised string routines (GH-24624) 2021-03-31 12:12:39 +02:00
join.h gh-99300: Use Py_NewRef() in Objects/ directory (#99354) 2022-11-10 23:58:07 +01:00
localeutil.h gh-89653: Use int type for Unicode kind (#92704) 2022-05-13 12:41:05 +02:00
partition.h bpo-40521: Make empty Unicode string per interpreter (GH-21096) 2020-06-24 00:10:40 +02:00
README.txt gh-105156: Cleanup usage of old Py_UNICODE type (#105158) 2023-06-01 07:18:09 +00:00
replace.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
split.h bpo-46670: Define all macros for stringlib (GH-31176) 2022-02-07 01:26:58 +01:00
stringdefs.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
stringlib_find_two_way_notes.txt gh-94808: improve comments and coverage of fastsearch.h (GH-96760) 2022-09-13 14:25:10 -04:00
transmogrify.h gh-99300: Use Py_NewRef() in Objects/ directory (#99354) 2022-11-10 23:58:07 +01:00
ucs1lib.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
ucs2lib.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
ucs4lib.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
undef.h gh-93033: Use wmemchr in stringlib (GH-93034) 2022-05-24 10:45:31 +09:00
unicode_format.h gh-106320: Add pycore_complexobject.h header file (#106339) 2023-07-02 21:19:59 +00:00

bits shared by the bytesobject and unicodeobject implementations (and
possibly other modules, in a not too distant future).

the stuff in here is included into relevant places; see the individual
source files for details.

--------------------------------------------------------------------
the following defines used by the different modules:

STRINGLIB_CHAR

    the type used to hold a character (char, Py_UCS1, Py_UCS2 or Py_UCS4)

STRINGLIB_GET_EMPTY()

    returns a PyObject representing the empty string, only to be used if
    STRINGLIB_MUTABLE is 0. It must not be NULL.

Py_ssize_t STRINGLIB_LEN(PyObject*)

    returns the length of the given string object (which must be of the
    right type)

PyObject* STRINGLIB_NEW(STRINGLIB_CHAR*, Py_ssize_t)

    creates a new string object

STRINGLIB_CHAR* STRINGLIB_STR(PyObject*)

    returns the pointer to the character data for the given string
    object (which must be of the right type)

int STRINGLIB_CHECK_EXACT(PyObject *)

    returns true if the object is an instance of our type, not a subclass

STRINGLIB_MUTABLE

    must be 0 or 1 to tell the cpp macros in stringlib code if the object
    being operated on is mutable or not