summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)Petr Viktorin2022-02-111-1/+1
| | | | | * Make PyType_GetModuleByDef public (remove underscore) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351)Erlend Egeberg Aasland2021-06-171-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make functools types immutable * Multibyte codec types are now immutable * pyexpat.xmlparser is now immutable * array.arrayiterator is now immutable * _thread types are now immutable * _csv types are now immutable * _queue.SimpleQueue is now immutable * mmap.mmap is now immutable * unicodedata.UCD is now immutable * sqlite3 types are now immutable * _lsprof.Profiler is now immutable * _overlapped.Overlapped is now immutable * _operator types are now immutable * winapi__overlapped.Overlapped is now immutable * _lzma types are now immutable * _bz2 types are now immutable * _dbm.dbm and _gdbm.gdbm are now immutable
* bpo-43916: Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to selected types (GH-25748)Erlend Egeberg Aasland2021-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | | Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to the following types: * _dbm.dbm * _gdbm.gdbm * _multibytecodec.MultibyteCodec * _sre..SRE_Scanner * _thread._localdummy * _thread.lock * _winapi.Overlapped * array.arrayiterator * functools.KeyWrapper * functools._lru_list_elem * pyexpat.xmlparser * re.Match * re.Pattern * unicodedata.UCD * zlib.Compress * zlib.Decompress
* bpo-42866: Add traverse func to _multibytecodec.MultibyteCodec (GH-24166)Victor Stinner2021-01-081-3/+13
| | | | Convert _multibytecodec.MultibyteCodec type to a GC type and adds a traverse function.
* bpo-42866: Fix refleak in CJK getcodec() (GH-24165)Victor Stinner2021-01-081-0/+1
| | | Fix a reference leak in the getcodec() function of CJK codecs.
* bpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)Victor Stinner2021-01-071-29/+39
| | | | | | | | | | | Convert the 6 CJK codec extension modules (_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw) to the multiphase initialization API (PEP 489). Remove getmultibytecodec() local cache: always import _multibytecodec. It should be uncommon to get a codec. For example, this function is only called once per CJK codec module. Fix a reference leak in register_maps() error path.
* bpo-1635741: Convert _multibytecodec to multi-phase init (GH-24095)Erlend Egeberg Aasland2021-01-042-261/+218
| | | | Convert the _multibytecodec extension module (CJK codecs) to multi-phase initialization (PEP 489).
* bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)Victor Stinner2020-12-011-1/+1
| | | | | | | | | No longer use deprecated aliases to functions: * Replace PyObject_MALLOC() with PyObject_Malloc() * Replace PyObject_REALLOC() with PyObject_Realloc() * Replace PyObject_FREE() with PyObject_Free() * Replace PyObject_Del() with PyObject_Free() * Replace PyObject_DEL() with PyObject_Free()
* bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner2020-12-011-2/+2
| | | | | | | | | | | No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
* bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)Serhiy Storchaka2020-05-261-11/+1
| | | | Only __index__ should be used to make integer conversions lossless.
* bpo-40328: Add tool for generating cjk mapping headers (GH-19602)Dong-hee Na2020-04-295-3/+6
|
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. ↵Serhiy Storchaka2020-04-121-1/+1
| | | | (GH-19472)
* bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode ↵Serhiy Storchaka2020-04-113-4/+4
| | | | data. (GH-19345)
* bpo-40024: Update C extension modules to use PyModule_AddType() (GH-19119)Dong-hee Na2020-03-241-8/+4
| | | | | | Update _asyncio, _bz2, _csv, _curses, _datetime, _io, _operator, _pickle, _queue, blake2, multibytecodec and overlapped C extension modules to use PyModule_AddType().
* bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)Andy Lester2020-03-041-1/+1
|
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)Victor Stinner2020-02-072-2/+2
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-38631: Avoid Py_FatalError() in _multibytecodec init (GH-17233)Victor Stinner2019-11-181-1/+0
| | | | | If an exception is raised and PyInit__multibytecodec() returns NULL, Python reports properly the exception to the user. There is no need to crash Python with Py_FatalError().
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-141-4/+4
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* bpo-37034: Display argument name on errors with keyword arguments with ↵Rémi Lapeyre2019-08-291-7/+7
| | | | Argument Clinic. (GH-13593)
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)Jeroen Demeyer2019-07-111-2/+2
|
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-042-13/+3
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-10/+10
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-35194: cjkcodec: check the encoded value is not truncated (GH-10432)Alexey Izbyshev2019-03-291-18/+20
|
* bpo-36127: Argument Clinic: inline parsing code for keyword parameters. ↵Serhiy Storchaka2019-03-141-13/+107
| | | | (GH-12058)
* bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)Serhiy Storchaka2019-01-111-10/+19
| | | | | Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
* bpo-35582: Argument Clinic: inline parsing code for positional parameters. ↵Serhiy Storchaka2019-01-111-3/+3
| | | | (GH-11313)
* bpo-23867: Argument Clinic: inline parsing code for a single positional ↵Serhiy Storchaka2018-12-251-3/+7
| | | | parameter. (GH-9689)
* bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. ↵Zackery Spytz2018-12-171-0/+4
| | | | (GH-11175)
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Serhiy Storchaka2018-11-271-1/+1
| | | Fix also return type for few other functions (clear, releasebuffer).
* bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. ↵Serhiy Storchaka2018-11-271-8/+8
| | | | | | | | (GH-6748) Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS in Argument Clinic generated code.
* cjkcodecs: Fix compiler warning (GH-10651)Victor Stinner2018-11-221-2/+2
| | | | | | | | | Fixed the following compiler warning in multibytecodec.c: warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data Cast Py_ssize_t to unsigned char: the maximum value is checked on the previous line.
* bpo-35194: Fix a wrong constant in cp932 codec (GH-10420)Alexey Izbyshev2018-11-091-1/+1
| | | | | | | | | | | This typo doesn't affect the result because wrong bits are discarded on implicit conversion to unsigned char, but it trips UBSan with -fsanitize=implicit-integer-truncation. https://bugs.python.org/issue35194
* bpo-33578: Fix getstate/setstate for CJK decoder (GH-10290)Christopher Thorne2018-11-021-5/+22
| | | | Previous version was casting to Py_ssize_t incorrectly and exhibited unexpected behavior on big-endian systems.
* bpo-33578: Add getstate/setstate for CJK codec (GH-6984)Christopher Thorne2018-11-014-22/+273
| | | | | | | | This implements getstate and setstate for the cjkcodecs multibyte incremental encoders/decoders, primarily to fix issues with seek/tell. The encoder getstate/setstate is slightly tricky as the "state" is pending bytes + MultibyteCodec_State but only an integer can be returned. The approach I've taken is to encode this data into a long, similar to how .tell() encodes a "cookie_type" as a long. https://bugs.python.org/issue33578
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-151-8/+8
| | | | arguments. (#4746)
* bpo-31275: Small refactoring to silence a fall-through warning. (#3206)Stefan Krah2017-08-251-8/+2
|
* bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)Serhiy Storchaka2017-07-031-20/+8
| | | | | the bare METH_FASTCALL be used for functions with positional-only parameters.
* bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)Sylvain2017-06-101-13/+13
| | | | | | | | The function '_PyArg_ParseStack()' and '_PyArg_UnpackStack' were failing (with error "XXX() takes Y argument (Z given)") before the function '_PyArg_NoStackKeywords()' was called. Thus, the latter did not raise its more meaningful error : "XXX() takes no keyword arguments".
* bpo-30003: Fix handling escape characters in HZ codec (#1556)Xiang Zhang2017-05-221-13/+12
|
* bpo-29990: Fix range checking in GB18030 decoder (#1495)Xiang Zhang2017-05-091-1/+3
| | | When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
* bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)Serhiy Storchaka2017-04-191-0/+3
| | | | | | raised an error. Replace them with using concrete types API that never fails if appropriate.
* bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)Serhiy Storchaka2017-03-121-4/+4
|
* Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-171-10/+22
| | | | | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code.
* Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-171-1/+1
| | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments.
* Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywordsVictor Stinner2017-01-171-4/+4
| | | | Issue #29286.
* Use _PyObject_CallMethodIdObjArgs()Victor Stinner2016-12-091-2/+2
| | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() in various modules when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.