summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Expand comment explaining update_one_slot (GH-14810)Jeroen Demeyer2019-09-101-9/+59
|
* Cut tricky `goto` that isn't needed, in _PyBytes_DecodeEscape. (GH-15825)Greg Price2019-09-101-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the sort of `goto` that requires the reader to stare hard at the code to unpick what it's doing. On doing so, the answer is... not very much! * It jumps from the bottom of the loop to almost the top; the effect is to bypass the loop condition `s < end` and also the `if`-condition `*s != '\\'`, acting as if both are true. * We've just decremented `s`, after incrementing it in the `switch` condition. So it has the same value as when `s == end` failed. Before that was another increment... and before that we had `s < end`. So `s < end` true, then increment, then `s == end` false... that means `s < end` is still true. * Also this means `s` points to the same character as it did for the `switch` condition. And there was a `case '\\'`, which we didn't hit -- so `*s != '\\'` is also true. * That means this has no effect on the behavior! The most it might do is an optimization -- we get to skip those two checks, because (as just proven above) we know they're true. * But gosh, this is the *invalid escape sequence* path. This does not seem like the kind of code path that calls for extreme optimization tricks. So, take the `goto` and the label out. Perhaps the compiler will notice the exact same facts we showed above, and generate identical code. Or perhaps it won't! That'll be OK. But then, crucially, if some future edit to this loop causes the reasoning above to *stop* holding true... the compiler will adjust this jump accordingly. One of us fallible humans might not.
* Correct overflow check in PyTuple_New() (GH-14838)Sergey Fedoseev2019-09-091-2/+2
|
* bpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)Sergey Fedoseev2019-09-091-2/+0
|
* bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)HongWeipeng2019-09-081-2/+4
| | | | This is a complement to PR 13375.
* bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)Joannah Nanjekye2019-09-061-16/+0
| | | | | Remove PyGen_NeedsFinalizing(): it was not documented, tested or used anywhere within CPython after the implementation of PEP 442.
* replace inline function `is_small_int` with a macro version (GH-15710)animalize2019-09-061-13/+9
|
* bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)Zackery Spytz2019-09-041-0/+3
|
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-011-2/+2
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)Serhiy Storchaka2019-09-016-91/+96
| | | Only AttributeError should be silenced.
* Fix typos mostly in comments, docs and test names (GH-15209)Min ho Kim2019-08-302-2/+2
|
* bpo-8425: Fast path for set inplace difference when the second set is large ↵Raymond Hettinger2019-08-291-1/+17
| | | | (GH-15590)
* bpo-37034: Display argument name on errors with keyword arguments with ↵Rémi Lapeyre2019-08-2910-56/+56
| | | | Argument Clinic. (GH-13593)