Commit graph

6130 commits

Author SHA1 Message Date
Martijn Pieters 772d809a63 bpo-31161: only check for parens error for SyntaxError (#3082)
Subclasses such as IndentError and TabError should not have this message
applied.
2017-08-22 13:16:23 -07:00
Stefan Krah f432a3234f bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) 2017-08-21 13:09:59 +02:00
Sanyam Khurana a7c449b8c0 bpo-30721: Add missing '?' to new error message (GH-3131) 2017-08-18 22:18:14 +10:00
Sanyam Khurana 5e2eb35bbe bpo-30721: Show correct syntax hint in Py3 when using Py2 redirection syntax (#2345) 2017-08-18 13:37:36 +03:00
INADA Naoki 778928b0c7 bpo-29304: Simplify dict lookup functions (GH-2407)
* remove hashpos parameter from lookdict functions.
* remove many duplicated code from lookdict functions.
2017-08-03 23:45:15 +09:00
Serhiy Storchaka 5075416b8f bpo-30978: str.format_map() now passes key lookup exceptions through. (#2790)
Previously any exception was replaced with a KeyError exception.
2017-08-03 11:45:23 +03:00
Zackery Spytz c6ea8974e2 bpo-30640: Fix undefined behavior in _PyFunction_FastCallDict() and PyEval_EvalCodeEx() (#2919)
k + 1 was calculated with k = NULL.
2017-07-31 17:24:37 +03:00
Serhiy Storchaka 64e461be09 bpo-22207: Add checks for possible integer overflows in unicodeobject.c. (#2623)
Based on patch by Victor Stinner.
2017-07-11 06:55:25 +03:00
Sylvain 9648088e6c bpo-30878: Fix error message when keyword arguments are passed (#2635)
to staticmethod() and classmethod().
2017-07-09 06:45:06 +03:00
Serhiy Storchaka 378ebb6578 bpo-30789: Use a single memory block for co_extra. (#2555)
* bpo-30789: Use a single memory block for co_extra.

* Address review comments.
2017-07-04 14:06:16 +02:00
Serhiy Storchaka 6969eaf468 bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)
the bare METH_FASTCALL be used for functions with positional-only
parameters.
2017-07-03 21:20:15 +03:00
Serhiy Storchaka f7eae0adfc [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)
Based on patch by Victor Stinner.

Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
2017-06-28 08:30:06 +03:00
Victor Stinner 23e7944eba bpo-30704, bpo-30604: Fix memleak in code_dealloc() (#2455)
Free also co_extra->ce_extras, not only co_extra.
2017-06-28 02:12:00 +02:00
Serhiy Storchaka e613e6add5 bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (#2285)
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters.
2017-06-27 16:03:14 +03:00
INADA Naoki 870c286e27 bp-29304: Simplify dictobject.c (GH-2347)
replace `(i << 2) + 1` with `i*5`
2017-06-24 09:03:19 +09:00
Serhiy Storchaka d174d24a5d bpo-30730: Prevent environment variables injection in subprocess on Windows. (#2325)
Prevent passing other invalid environment variables and command arguments.
2017-06-23 19:39:27 +03:00
INADA Naoki 073ae487b3 bpo-29304: simplify lookdict_index() function. (GH-2273) 2017-06-23 15:22:50 +09:00
Benjamin Peterson 279a96206f bpo-30736: upgrade to Unicode 10.0 (#2344)
Straightforward. While we're at it, though, strip trailing whitespace from generated tables.
2017-06-22 22:31:08 -07:00
Dino Viehland f3cffd2b78 bpo-30604: clean up co_extra support (#2144)
bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
2017-06-21 17:44:36 -04:00
Sanyam Khurana 3a7f03584a bpo-30597: Show expected input in custom 'print' error message. (#2009) 2017-06-20 16:31:32 +03:00
Sylvain 7445381c60 bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)
The function '_PyArg_ParseStack()' and
'_PyArg_UnpackStack' were failing (with error
"XXX() takes Y argument (Z given)") before
the function '_PyArg_NoStackKeywords()' was called.
Thus, the latter did not raise its more meaningful
error : "XXX() takes no keyword arguments".
2017-06-10 07:51:48 +03:00
Lisa Roach 64505a1f6c bpo-30486: Allow setting cell value (#1840)
The cell_contents attribute of the cell object is now writable.
2017-06-08 14:43:26 +03:00
Serhiy Storchaka 6cca5c8459 bpo-30592: Fixed error messages for some builtins. (#1996)
Error messages when pass keyword arguments to some builtins that
don't support keyword arguments contained double parenthesis: "()()".
The regression was introduced by bpo-30534.
2017-06-08 14:41:19 +03:00
Serhiy Storchaka 5eb788bf7f bpo-30534: Fixed error messages when pass keyword arguments (#1901)
to functions implemented in C that don't support this.

Also unified error messages for functions that don't take positional or keyword
arguments.
2017-06-06 18:45:22 +03:00
Serhiy Storchaka 4e624ca50a bpo-30509: Clean up calling type slots. (#1883)
Also speed up slot_sq_item.
2017-06-01 08:18:25 +03:00
Serhiy Storchaka 753bca3934 bpo-27945: Fixed various segfaults with dict. (#1657)
Based on patches by Duane Griffin and Tim Mitchell.
2017-05-20 12:30:02 +03:00
Serhiy Storchaka d896985bb2 bpo-25794: Fix type.__setattr__() for non-interned attribute names. (#1652)
Based on patch by Eryk Sun.
2017-05-20 08:48:06 +03:00
Serhiy Storchaka 7e19dbc92e bpo-28974: object.__format__(x, '') is now equivalent to str(x) (#506)
rather than `format(str(self), '')`.
2017-05-13 12:40:52 +03:00
Xiang Zhang a66f9c6bb1 bpo-30341: Improve _PyTrash_thread_destroy_chain() a little bit (#1545)
* add a comment about why we need to increase trash_delete_nesting
* move increase and decrese outside of the loop
2017-05-13 13:36:14 +08:00
Xiang Zhang 2ddf5a19c3 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480) 2017-05-10 18:19:41 +08:00
Serhiy Storchaka 1a5856bf92 bpo-29867: Add asserts in PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. (#751) 2017-04-22 01:48:11 +02:00
Serhiy Storchaka 40db90c1ce bpo-29802: Fix reference counting in module-level struct functions (#1213)
when pass arguments of wrong type.
2017-04-20 21:19:31 +03:00
Dong-hee Na b4dc6af7a7 bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) 2017-04-20 10:31:17 +03:00
Serhiy Storchaka bf623ae884 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)
raised an error.

Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Xiang Zhang 8e1ddbd592 fix a refleak in slot_sq_length (#1162) 2017-04-17 00:54:21 +08:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Serhiy Storchaka baf9f29811 bpo-29839: Raise ValueError rather than OverflowError in len() for negative values. (#701) 2017-04-16 09:37:18 +03:00
Serhiy Storchaka 813f943c59 bpo-29838: Add asserts for checking results of sq_length and mq_length slots. (#700)
Negative result should be returned only when an error is set.
2017-04-16 09:21:44 +03:00
Serhiy Storchaka b785396ab4 bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)
attributes.
2017-04-08 09:55:07 +03:00
Serhiy Storchaka b879fe82e7 Expand the PySlice_GetIndicesEx macro. (#1023) 2017-04-08 09:53:51 +03:00
Serhiy Storchaka 205e00c5cf bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843)
object.__reduce__() no longer takes arguments, object.__reduce_ex__() now
requires one argument.
2017-04-08 09:52:59 +03:00
Serhiy Storchaka bae6881b42 Update Argument Clinic generated code for bpo-29878. (#1001) 2017-04-05 12:00:42 +03:00
Lisa Roach 43ba8861e0 bpo-29549: Fixes docstring for str.index (#256)
* Updates B.index documentation.

* Updates str.index documentation, makes it Argument Clinic compatible.

* Removes ArgumentClinic code.

* Finishes string.index documentation.

* Updates string.rindex documentation.

* Documents B.rindex.
2017-04-04 22:36:22 -07:00
INADA Naoki e82cf8675b bpo-29949: Fix set memory usage regression (GH-943)
Revert "Minor factoring:  move redundant resize scaling logic into the resize function."

This reverts commit 4897300276.
2017-04-01 17:20:25 +09:00
T. Wouters 06bb4873d6 Fix spurious MemoryError introduced by PR #886. (#930)
Fix MemoryError caused by moving around code in PR #886; nbytes was sometimes used unitinitalized (in non-debug builds, when use_calloc was false and elsize was 0).
2017-03-31 10:10:19 -07:00
T. Wouters a00c3fd12d bpo-29941: Assert fixes (#886)
Make a non-Py_DEBUG, asserts-enabled build of CPython possible. This means
making sure helper functions are defined when NDEBUG is not defined, not
just when Py_DEBUG is defined.

Also fix a division-by-zero in obmalloc.c that went unnoticed because in Py_DEBUG mode, elsize is never zero.
2017-03-31 09:14:41 -07:00
Serhiy Storchaka d4edfc9abf bpo-29935: Fixed error messages in the index() method of tuple, list and deque (#887)
when pass indices of wrong type.
2017-03-30 18:29:23 +03:00
Serhiy Storchaka 918403cfc3 bpo-29816: Shift operation now has less opportunity to raise OverflowError. (#680)
ValueError always is raised rather than OverflowError for negative counts.
Shifting zero with non-negative count always returns zero.
2017-03-30 09:47:07 +03:00
Serhiy Storchaka 0a58f72762 bpo-24821: Fixed the slowing down to 25 times in the searching of some (#505)
unlucky Unicode characters.
2017-03-30 09:11:10 +03:00
Serhiy Storchaka ba85d69a3e bpo-29878: Add global instances of int for 0 and 1. (#852) 2017-03-30 09:09:41 +03:00