Serhiy Storchaka
467ab194fc
Issue #28410 : Added _PyErr_FormatFromCause() -- the helper for raising
...
new exception with setting current exception as __cause__.
_PyErr_FormatFromCause(exception, format, args...) is equivalent to Python
raise exception(format % args) from sys.exc_info()[1]
2016-10-21 17:09:17 +03:00
Benjamin Peterson
3aa75528a1
merge 3.5 ( #28454 )
2016-10-16 15:42:24 -07:00
Benjamin Peterson
8d761ff045
remove extra PyErr_Format arguments ( closes #28454 )
...
Patch from Xiang Zhang.
2016-10-16 15:41:46 -07:00
Christian Heimes
5cade88ac1
Check return value of _PyDict_SetItemId()
2016-10-13 21:10:31 +02:00
Victor Stinner
ebe17e0347
Fix _Py_normalize_encoding() command
...
It's not exactly the same than encodings.normalize_encoding(): the C function
also converts to lowercase.
2016-10-12 13:57:45 +02:00
Benjamin Peterson
b329e1bb5b
va_end vargs2 once ( closes #28417 )
2016-10-11 23:00:58 -07:00
doko@ubuntu.com
de69ee71e2
- dictobject.c: Make dict_merge symbol a static symbol
2016-10-11 08:04:02 +02:00
Serhiy Storchaka
49f5cdde1a
Issue #28183 : Optimize and cleanup dict iteration.
2016-10-09 23:08:05 +03:00
Serhiy Storchaka
21d9f10c94
Merge from 3.5.
2016-10-08 22:46:01 +03:00
Serhiy Storchaka
9c0e1f83af
Issue #28379 : Added sanity checks and tests for PyUnicode_CopyCharacters().
...
Patch by Xiang Zhang.
2016-10-08 22:45:38 +03:00
Serhiy Storchaka
c7f490c8b1
Issue #28376 : Creating instances of range_iterator by calling range_iterator
...
type now is deprecated. Patch by Oren Milman.
2016-10-08 21:50:45 +03:00
Serhiy Storchaka
639098c591
Merge from 3.5.
2016-10-08 21:45:07 +03:00
Serhiy Storchaka
44759bcf13
Issue #28376 : The constructor of range_iterator now checks that step is not 0.
...
Patch by Oren Milman.
2016-10-08 21:43:11 +03:00
Serhiy Storchaka
56588b7055
Issue #26906 : Resolving special methods of uninitialized type now causes
...
implicit initialization of the type instead of a fail.
2016-10-08 12:26:25 +03:00
Serhiy Storchaka
8ef34600c7
Issue #26906 : Resolving special methods of uninitialized type now causes
...
implicit initialization of the type instead of a fail.
2016-10-08 12:24:09 +03:00
Serhiy Storchaka
e45b7c09ec
Issue #18287 : PyType_Ready() now checks that tp_name is not NULL.
...
Original patch by Niklas Koep.
2016-10-07 23:25:46 +03:00
Serhiy Storchaka
de0574bdab
Issue #18287 : PyType_Ready() now checks that tp_name is not NULL.
...
Original patch by Niklas Koep.
2016-10-07 23:24:35 +03:00
INADA Naoki
267941c675
Issue #28201 : Dict reduces possibility of 2nd conflict in hash table.
...
Do perturb shift after first conflict.
2016-10-06 15:19:07 +09:00
Serhiy Storchaka
7fd9f4b458
Merge heads
2016-10-04 18:23:55 +03:00
Serhiy Storchaka
e81b0d335b
Issue #28350 : String constants with null character no longer interned.
2016-10-04 18:21:25 +03:00
Serhiy Storchaka
09f3d080fe
Issue #28350 : String constants with null character no longer interned.
2016-10-04 18:17:22 +03:00
Benjamin Peterson
804480912c
merge 3.5 ( #26617 )
2016-10-04 00:00:23 -07:00
Benjamin Peterson
8f657c35b9
ensure gc tracking is off when invoking weakref callbacks ( closes #26617 )
2016-10-04 00:00:02 -07:00
Serhiy Storchaka
e036ef8fa2
Issue #27358 : Optimized merging var-keyword arguments and improved error
...
message when pass a non-mapping as a var-keyword argument.
2016-10-02 11:06:43 +03:00
Serhiy Storchaka
3738c2d8ae
Issue #27942 : String constants now interned recursively in tuples and frozensets.
2016-09-30 10:23:01 +03:00
Serhiy Storchaka
00a0fc1144
Issue #27942 : String constants now interned recursively in tuples and frozensets.
2016-09-30 10:07:26 +03:00
Serhiy Storchaka
389ef9dcda
Issue #21578 : Fixed misleading error message when ImportError called with
...
invalid keyword args.
2016-09-27 20:51:04 +03:00
Serhiy Storchaka
47dee11ba7
Issue #21578 : Fixed misleading error message when ImportError called with
...
invalid keyword args.
2016-09-27 20:45:35 +03:00
Serhiy Storchaka
333ad92ec2
Issue #27914 : Fixed a comment in PyModule_ExcDef.
...
Patch by Xiang Zhang.
2016-09-26 23:14:44 +03:00
Serhiy Storchaka
97932e4c4f
issue #28144 : Decrease empty_keys_struct's dk_refcnt
...
since there is no dummy_struct any more.
Patch by Xiang Zhang.
2016-09-26 23:01:23 +03:00
Serhiy Storchaka
46825d2399
Issue #28194 : Clean up some checks in dict implementation.
...
Patch by Xiang Zhang.
2016-09-26 21:29:34 +03:00
Mark Dickinson
6997946ec4
Issue #28203 : Merge from 3.5
2016-09-24 15:28:34 +01:00
Mark Dickinson
613f8e513c
Issue #28203 : Fix incorrect type in error message from complex(1.0, {2:3}). Patch by Soumya Sharma.
2016-09-24 15:26:36 +01:00
Benjamin Peterson
7b7228a709
remove unneeded cast
2016-09-22 23:39:59 -07:00
Serhiy Storchaka
afd02a439f
Issue #28214 : Now __set_name__ is looked up on the class instead of the
...
instance.
2016-09-21 15:54:59 +03:00
Victor Stinner
44f4874e68
Merge 3.5
2016-09-21 14:13:53 +02:00
Victor Stinner
1ddf53d496
Fix PyUnicode_FromFormatV() error handling
...
Issue #28233 : Fix a memory leak if the format string contains a non-ASCII
character, destroy the unicode writer.
2016-09-21 14:13:14 +02:00
Christian Heimes
2f2fee19ec
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:27 +02:00
Benjamin Peterson
0c21214f3e
replace usage of Py_VA_COPY with the (C99) standard va_copy
2016-09-20 20:39:33 -07:00
Raymond Hettinger
6692f01c91
merge
2016-09-18 21:46:08 -07:00
Raymond Hettinger
7eb1becc25
Issue #28189 : dictitems_contains no longer swallows compare errors.
...
(Patch by Xiang Zhang)
2016-09-18 21:45:11 -07:00
Benjamin Peterson
5d4b09c106
correct silly spelling problem
2016-09-18 19:24:52 -07:00
Benjamin Peterson
19517e4da7
replace obmalloc's homegrown uptr and uchar types with standard ones
2016-09-18 19:22:22 -07:00
Benjamin Peterson
3924f93794
improvements to code that checks whether Python (obmalloc) allocated an address
...
- Rename Py_ADDRESS_IN_RANGE to address_in_range and make it a static
function instead of macro. Any compiler worth its salt will inline this
function.
- Remove the duplicated function version of Py_ADDRESS_IN_RANGE used when memory
analysis was active. Instead, we can simply mark address_in_range as allergic
to dynamic memory checking. We can now remove the
__attribute__((no_address_safety_analysis)) from _PyObject_Free and
_PyObject_Realloc. All the badness is contained in address_in_range now.
- Fix the code that tried to only read pool->arenaindex once. Putting something
in a variable is no guarantee that it won't be read multiple times. We must
use volatile for that.
2016-09-18 19:12:48 -07:00
Martin Panter
d508d00919
Issue #28139 : Merge indentation fixes from 3.5 into 3.6
2016-09-17 07:59:14 +00:00
Martin Panter
6d57fe1c23
Issue #28139 : Fix messed up indentation
...
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Berker Peksag
7b4bcd2004
Issue #25270 : Merge from 3.5
2016-09-16 17:32:06 +03:00
Berker Peksag
4a72a7b6c4
Issue #25270 : Prevent codecs.escape_encode() from raising SystemError when an empty bytestring is passed
2016-09-16 17:31:06 +03:00
Benjamin Peterson
6775231597
Unicode 9.0.0
...
Not completely mechanical since support for East Asian Width changes—emoji
codepoints became Wide—had to be added to unicodedata.
2016-09-14 23:53:47 -07:00
Victor Stinner
611b0fa94c
Add _PyDict_CheckConsistency()
...
Issue #28127 : Add a function to check that a dictionary remains consistent
after any change.
By default, tables are not checked, only basic attributes. Define DEBUG_PYDICT
(ex: gcc -D DEBUG_PYDICT) to also check dictionary "content".
2016-09-14 15:02:01 +02:00
Christian Heimes
f051e43b22
Issue #28126 : Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize memcpy().
2016-09-13 20:22:02 +02:00
Victor Stinner
d0ad11f6b4
Fix _PyDict_Pop() on pending key
...
Issue #28120 : Fix dict.pop() for splitted dictionary when trying to remove a
"pending key" (Not yet inserted in split-table).
Patch by Xiang Zhang.
2016-09-13 16:56:38 +02:00
Victor Stinner
9926480b6a
Issue #28040 : Cleanup find_empty_slot()
...
find_empty_slot() only supports combined dict
2016-09-13 09:38:29 +02:00
Victor Stinner
476bd5ea97
Fix warning in _PyCFunction_FastCallKeywords()
...
Issue #28105 .
2016-09-12 15:33:26 -04:00
Victor Stinner
3c336c5915
Issue #28077 : find_empty_slot() only supports combined dict
2016-09-12 14:17:40 +02:00
Victor Stinner
57f91ac95a
Document kwnames in _PyObject_FastCallKeywords() and _PyStack_AsDict()
...
Issue #27213 .
2016-09-12 13:37:07 +02:00
Victor Stinner
b8d768b019
Revert change f860b7a775c5
...
Revert change "Issue #27213 : Reintroduce checks in _PyStack_AsDict()", pushed
by mistake.
2016-09-12 13:30:02 +02:00
Victor Stinner
b1e169bf4b
ssue #27213 : Reintroduce checks in _PyStack_AsDict()
2016-09-12 12:55:28 +02:00
Raymond Hettinger
4103e4dfbc
Issue #28071 : Add early-out for differencing from an empty set.
2016-09-11 22:02:28 -07:00
Berker Peksag
1d7feab78a
Issue #28045 : Merge from 3.5
2016-09-12 07:47:33 +03:00
Berker Peksag
ed6224ee0c
Issue #28045 : Fix comment in range_contains_long()
...
Patch by wim glenn.
2016-09-12 07:47:04 +03:00
Serhiy Storchaka
b72810583e
Issue #27213 : Fixed different issues with reworked CALL_FUNCTION* opcodes.
...
* BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with
single tuple or dict.
* Restored more informative error messages for incorrect var-positional and
var-keyword arguments.
* Removed code duplications in _PyEval_EvalCodeWithName().
* Removed redundant runtime checks and parameters in _PyStack_AsDict().
* Added a workaround and enabled previously disabled test in test_traceback.
* Removed dead code from the dis module.
2016-09-12 00:52:40 +03:00
Serhiy Storchaka
ab8740058a
Issue #27129 : Replaced wordcode related magic constants with macros.
2016-09-11 13:48:15 +03:00
Nick Coghlan
944368e1cc
Issue #23722 : Initialize __class__ from type.__new__()
...
The __class__ cell used by zero-argument super() is now initialized
from type.__new__ rather than __build_class__, so class methods
relying on that will now work correctly when called from metaclass
methods during class creation.
Patch by Martin Teichmann.
2016-09-11 14:45:49 +10:00
Mark Dickinson
82cb124300
Issue #25221 : merge from 3.5.
2016-09-10 20:20:08 +01:00
Mark Dickinson
36820dd5a9
Issue #25221 : Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
2016-09-10 20:17:36 +01:00
Serhiy Storchaka
473e0e4dba
Fixed compiler warnings in compact dict implementation on 32-bit platforms.
2016-09-10 21:34:43 +03:00
Victor Stinner
990397ef1e
dictobject.c: explain why stringlib is used
2016-09-09 20:22:59 -07:00
Victor Stinner
37e4ef7b17
Issue #27810 : Rerun Argument Clinic on all modules
2016-09-09 20:00:13 -07:00
Victor Stinner
a9efb2f56e
Add METH_FASTCALL calling convention
...
Issue #27810 : Add a new calling convention for C functions:
PyObject* func(PyObject *self, PyObject **args,
Py_ssize_t nargs, PyObject *kwnames);
Where args is a C array of positional arguments followed by values of keyword
arguments. nargs is the number of positional arguments, kwnames are keys of
keyword arguments. kwnames can be NULL.
2016-09-09 17:40:22 -07:00
Victor Stinner
78601a38c2
Fix SystemError in compact dict
...
Issue #28040 : Fix _PyDict_DelItem_KnownHash() and _PyDict_Pop(): convert
splitted table to combined table to be able to delete the item.
Write an unit test for the issue.
Patch by INADA Naoki.
2016-09-09 19:28:36 -07:00
Brett Cannon
a721abac29
Issue #26331 : Implement the parsing part of PEP 515.
...
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Serhiy Storchaka
7c19affdce
Issue #25856 : The __module__ attribute of extension classes and functions
...
now is interned. This leads to more compact pickle data with protocol 4.
2016-09-10 00:53:02 +03:00
Victor Stinner
ae8b69c410
Issue #27810 : Add _PyCFunction_FastCallKeywords()
...
Use _PyCFunction_FastCallKeywords() in ceval.c: it allows to remove a lot of
code from ceval.c which was only used to call C functions.
2016-09-09 14:07:44 -07:00
Benjamin Peterson
621b430a14
remove all usage of Py_LOCAL
2016-09-09 13:54:34 -07:00
Victor Stinner
d873572095
Add _PyObject_FastCallKeywords()
...
Issue #27830 : Add _PyObject_FastCallKeywords(): avoid the creation of a
temporary dictionary for keyword arguments.
Other changes:
* Cleanup call_function() and fast_function() (ex: rename nk to nkwargs)
* Remove now useless do_call(), replaced with _PyObject_FastCallKeywords()
2016-09-09 12:36:44 -07:00
Benjamin Peterson
6cb526e54d
remove unconvincing use of Py_LOCAL
2016-09-09 12:42:51 -07:00
Eric Snow
06aed90a1f
Issue #27576 : Fix call order in OrderedDict.__init__().
2016-09-09 11:59:08 -07:00
Yury Selivanov
eb6364557f
Issue #28003 : Implement PEP 525 -- Asynchronous Generators.
2016-09-08 22:01:51 -07:00
Berker Peksag
71c01d43a7
Issue #28033 : Fix typo in dictobject.c
...
Patch by Wesley Emeneker.
2016-09-09 03:57:23 +03:00
Eric Snow
4f29e75289
Issue #24254 : Drop cls.__definition_order__.
2016-09-08 15:11:11 -07:00
Christian Heimes
07a2a1b7e5
Additional safe-guard against dereferencing NULL in reduce_newobj
...
_PyObject_GetNewArguments() can leave args == NULL but the __newobj_ex__
branch expects args to be not-NULL.
CID 1353201
2016-09-09 00:21:22 +02:00
Christian Heimes
884332b45a
Add NULL check for gen->gi_code in gen_send_ex()
...
_PyGen_Finalize() checks that gen->gi_code is not NULL before it
accesses the flags of the code object. This means that the flag
could be NULL.
It passes down the generatore to gen_close() and gen_send_ex().
gen_send_ex() did not check for gen->gi_code != NULL.
CID 1297900
2016-09-09 00:20:13 +02:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
Benjamin Peterson
b88db8745b
supress coroutine warning when an exception is pending ( #27968 )
2016-09-07 08:46:59 -07:00
Benjamin Peterson
33d2a492d0
promote some shifts to unsigned, so as not to invoke undefined behavior
2016-09-06 20:40:04 -07:00
Benjamin Peterson
5a7d923e75
make sure to not call memcpy with a NULL second argument
2016-09-06 17:58:25 -07:00
Benjamin Peterson
bdddb11b0e
clear out f_gen during generator finalization ( closes #27812 )
...
Patch from Armin Rigo.
2016-09-05 10:39:57 -07:00
Benjamin Peterson
2f40ed4b94
do not allow _PyGen_Finalize to fail ( closes #27811 )
...
Patch from Armin Rigo.
2016-09-05 10:14:54 -07:00
Benjamin Peterson
3c569295d6
do not worry about 64-bit dict sizes on 32-bit platforms
2016-09-08 13:16:41 -07:00
Victor Stinner
3b6a6b4215
Add a new private version to the builtin dict type
...
Issue #26058 : Add a new private version to the builtin dict type, incremented
at each dictionary creation and at each dictionary change.
Implementation of the PEP 509.
2016-09-08 12:51:24 -07:00
R David Murray
110b6fecbb
#27364 : Deprecate invalid escape strings in str/byutes.
...
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
2016-09-08 15:34:08 -04:00
Benjamin Peterson
186122ead2
access dk_indices through a union
2016-09-08 12:20:12 -07:00
Victor Stinner
a4348cc1be
Add documentation to the dict implementation
...
Issue #27350 .
2016-09-08 12:01:25 -07:00
Victor Stinner
58f7c5a955
Reindeint DK_xxx macros
...
Issue #27350 .
2016-09-08 11:37:36 -07:00
Victor Stinner
208857ec33
dk_get_index/dk_set_index uses a type indices variable
...
Issue #27350 .
2016-09-08 11:35:46 -07:00
Benjamin Peterson
82cce4c5ef
use static inline instead of Py_LOCAL_INLINE
2016-09-08 11:56:06 -07:00
Victor Stinner
dee6e252cc
Split lookdict_unicode_nodummy() assertion to debug
...
Issue #27350 .
2016-09-08 11:16:07 -07:00
Benjamin Peterson
ee178e6d6e
fix spelling
2016-09-08 11:08:30 -07:00
Victor Stinner
71211e3386
Add assertions to dk_set_index()
...
Issue #27350 .
2016-09-08 10:52:46 -07:00