summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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-271-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.
* bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)Victor Stinner2019-11-201-7/+13
| | | | | * Rename _PyGC_InitializeRuntime() to _PyGC_InitState() * finalize_interp_clear() now also calls _PyGC_Fini() in subinterpreters (clear the GC state).
* bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)Victor Stinner2019-11-202-32/+0
| | | | | The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty: they have been doing nothing for the last year (since commit 735ae8d139a673b30b321dc10acfd3d14f0d633b), so stop using them.
* bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)Vincent Michel2019-11-191-0/+11
| | | | | | | | | Ignore `GeneratorExit` exceptions when throwing an exception into the `aclose` coroutine of an asynchronous generator. https://bugs.python.org/issue35409
* bpo-38631: Avoid Py_FatalError() in float.__getformat__() (GH-17232)Victor Stinner2019-11-181-1/+2
| | | | Replace Py_FatalError() with a regular RuntimeError exception in float.__getformat__().
* bpo-38650: Constify PyStructSequence_UnnamedField. (GH-17005)Serhiy Storchaka2019-11-161-1/+1
| | | | Make it a constant and referring to a constant string.
* bpo-38644: Add _PyEval_EvalCode() (GH-17183)Victor Stinner2019-11-161-26/+29
| | | _PyFunction_Vectorcall() now pass tstate to function calls.
* bpo-38644: Add _PyObject_Call() (GH-17089)Victor Stinner2019-11-142-112/+146
| | | | | | | | | | * Add pycore_call.h internal header file. * Add _PyObject_Call(): PyObject_Call() with tstate * Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate * Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict() with tstate * _PyObject_Call_Prepend() now takes tstate * Replace _PyObject_FastCall() calls with _PyObject_VectorcallTstate() calls
* bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131)Victor Stinner2019-11-142-2/+4
| | | | Add _PyEval_EvalFrame() static inline function to get eval_frame from tstate->interp.
* bpo-38644: Add _PyObject_VectorcallTstate() (GH-17052)Victor Stinner2019-11-083-22/+35
| | | | | * Add _PyObject_VectorcallTstate() function: similar to _PyObject_Vectorcall(), but with tstate parameter * Add tstate parameter to _PyObject_MakeTpCall()
* bpo-38613: Optimize set operations of dict keys. (GH-16961)Inada Naoki2019-11-071-21/+33
|
* bpo-38733: PyErr_Occurred() caller must hold the GIL (GH-17080)Victor Stinner2019-11-072-6/+5
| | | | | | | | | | | bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test. Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case. _Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.
* bpo-37645: add new function _PyObject_FunctionStr() (GH-14890)Jeroen Demeyer2019-11-053-45/+107
| | | | | | | | | | | | Additional note: the `method_check_args` function in `Objects/descrobject.c` is written in such a way that it applies to all kinds of descriptors. In particular, a future re-implementation of `wrapper_descriptor` could use that code. CC @vstinner @encukou https://bugs.python.org/issue37645 Automerge-Triggered-By: @encukou
* bpo-38644: Pass tstate to _Py_CheckFunctionResult() (GH-17050)Victor Stinner2019-11-053-47/+64
| | | | | * Add tstate parameter to _Py_CheckFunctionResult() * Add _PyErr_FormatFromCauseTstate() * Replace PyErr_XXX(...) with _PyErr_XXX(state, ...)
* bpo-38644: Pass tstate to Py_EnterRecursiveCall() (GH-16997)Victor Stinner2019-11-045-114/+162
| | | | | | | | | | | | | * Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which require a tstate argument. * Pass tstate to _Py_MakeRecCheck() and _Py_CheckRecursiveCall(). * Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros to static inline functions. _PyThreadState_GET() is the most efficient way to get the tstate, and so using it with _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() should be a little bit more efficient than using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() which use the "slower" PyThreadState_GET().
* bpo-28029: Make "".replace("", s, n) returning s for any n != 0. (GH-16981)Serhiy Storchaka2019-10-302-9/+9
|
* bpo-38555: Fix an undefined behavior. (GH-16883)Serhiy Storchaka2019-10-231-8/+7
|
* bpo-38525: Fix a segmentation fault when using reverse iterators of empty ↵Dong-hee Na2019-10-191-2/+7
| | | | | dict (GH-16846) The reverse iterator for empty dictionaries was not handling correctly shared-key dictionaries.
* bpo-38202: Fix a crash in dict_view & non-itearble. (GH-16241)Zackery Spytz2019-10-131-0/+4
|
* Fix strict-aliasing rules errors on gcc 4.8.5. (GH-16714)Dong-hee Na2019-10-111-1/+1
|
* bpo-38409: Fix grammar in str.strip() docstring (GH-16682)Zachary Ware2019-10-092-4/+4
|
* bpo-38395: Fix ownership in weakref.proxy methods (GH-16632)Pablo Galindo2019-10-081-31/+88
| | | | | | | | | | | | | The implementation of weakref.proxy's methods call back into the Python API using a borrowed references of the weakly referenced object (acquired via PyWeakref_GET_OBJECT). This API call may delete the last reference to the object (either directly or via GC), leaving a dangling pointer, which can be subsequently dereferenced. To fix this, claim a temporary ownership of the referenced object when calling the appropriate method. Some functions because at the moment they do not need to access the borrowed referent, but to protect against future changes to these functions, ownership need to be fixed in all potentially affected methods.
* bpo-33714: Output an exception raised in module's m_clear(). (GH-16592)Serhiy Storchaka2019-10-081-1/+7
| | | | | | | | | | | | It is similar to the more general code in the gc module, but here we know the name of the module. https://bugs.python.org/issue33714 Automerge-Triggered-By: @encukou
* bpo-38400 Don't check for NULL linked list pointers in _PyObject_IsFreed ↵Pablo Galindo2019-10-071-1/+4
| | | | | | | | | (GH-16630) Some objects like Py_None are not initialized with conventional means that prepare the circular linked list pointers, leaving them unlinked from the rest of the objects. For those objects, NULL pointers does not mean that they are freed, so we need to skip the check in those cases.
* bpo-36389: Add newline to _PyObject_AssertFailed() (GH-16629)Victor Stinner2019-10-071-0/+3
| | | | Add a newline between the verbose object dump and the Py_FatalError() logs for readability.
* bpo-36389: Fix _PyBytesWriter in release mode (GH-16624)Victor Stinner2019-10-072-47/+33
| | | | Fix _PyBytesWriter API when Python is built in release mode with assertions.
* bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)Victor Stinner2019-10-075-111/+113
| | | | | | | | | | | | | | | | | | | | | bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is now also available in release mode. For example, it can be used to debug a crash in the visit_decref() function of the GC. Modify the following functions to also work in release mode: * _PyDict_CheckConsistency() * _PyObject_CheckConsistency() * _PyType_CheckConsistency() * _PyUnicode_CheckConsistency() Other changes: * _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL (equals to 0). * _PyBytesWriter_CheckConsistency() now returns 1 and is only used with assert(). * Reorder _PyObject_Dump() to write safe fields first, and only attempt to render repr() at the end.
* Fix a compile warning in dictobject.c (GH-16610)Hai Shi2019-10-071-1/+0
|
* bpo-38383: Fix possible integer overflow in startswith() of bytes and ↵Hai Shi2019-10-061-1/+1
| | | | bytearray. (GH-16603)
* bpo-38210: Fix intersection operation with dict view and iterator. (GH-16602)Dong-hee Na2019-10-061-8/+0
|
* bpo-38353: Cleanup includes in the internal C API (GH-16548)Victor Stinner2019-10-021-1/+2
| | | | Use forward declaration of types to avoid includes in the internal C API. Add also comment to justify other includes.
* bpo-37802: Fix a compiler warning in longobject.c (GH-16517)Victor Stinner2019-10-011-1/+1
| | | | | | | | | bpo-37802, bpo-38321: Fix the following warnings: longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data
* bpo-30773: Fix ag_running; prohibit running athrow/asend/aclose in parallel ↵Yury Selivanov2019-09-301-2/+34
| | | | (#7468)
* bpo-38115: Deal with invalid bytecode offsets in lnotab (GH-16079)T. Wouters2019-09-281-1/+3
| | | | | | | | | | Document that lnotab can contain invalid bytecode offsets (because of terrible reasons that are difficult to fix). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython (various reimplementations of addr2line or line2addr in Python, C and gdb) already ignore this, because they take an address to look for, instead. Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them.
* bpo-38005: Remove support of string argument in InterpreterID(). (GH-16227)Serhiy Storchaka2019-09-251-50/+31
| | | Make negative interpreter id to raise ValueError instead of RuntimeError.
* bpo-38219: Optimize dict creating and updating by a dict. (GH-16268)Serhiy Storchaka2019-09-251-8/+13
|
* bpo-38236: Dump path config at first import error (GH-16300)Victor Stinner2019-09-231-9/+10
| | | | Python now dumps path configuration if it fails to import the Python codecs of the filesystem and stdio encodings.
* bpo-38140: Make dict and weakref offsets opaque for C heap types (#16076)Eddie Elizondo2019-09-191-2/+25
| | | | | | * Make dict and weakref offsets opaque for C heap types * Add news
* bpo-35696: Simplify long_compare() (GH-16146)HongWeipeng2019-09-181-18/+18
|
* bpo-38070: Enhance _PyObject_Dump() (GH-16243)Victor Stinner2019-09-171-6/+7
| | | | _PyObject_Dump() now dumps the object address for freed objects and objects with ob_type=NULL.
* bpo-38013: make async_generator_athrow object tolerant to throwing ↵Andrew Svetlov2019-09-171-5/+0
| | | | | | | | | | | | exceptions (GH-16070) Even when the helper is not started yet. This behavior follows conventional generator one. There is no reason for `async_generator_athrow` to handle `gen.throw()` differently. https://bugs.python.org/issue38013
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-1411-28/+28
| | | | | | | (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.