summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-297-51/+25
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-40429: Refactor super_init() (GH-19776)Victor Stinner2020-04-291-64/+85
| | | | Add super_init_without_args() sub-function. Hold a strong reference to the frame code object while calling super_init_without_args().
* bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)Victor Stinner2020-04-282-2/+3
|
* bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)Victor Stinner2020-04-283-31/+36
| | | Add frame_nslots() to factorize duplicate code.
* bpo-40421: Add PyFrame_GetCode() function (GH-19757)Victor Stinner2020-04-282-2/+9
| | | | | | | | | PyFrame_GetCode(frame): return a borrowed reference to the frame code. Replace frame->f_code with PyFrame_GetCode(frame) in most code, except in frameobject.c, genobject.c and ceval.c. Also add PyFrame_GetLineNumber() to the limited C API.
* bpo-40421: Add pyframe.h header file (GH-19755)Victor Stinner2020-04-281-2/+5
| | | | | | | | | | Add a new separated pyframe.h header file of the PyFrame public C API: it is included by Python.h. Add PyFrame_GetLineNumber() to the limited C API. Replace "struct _frame" with "PyFrameObject" in header files. PyFrameObject is now defined as struct _frame by pyframe.h which is included early enough in Python.h.
* bpo-40217: Clean code in PyType_FromSpec_Alloc and add NEWS entry (GH-19733)Pablo Galindo2020-04-271-9/+17
|
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Pablo Galindo2020-04-271-1/+83
| | | | PyType_FromSpec types (GH-19414)
* Update ga_new to use _PyArg_CheckPositional and _PyArg_NoKwnames (GH-19679)Dong-hee Na2020-04-231-4/+2
|
* bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)sweeneyde2020-04-226-3/+434
| | | | | Added str.removeprefix and str.removesuffix methods and corresponding bytes, bytearray, and collections.UserString methods to remove affixes from a string if present. See PEP 616 for a full description.
* bpo-40302: UTF-32 encoder SWAB4() macro use a|b rather than a+b (GH-19572)Victor Stinner2020-04-171-1/+1
|
* bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)Victor Stinner2020-04-171-1/+1
| | | | | | | | | * Replace PY_INT64_T with int64_t * Replace PY_UINT32_T with uint32_t * Replace PY_UINT64_T with uint64_t sha3module.c no longer checks if PY_UINT64_T is defined since it's always defined and uint64_t is always available on platforms supported by Python.
* bpo-40302: Add pycore_byteswap.h header file (GH-19552)Victor Stinner2020-04-171-16/+20
| | | | | | | | | | | | | | Add a new internal pycore_byteswap.h header file with the following functions: * _Py_bswap16() * _Py_bswap32() * _Py_bswap64() Use these functions in _ctypes, sha256 and sha512 modules, and also use in the UTF-32 encoder. sha256, sha512 and _ctypes modules are now built with the internal C API.
* bpo-40268: Remove unused osdefs.h includes (GH-19532)Victor Stinner2020-04-151-3/+5
| | | When the include is needed, add required symbol in a comment.
* bpo-40268: Remove unused pycore_pymem.h includes (GH-19531)Victor Stinner2020-04-1511-12/+3
|
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-1521-37/+36
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464)Hai Shi2020-04-141-2/+2
|
* bpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515)Victor Stinner2020-04-141-0/+1
|
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-1424-34/+26
|
* bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)Victor Stinner2020-04-143-9/+9
| | | | | | | Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
* bpo-40268: Include explicitly pycore_interp.h (GH-19505)Victor Stinner2020-04-144-2/+6
| | | | pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
* bpo-39481: Make weakref and WeakSet generic (GH-19497)Ethan Smith2020-04-141-1/+7
|
* bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)Victor Stinner2020-04-134-19/+15
| | | | | | | | Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig()
* bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. ↵Serhiy Storchaka2020-04-125-14/+15
| | | | (GH-19472)
* bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode ↵Serhiy Storchaka2020-04-115-141/+172
| | | | data. (GH-19345)
* bpo-39481: PEP 585 for enumerate, AsyncGeneratorType, mmap (GH-19421)Ethan Smith2020-04-102-0/+4
|
* bpo-39943: Keep constness of pointer objects. (19405)Andy Lester2020-04-101-6/+5
| | | | | | | | | * Keep constness of pointer objects. Also moved an auto variable that got consted into its innermost necessary scope. * move def Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-40170: Remove PyIndex_Check() macro (GH-19428)Victor Stinner2020-04-081-2/+0
| | | | | Always declare PyIndex_Check() as an opaque function to hide implementation details: remove PyIndex_Check() macro. The macro accessed directly the PyTypeObject.tp_as_number member.
* bpo-40170: Add _PyIndex_Check() internal function (GH-19426)Victor Stinner2020-04-0811-27/+40
| | | | | | | | | Add _PyIndex_Check() function to the internal C API: fast inlined verson of PyIndex_Check(). Add Include/internal/pycore_abstract.h header file. Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects and Python subdirectories.
* bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)Victor Stinner2020-04-072-25/+32
| | | | | | | | PyType_HasFeature() now always calls PyType_GetFlags() to hide implementation details. Previously, it accessed directly the PyTypeObject.tp_flags member when the limited C API was not used. Add fast inlined version _PyType_HasFeature() and _PyType_IS_GC() for object.c and typeobject.c.
* bpo-40170: Convert PyObject_CheckBuffer() macro to a function (GH-19376)Victor Stinner2020-04-071-0/+10
| | | | | Convert PyObject_CheckBuffer() macro to a function to hide implementation details: the macro accessed directly the PyTypeObject.tp_as_buffer member.
* bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)Victor Stinner2020-04-073-6/+7
| | | | | | | | | | | | The PyObject_NEW() macro becomes an alias to the PyObject_New() macro, and the PyObject_NEW_VAR() macro becomes an alias to the PyObject_NewVar() macro, to hide implementation details. They no longer access directly the PyTypeObject.tp_basicsize member. Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from the limited C API. Replace PyObject_NEW() with PyObject_New() and replace PyObject_NEW_VAR() with PyObject_NewVar().
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-077-0/+520
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-37388: Don't check encoding/errors during finalization (GH-19409)Victor Stinner2020-04-071-0/+6
| | | | | | | | | str.encode() and str.decode() no longer check the encoding and errors in development mode or in debug mode during Python finalization. The codecs machinery can no longer work on very late calls to str.encode() and str.decode(). This change should help to call _PyObject_Dump() to debug during late Python finalization.
* bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function (GH-19377)Victor Stinner2020-04-063-2/+11
| | | | | | | | Convert the PyObject_GET_WEAKREFS_LISTPTR() macro to a function to hide implementation details: the macro accessed directly to the PyTypeObject.tp_weaklistoffset member. Add _PyObject_GET_WEAKREFS_LISTPTR() static inline function to the internal C API.
* bpo-37207: Use PEP 590 vectorcall to speed up dict() (GH-19280)Dong-hee Na2020-04-021-0/+33
|
* bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)Serhiy Storchaka2020-04-011-49/+46
| | | | | Make it a static function, and pass known attributes (kind, data, length) instead of the PyUnicode object.
* bpo-37207: Use vectorcall for list() (GH-18928)Petr Viktorin2020-03-301-0/+28
| | | | | | | Speed up calls to list() by using the PEP 590 vectorcall calling convention. Patch by Mark Shannon. Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-39943: Properly const the pointers in dictkeys_get_index (GH-19170)Andy Lester2020-03-261-5/+5
|
* bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157)Victor Stinner2020-03-253-27/+21
|
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-0/+1
|
* bpo-37207: Use PEP 590 vectorcall to speed up frozenset() (GH-19053)Dong-hee Na2020-03-181-18/+50
|
* bpo-38373: Change list overallocating strategy. (GH-18952)Serhiy Storchaka2020-03-171-6/+8
| | | | | * Add padding to make the allocated size multiple of 4. * Do not overallocate if the new size is closer to overalocated size than to the old size.
* bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)Victor Stinner2020-03-171-23/+13
| | | | | | | | | | | | | Extension modules: m_traverse, m_clear and m_free functions of PyModuleDef are no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_exec function). More precisely, these functions are not called if m_size is greater than 0 and the module state (as returned by PyModule_GetState()) is NULL. Extension modules without module state (m_size <= 0) are not affected. Co-Authored-By: Petr Viktorin <encukou@gmail.com>
* bpo-37207: Use PEP 590 vectorcall to speed up set() constructor (GH-19019)Dong-hee Na2020-03-161-0/+23
|
* bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)Dong-hee Na2020-03-162-4/+2
|
* bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)Dong-hee Na2020-03-161-2/+2
|
* Fix a possible refleak in tupleobject.c (GH-19018)Hai Shi2020-03-151-1/+3
|
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer()" (GH-18985)Inada Naoki2020-03-141-35/+0
| | | | | | | * Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)" This reverts commit c7ad974d341d3edb6b9d2a2dcae4d3d4794ada6b. * Update unicodeobject.h
* bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)Inada Naoki2020-03-141-0/+35
| | | Co-authored-by: Victor Stinner <vstinner@python.org>