summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33738: Address review comments in GH #7477 (GH-7585)Christian Tismer2018-06-102-0/+3
|
* bpo-33738: Fix macros which contradict PEP 384 (GH-7477)Christian Tismer2018-06-092-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of the limited API support for PySide, we saw an error in a macro that accessed a type field. This patch fixes the 7 errors in the Python headers. Macros which were not written as capitals were implemented as function. To do the necessary analysis again, a script was included that parses all headers and looks for "->tp_" in serctions which can be reached with active limited API. It is easily possible to call this script as a test. Error listing: ../../Include/objimpl.h:243 #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) Action: commented only ../../Include/objimpl.h:362 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) Action: commented only ../../Include/objimpl.h:364 #define PyObject_GET_WEAKREFS_LISTPTR(o) \ ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) Action: commented only ../../Include/pyerrors.h:143 #define PyExceptionClass_Name(x) \ ((char *)(((PyTypeObject*)(x))->tp_name)) Action: implemented function ../../Include/abstract.h:593 #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) Action: implemented function ../../Include/abstract.h:713 #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ (obj)->ob_type->tp_as_number->nb_index != NULL) Action: implemented function ../../Include/abstract.h:924 #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) Action: commented only
* bpo-33786: Fix asynchronous generators to handle GeneratorExit in athrow() ↵Yury Selivanov2018-06-081-8/+7
| | | | (GH-7467)
* update to Unicode 11.0.0 (closes bpo-33778) (GH-7439)Benjamin Peterson2018-06-071-724/+946
| | | Also, standardize indentation of generated tables.
* Replace _PyGC_REFS macros with higher level macros (GH-6852)INADA Naoki2018-05-171-5/+3
| | | | Only gcmodule.c uses _PyGC_REFS* macros now. This makes easy to read GC code.
* Fix typo in __mul__ and __rmul__ docstring (GH-6674)Grant Jenks2018-05-081-2/+2
|
* bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)lekma2018-05-021-1/+3
|
* bpo-33012: Fix invalid function casts for long_long. (GH-6652)Serhiy Storchaka2018-04-301-17/+25
| | | | | long_long() was used with three function types: PyCFunction, getter and unaryfunction.
* bpo-33330: Write exceptions occurred in PyImport_Cleanup() to stderr. (GH-6606)Serhiy Storchaka2018-04-291-4/+6
| | | | They where silenced before.
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-2925-164/+164
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* bpo-33041: Fix downcast warning on Windows (#6595)Victor Stinner2018-04-271-1/+1
| | | | Cast pointer difference from ssize_t to int: a frame is very unlikely larger than 2 GB.
* Spelling fixes to docs, docstrings, and comments (GH-6374)Ville Skyttä2018-04-201-1/+1
|
* bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537)Gregory P. Smith2018-04-202-24/+14
| | | | | | | | | | | | | | | | | | | | Fix clang ubsan (undefined behavior sanitizer) warnings in dictobject.c by adjusting how the internal struct _dictkeysobject shared keys structure is declared. This remains ABI compatible. We get rid of the union at the end of the struct being used for conveinence to avoid typecasting in favor of char[] variable length array at the end of a struct. This is known to clang to be used for variable sized objects and will not cause an undefined behavior problem. Similarly, char arrays do not have strict aliasing undefined behavior when cast. PEP-007 does not currently list variable length arrays (VLAs) as allowed in our subset of C99. If this turns out to be a problem, the fix to this is to change the char `dk_indices[]` into `dk_indices[1]` and restore the three size computation subtractions this change removes: `- Py_MEMBER_SIZE(PyDictKeysObject, dk_indices)` If this works as is I'll make a separate PR to update PEP-007.
* bpo-33299: Return an object itself for some types in _PyCode_ConstantKey(). ↵Serhiy Storchaka2018-04-191-4/+11
| | | | (GH-6513)
* bpo-33205: dict: Change GROWTH_RATE to `used*3` (GH-6350)INADA Naoki2018-04-171-6/+5
|
* bpo-33176: Add a toreadonly() method to memoryviews. (GH-6466)Antoine Pitrou2018-04-141-0/+19
|
* bpo-33031: Remove dead code in C implementation of OrderedDict. (GH-6120)Serhiy Storchaka2018-04-091-76/+1
| | | | This code doesn't have effect on the final result, but causes GCC 8 warnings and can have an undefined behavior.
* bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)INADA Naoki2018-04-031-0/+1
|
* Fix typo and edit for clarity in the docstrings of sys.float_info. (GH-2251)Stefano Taschini2018-03-261-3/+2
|
* bpo-30953: Improve error messages and add tests for jumping (GH-6196)Serhiy Storchaka2018-03-231-2/+6
| | | | into/out of an except block.
* bpo-33041: Rework compiling an "async for" loop. (#6142)Serhiy Storchaka2018-03-231-12/+9
| | | | | | | | * Added new opcode END_ASYNC_FOR. * Setting global StopAsyncIteration no longer breaks "async for" loops. * Jumping into an "async for" loop is now disabled. * Jumping out of an "async for" loop no longer corrupts the stack. * Simplify the compiler.
* bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)Marcel Plch2018-03-171-0/+21
| | | | | Multi-phase initialized modules allow m_traverse to be called while the module is still being initialized, so module authors may need to account for that.
* bpo-17288: Prevent jumps from 'return' and 'exception' trace events. (GH-6107)xdegaye2018-03-131-4/+35
| | | (cherry picked from commit e32bbaf376a09c149fa7c7f2919d7c9ce4e2a055)
* bpo-33026: Fix jumping out of "with" block by setting f_lineno. (#6026)Serhiy Storchaka2018-03-111-9/+15
|
* closes bpo-32980 Remove _PyFrame_Init (GH-5965)Thomas Nyberg2018-03-041-8/+0
|
* remove vestigal locking from obmalloc (GH-5805)Benjamin Peterson2018-02-241-39/+0
| | | obmalloc has (empty) macros for locking in the allocator. These aren't needed in CPython; we rely on the GIL.
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-222-132/+81
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)Eddie Elizondo2018-02-223-3/+4
|
* bpo-29803: remove a redandunt op and fix a comment in unicodeobject.c (#660)Xiang Zhang2018-02-131-5/+1
|
* bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)Oren Milman2018-02-132-6/+6
|
* bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors ↵Serhiy Storchaka2018-02-131-7/+3
| | | | handler. (GH-5636)
* bpo-32746: Fix multiple typos (GH-5144)Leo Arias2018-02-043-3/+3
| | | Fix typos found by codespell in docs, docstrings, and comments.
* bpo-32747: Remove trailing spaces in docstrings. (GH-5491)oldk2018-02-022-2/+2
|
* bpo-32583: Fix possible crashing in builtin Unicode decoders (#5325)Xiang Zhang2018-01-311-2/+20
| | | | | When using customized decode error handlers, it is possible for builtin decoders to write out-of-bounds and then crash.
* bpo-32703: Fix coroutine resource warning in case where there's an error ↵Yury Selivanov2018-01-291-6/+7
| | | | | (GH-5410) The commit removes one unnecessary "if" clause in genobject.c. That "if" clause was masking un-awaited coroutines warnings just to make writing unittests more convenient.
* bpo-28685: Fix compiler warning (GH-5423)Victor Stinner2018-01-291-1/+2
|
* bpo-28685: Optimize sorted() list.sort() with type-specialized comparisons ↵embg2018-01-292-71/+345
| | | | (#582)
* bpo-32690: Preserve order of locals() (#5379)Raymond Hettinger2018-01-281-2/+2
|
* bpo-32685: Improve suggestion for print statement (GH-5375)Nitish Chandra2018-01-281-14/+19
| | | | | | | Better account for single-line compound statements and semi-colon separated statements when suggesting Py3 replacements for Py2 print statements. Initial patch by Nitish Chandra.
* bpo-32677: Optimize str.isascii() (GH-5356)INADA Naoki2018-01-281-4/+36
|
* Fix wrong assert in unicodeobject (GH-5340)INADA Naoki2018-01-271-1/+1
|
* bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)INADA Naoki2018-01-276-1/+72
|
* bpo-32670: Enforce PEP 479. (#5327)Yury Selivanov2018-01-261-50/+8
|
* bpo-18533: Avoid RecursionError from repr() of recursive dictview (#4823)bennorth2018-01-261-4/+12
| | | | | | | | | | | | | | | | | dictview_repr(): Use a Py_ReprEnter() / Py_ReprLeave() pair to check for recursion, and produce "..." if so. test_recursive_repr(): Check for the string rather than a RecursionError. (Test cannot be any tighter as contents are implementation-dependent.) test_deeply_nested_repr(): Add new test, replacing the original test_recursive_repr(). It checks that a RecursionError is raised in the case of a non-recursive but deeply nested structure. (Very similar to what test_repr_deep() in test/test_dict.py does for a normal dict.) OrderedDictTests: Add new test case, to test behavior on OrderedDict instances containing their own values() or items().
* bpo-32571: Fix reading uninitialized memory (GH-5332)INADA Naoki2018-01-261-0/+5
| | | Reported by Coverity Scan.
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-257-131/+106
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-0/+1
|
* bpo-31179: Make dict.copy() up to 5.5 times faster. (#3067)Yury Selivanov2018-01-221-0/+73
|
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-211-4/+57
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-32028: Fix suggestions for indented print statements (GH-4688)Sanyam Khurana2018-01-201-5/+11
| | | | | | | The suggested replacement for print statements previously failed to account for leading whitespace and hence could end up including unwanted text in the proposed call to the print builtin. Patch by Sanyam Khurana.