summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-39573: Add Py_SET_REFCNT() function (GH-18389)Victor Stinner2020-02-073-7/+8
| | | | Add a Py_SET_REFCNT() function to set the reference counter of an object.
* bpo-39573: Use Py_REFCNT() macro (GH-18388)Victor Stinner2020-02-076-28/+30
| | | | Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
* bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)Victor Stinner2020-02-051-1/+1
| | | | | | _Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when Py_TRACE_REFS is defined. Fix Py_TRACE_REFS build.
* Add PyInterpreterState.fs_codec.utf8 (GH-18367)Victor Stinner2020-02-051-46/+47
| | | | | | Add a fast-path for UTF-8 encoding in PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize(). Add _PyUnicode_FiniEncodings() helper function for _PyUnicode_Fini().
* bpo-39542: Make PyObject_INIT() opaque in limited C API (GH-18363)Victor Stinner2020-02-051-4/+8
| | | | | | | | | | | | | | In the limited C API, PyObject_INIT() and PyObject_INIT_VAR() are now defined as aliases to PyObject_Init() and PyObject_InitVar() to make their implementation opaque. It avoids to leak implementation details in the limited C API. Exclude the following functions from the limited C API, move them from object.h to cpython/object.h: * _Py_NewReference() * _Py_ForgetReference() * _PyTraceMalloc_NewReference() * _Py_GetRefTotal()
* bpo-39543: Remove unused _Py_Dealloc() macro (GH-18361)Victor Stinner2020-02-051-2/+0
| | | | | | | | | | | | The macro is defined after Py_DECREF() and so is no longer used by Py_DECREF(). Moving _Py_Dealloc() macro back from cpython/object.h to object.h would require to move a lot of definitions as well: PyTypeObject and many related types used by PyTypeObject. Keep _Py_Dealloc() as an opaque function call to avoid leaking implementation details in the limited C API (object.h): remove _Py_Dealloc() macro from cpython/object.h.
* bpo-39542: Make _Py_NewReference() opaque in C API (GH-18346)Victor Stinner2020-02-051-1/+17
| | | | | | | | | | _Py_NewReference() becomes a regular opaque function, rather than a static inline function in the C API (object.h), to better hide implementation details. Move _Py_tracemalloc_config from public pymem.h to internal pycore_pymem.h header. Make _Py_AddToAllObjects() private.
* Restore PyObject_IsInstance() comment (GH-18345)Victor Stinner2020-02-041-17/+23
| | | | | | | | | | | | Restore PyObject_IsInstance() comment explaining why only tuples of types are accepted, but not general sequence. Comment written by Guido van Rossum in commit 03290ecbf1661c0192e6abdbe00ae163af461d77 which implements isinstance(x, (A, B, ...)). The comment was lost in a PyObject_IsInstance() optimization: commit ec569b794737be248671d0dfac11b664fc930eef. Cleanup also the code. recursive_isinstance() is no longer recursive, so rename it to object_isinstance(), whereas object_isinstance() is recursive and so rename it to object_recursive_isinstance().
* bpo-39542: Simplify _Py_NewReference() (GH-18332)Victor Stinner2020-02-035-28/+40
| | | | | | | | | * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
* Fixes in sorting descriptions (GH-18317)Stefan Pochmann2020-02-031-8/+8
| | | | | Improvements in listsort.txt and a comment in sortperf.py. Automerge-Triggered-By: @csabella
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-035-234/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-36051: Fix compiler warning. (GH-18325)Inada Naoki2020-02-031-1/+1
|
* Fix 5-space indentation and trailing whitespace (GH-18311)Mark Dickinson2020-02-021-11/+11
|
* bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)Hai Shi2020-01-308-22/+17
| | | Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
* bpo-39434: Improve float __floordiv__ performance and error message (GH-18147)Dong-hee Na2020-01-301-31/+39
|
* bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError() (GH-18278)Victor Stinner2020-01-302-4/+4
| | | | | | | | | Add _Py_NO_RETURN to functions calling Py_FatalError(): * _PyObject_AssertFailed() * dummy_dealloc() * faulthandler_fatal_error_thread() * none_dealloc() * notimplemented_dealloc()
* bpo-38631: Avoid Py_FatalError() in unicodeobject.c (GH-18281)Victor Stinner2020-01-301-23/+28
| | | | | Replace Py_FatalError() calls with _PyErr_WriteUnraisableMsg(), _PyObject_ASSERT_FAILED_MSG() or Py_UNREACHABLE() in unicode_dealloc() and unicode_release_interned().
* bpo-38631: Replace tp_new_wrapper() fatal error with SystemError (GH-18262)Victor Stinner2020-01-301-2/+6
| | | | tp_new_wrapper() now raises a SystemError if called with non-type self, rather than calling Py_FatalError() which cannot be catched.
* bpo-38631: Avoid Py_FatalError() in init_slotdefs() (GH-18263)Victor Stinner2020-01-302-16/+25
| | | | | | Rename init_slotdefs() to _PyTypes_InitSlotDefs() and add a return value of type PyStatus. The function is now called exactly once from _PyTypes_Init(). Replace calls to init_slotdefs() with an assertion checking that slotdefs is initialized.
* bpo-38631: Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() (GH-18258)Victor Stinner2020-01-302-32/+32
| | | | | | | | | | | | | | Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() in object.c and typeobject.c to also dump the involved Python object on a fatal error. It should ease debug when such fatal error occurs. If the double linked list is inconsistent, _Py_ForgetReference() no longer dumps previous and next objects in the fatal error, it now only dumps the current object. It ensures that the error message is displayed even if dumping the object does crash Python. Enhance _Py_ForgetReference() error messages; _PyObject_ASSERT_FAILED_MSG() logs the "_Py_ForgetReference" function name.
* Remove deadcode in _Py_inc_count() (GH-18257)Victor Stinner2020-01-291-2/+0
| | | | (tp->tp_next != NULL) check became redundant with commit 45294a9562e5c360ee8ef8498d8792e05a6eb25e (merged in 2006).
* bpo-36051: Drop GIL during large bytes.join() (GH-17757)Bruce Merry2020-01-291-17/+40
| | | | | Improve multi-threaded performance by dropping the GIL in the fast path of bytes.join. To avoid increasing overhead for small joins, it is only done if the output size exceeds a threshold.
* bpo-38631: Avoid Py_FatalError() in PyCode_New() (GH-18215)Victor Stinner2020-01-271-26/+46
| | | | | | | intern_strings() now raises a SystemError, rather than calling Py_FatalError(). intern_string_constants() now reports exceptions to the caller, rather than ignoring silently exceptions.
* bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214)Victor Stinner2020-01-271-1/+2
| | | | | If the export count is negative, _memory_release() now raises a SystemError and returns -1, rather than calling Py_FatalError() which aborts the process.
* bpo-38631: Avoid Py_FatalError() in PyModule_Create2() (GH-18212)Victor Stinner2020-01-271-2/+5
| | | | | | | If PyModule_Create2() is called when the Python import machinery is not initialized, it now raises a SystemError and returns NULL, instead of calling Py_FatalError() which aborts the process. The caller must be prepared to handle NULL anyway.
* bpo-39453: Add testcase for bpo-39453 (GH-18202)Dong-hee Na2020-01-271-1/+1
| | | | | | | | | https://bugs.python.org/issue39453 Automerge-Triggered-By: @pablogsal Automerge-Triggered-By: @pablogsal
* bpo-39453: Make list.__contains__ hold strong references to avoid crashes ↵Dong-hee Na2020-01-271-1/+6
| | | | (GH-18181)
* bpo-39425: Fix list.count performance regression (GH-18119)Dong-hee Na2020-01-221-0/+4
| | | | | | | https://bugs.python.org/issue39425 Automerge-Triggered-By: @pablogsal
* closes bpo-39415: Remove unused codes from longobject.c complexobject.c ↵Dong-hee Na2020-01-213-68/+0
| | | | floatobject.c. (GH-18105)
* bpo-33387: Fix compiler warning in frame_block_unwind() (GH-18099)Victor Stinner2020-01-211-1/+1
| | | | | | Replace int with intptr_t to fix the warning: objects\frameobject.c(341): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
* bpo-39386: Prevent double awaiting of async iterator (GH-18081)Andrew Svetlov2020-01-211-4/+12
|
* bpo-39372: Clean header files of declared interfaces with no implementations ↵Pablo Galindo2020-01-185-13/+0
| | | | | | | | (GH-18037) The public API symbols being removed are: _PyBytes_InsertThousandsGroupingLocale, _PyBytes_InsertThousandsGrouping, _Py_InitializeFromArgs, _Py_InitializeFromWideArgs, _PyFloat_Repr, _PyFloat_Digits, _PyFloat_DigitsInit, PyFrame_ExtendStack, _PyAIterWrapper_Type, PyNullImporter_Type, PyCmpWrapper_Type, PySortWrapper_Type, PyNoArgsFunction.
* bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)Niklas Fiekas2020-01-161-29/+9
| | | Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().
* bpo-39200: Correct the error message for range() empty constructor (GH-17813)Pablo Galindo2020-01-051-29/+44
| | | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Document CodeType.replace (GH-17776)Anthony Sottile2020-01-012-4/+4
|
* bpo-38588: Optimize list comparison. (GH-17766)Inada Naoki2019-12-311-0/+3
| | | Mitigate performance regression of the list comparison caused by 2d5bf56.
* bpo-38588: Fix possible crashes in dict and list when calling ↵Dong-hee Na2019-12-312-0/+9
| | | | | | PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call.
* bpo-38610: Fix possible crashes in several list methods (GH-17022)Zackery Spytz2019-12-301-3/+12
| | | Hold strong references to list elements while calling PyObject_RichCompareBool().
* closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. ↵Batuhan Taşkaya2019-12-261-7/+7
| | | | (GH-17702)
* bpo-38858: Small integer per interpreter (GH-17315)Victor Stinner2019-12-171-31/+28
| | | | | | | | | | | | Each Python subinterpreter now has its own "small integer singletons": numbers in [-5; 257] range. It is no longer possible to change the number of small integers at build time by overriding NSMALLNEGINTS and NSMALLPOSINTS macros: macros should now be modified manually in pycore_pystate.h header file. For now, continue to share _PyLong_Zero and _PyLong_One singletons between all subinterpreters.
* bpo-38629: implement __floor__ and __ceil__ for float type (GH-16985)Batuhan Taşkaya2019-12-152-1/+67
|
* bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with ↵Sergey Fedoseev2019-12-051-5/+5
| | | | | standard macros (GH-15385) Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX.
* Fix compiler warning in Objects/unicodeobject.c (GH-17440)Pablo Galindo2019-12-021-1/+1
|
* bpo-38922: Raise code.__new__ audit event when code object replace() is ↵Steve Dower2019-11-261-0/+7
| | | | called (GH-17394)
* bpo-27145: small_ints[x] could be returned in long_add and long_sub (GH-15716)HongWeipeng2019-11-261-7/+9
|
* bpo-38896: Remove PyUnicode_ClearFreeList() function (GH-17354)Victor Stinner2019-11-231-9/+0
| | | | Remove PyUnicode_ClearFreeList() function: the Unicode free list has been removed in Python 3.3.
* bpo-38858: Call _PyUnicode_Fini() in Py_EndInterpreter() (GH-17330)Victor Stinner2019-11-221-16/+19
| | | Py_EndInterpreter() now clears the filesystem codec.
* Produce cleaner bytecode for 'with' and 'async with' by generating separate ↵Mark Shannon2019-11-211-172/+378
| | | | | | code for normal and exceptional paths. (#6641) Remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes. Implement finally blocks by code duplication. Reimplement frame.lineno setter using line numbers rather than bytecode offsets.
* bpo-38858: Allocate small integers on the heap (GH-17301)Victor Stinner2019-11-211-36/+19
| | | | Allocate small Python integers (small_ints of longobject.c) on the heap, rather than using static objects.
* bpo-37340: Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() ↵Victor Stinner2019-11-202-29/+0
| | | | | | | | (GH-17284) Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() functions: the free lists of bound method objects have been removed. Remove also _PyMethod_Fini() and _PyCFunction_Fini() functions.