summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* bpo-38005: Fixed comparing and creating of InterpreterID and ChannelID. ↵Serhiy Storchaka2019-09-131-51/+49
| | | | | | | | | | | | | (GH-15652) * Fix a crash in comparing with float (and maybe other crashes). * They are now never equal to strings and non-integer numbers. * Comparison with a large number no longer raises OverflowError. * Arbitrary exceptions no longer silenced in constructors and comparisons. * TypeError raised in the constructor contains now the name of the type. * Accept only ChannelID and int-like objects in channel functions. * Accept only InterpreterId, int-like objects and str in the InterpreterId constructor. * Accept int-like objects, not just int in interpreter related functions.
* Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)Greg Price2019-09-121-58/+5
| | | | | | | | | | | | | | | | | | | | | All call sites pass NULL for `recode_encoding`, so this path is completely untested. That's been true since before Python 3.0. It adds significant complexity to this logic, so it's best to take it out. All call sites now have a literal NULL, and that's been true since commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at the call site in Python/ast.c where we're parsing a bytes literal. But even before then, that condition `foo` had been a constant since unadorned string literals started meaning Unicode, in commit 572dbf8f1 aka v3.0a1~1035 . The `unicode` parameter is already unused, so mark it as unused too. The code that acted on it was also taken out before Python 3.0, in commit 8d30cc014 aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
* bpo-38096: Complete the "structseq" and "named tuple" cleanup (GH-16010)Raymond Hettinger2019-09-121-2/+8
|
* bpo-37802: Slightly improve perfomance of PyLong_FromUnsigned*() (GH-15192)Sergey Fedoseev2019-09-121-77/+42
|
* bpo-34331: Fix incorrectly pluralized abstract class error message. (GH-8670)Daniel Andrade2019-09-111-1/+6
|
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895)Raymond Hettinger2019-09-112-2/+2
| | | | | | | | * bpo-38096: Clean up the "struct sequence" / "named tuple" docs * Fix remaining occurrences of "struct sequence" * Repair a user visible docstring
* Doc: Fix typo in fastsearch comments (GH-14608)Valentin Haenel2019-09-111-2/+2
|
* bpo-37151: remove special case for PyCFunction from PyObject_Call (GH-14684)Jeroen Demeyer2019-09-112-63/+43
| | | | | | | bpo-37151: remove special case for PyCFunction from PyObject_Call Alse, make the undocumented function PyCFunction_Call an alias of PyObject_Call and deprecate it.
* bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type ↵Eddie Elizondo2019-09-111-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-15323) The instance destructor for a type is responsible for preparing an instance for deallocation by decrementing the reference counts of its referents. If an instance belongs to a heap type, the type object of an instance has its reference count decremented while for static types, which are permanently allocated, the type object is unaffected by the instance destructor. Previously, the default instance destructor searched the class hierarchy for an inherited instance destructor and, if present, would invoke it. Then, if the instance type is a heap type, it would decrement the reference count of that heap type. However, this could result in the premature destruction of a type because the inherited instance destructor should have already decremented the reference count of the type object. This change avoids the premature destruction of the type object by suppressing the decrement of its reference count when an inherited, non-default instance destructor has been invoked. Finally, an assertion on the Py_SIZE of a type was deleted. Heap types have a non zero size, making this into an incorrect assertion. https://github.com/python/cpython/pull/15323
* Remove unneeded assignment in PyBytes_Concat() (GH-15274)Sergey Fedoseev2019-09-101-1/+0
| | | The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0455ce52530d4f43a9eac4c738f64bb as `PyObject_GetBuffer` always fills it in.
* bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)Jordon Xu2019-09-101-2/+2
|
* bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong ↵Jeroen Demeyer2019-09-101-6/+13
| | | | type (GH-14836)
* Fix typo in dict object comment (#15814)dalgarno2019-09-101-1/+1
|