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
40b41fa531
merge 3.6
2016-09-22 23:40:08 -07:00
Benjamin Peterson
7b7228a709
remove unneeded cast
2016-09-22 23:39:59 -07:00
Serhiy Storchaka
cf4fb40b9d
Issue #28214 : Now __set_name__ is looked up on the class instead of the
...
instance.
2016-09-21 15:55:49 +03: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
71276144bd
Merge 3.6
2016-09-21 14:14:59 +02: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
e5ad75e242
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:38 +02:00
Christian Heimes
2f2fee19ec
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:27 +02:00
Benjamin Peterson
637d1e2b0a
merge 3.6
2016-09-20 20:39:44 -07: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
2113c6e41b
merge
2016-09-18 21:46:34 -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
f820836e6c
merge 3.6
2016-09-18 19:25:00 -07:00
Benjamin Peterson
5d4b09c106
correct silly spelling problem
2016-09-18 19:24:52 -07:00
Benjamin Peterson
beb6cf6822
merge 3.6
2016-09-18 19:22:27 -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
630783d811
merge 3.6
2016-09-18 19:19:38 -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
Mark Dickinson
c1c4a64edb
Issue #27111 : Minor simplication to long_add and long_sub fast path code. Thanks Oren Milman.
2016-09-17 20:01:56 +01:00
Mark Dickinson
fba121fe9d
Issue #27441 : Remove some redundant assignments to ob_size in longobject.c. Thanks Oren Milman.
2016-09-17 19:44:13 +01:00
Mark Dickinson
92ca535626
Issue #27222 : various cleanups in long_rshift. Thanks Oren Milman.
2016-09-17 17:50:50 +01: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
Steve Dower
cc16be85c0
Issue #27781 : Change file system encoding on Windows to UTF-8 (PEP 529)
2016-09-08 10:35:16 -07:00
Benjamin Peterson
003f059b3a
link to canonical blogspot
2016-09-08 10:14:31 -07:00
Benjamin Peterson
7322225a57
use native inline instead of Py_LOCAL_INLINE
2016-09-08 09:58:47 -07:00
Benjamin Peterson
f0acae2d3c
rearrange to make gcc happy
2016-09-08 09:50:08 -07:00
Victor Stinner
98ee9d5b73
Add Py_MEMBER_SIZE macro
...
Issue #27350 : use Py_MEMBER_SIZE() macro to get the size of
PyDictKeyEntry.dk_indices, rather than hardcoding 8.
2016-09-08 09:33:56 -07:00
Victor Stinner
742da040db
Implement compact dict
...
Issue #27350 : `dict` implementation is changed like PyPy. It is more compact
and preserves insertion order.
_PyDict_Dummy() function has been removed.
Disable test_gdb: python-gdb.py is not updated yet to the new structure of
compact dictionaries (issue #28023 ).
Patch written by INADA Naoki.
2016-09-07 17:40:12 -07:00
Benjamin Peterson
47ff0734b8
more PY_LONG_LONG to long long
2016-09-08 09:15:54 -07:00
Eric Snow
c943265ba5
Issue #15767 : Add ModuleNotFoundError.
2016-09-07 15:42:32 -07:00
Benjamin Peterson
2e7c5e9c11
replace some Py_LOCAL_INLINE with the inline keyword
2016-09-07 15:33:32 -07:00
Brett Cannon
d0600ed524
Make PyCodeObject.co_extra even more private to force users through the proper API.
2016-09-07 14:30:39 -07:00
Benjamin Peterson
d39206a78c
use c++ style comments
2016-09-07 14:12:36 -07:00
Brett Cannon
3788b85628
Change error return value to be more consistent with the rest of Python
2016-09-07 12:51:08 -07:00
Benjamin Peterson
1bf494b0ec
use a the bool type for a boolean variable
2016-09-07 11:28:35 -07:00
Brett Cannon
5c4de2863b
Add the co_extra field and accompanying APIs to code objects.
...
This completes PEP 523.
2016-09-07 11:16:41 -07:00
Benjamin Peterson
a9296e7f3b
require C99 bool
2016-09-07 11:06:17 -07:00
Benjamin Peterson
2f8bfef158
replace PY_SIZE_MAX with SIZE_MAX
2016-09-07 09:26:18 -07:00
Benjamin Peterson
9d2617bec0
merge 3.5 ( #27968 )
2016-09-07 08:47:18 -07:00
Benjamin Peterson
4b9abf3a27
merge 3.5
2016-09-06 20:42:17 -07:00
Brett Cannon
a571120410
Issue #27182 : Add support for path-like objects to PyUnicode_FSDecoder().
2016-09-06 19:36:01 -07:00
Benjamin Peterson
05448a62ae
merge 3.5
2016-09-06 17:58:44 -07:00
Victor Stinner
62ec3317d2
Optimize unicode_escape and raw_unicode_escape
...
Issue #16334 . Patch written by Serhiy Storchaka.
2016-09-06 17:04:34 -07:00
Victor Stinner
2740e46089
_PyUnicodeWriter: assert that max character <= MAX_UNICODE
2016-09-06 16:58:36 -07:00
Brett Cannon
ec6ce879c7
Issue #26027 : Support path-like objects in PyUnicode-FSConverter().
...
This is to add support for os.exec*() and os.spawn*() functions. Part
of PEP 519.
2016-09-06 15:50:29 -07:00
Benjamin Peterson
ca47063998
replace Py_(u)intptr_t with the c99 standard types
2016-09-06 13:47:26 -07:00
Benjamin Peterson
9b3d77052f
replace Python aliases for standard integer types with the standard integer types ( #17884 )
2016-09-06 13:24:00 -07:00
Serhiy Storchaka
ea525a2d1a
Issue #27078 : Added BUILD_STRING opcode. Optimized f-strings evaluation.
2016-09-06 22:07:53 +03:00
Benjamin Peterson
d953f8e10b
remove some silly defined() tests
2016-09-06 10:51:19 -07:00
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
2016-09-06 10:46:49 -07:00
Victor Stinner
3466bde1cc
Avoid calling functions with an empty string as format string
...
Directly pass NULL rather than an empty string.
2016-09-05 18:16:01 -07:00
Victor Stinner
ad8c83ad6b
Avoid inefficient way to call functions without argument
...
Don't pass "()" format to PyObject_CallXXX() to call a function without
argument: pass NULL as the format string instead. It avoids to have to parse a
string to produce 0 argument.
2016-09-05 17:53:15 -07:00
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
2016-09-05 17:44:18 -07:00
Victor Stinner
942889aae2
Issue #27938 : Add a fast-path for us-ascii encoding
...
Other changes:
* Rewrite _Py_normalize_encoding() as a C implementation of
encodings.normalize_encoding(). For example, " utf-8 " is now normalized to
"utf_8". So the fast path is now used for more name variants of the same
encoding.
* Avoid strcpy() when encoding is NULL: call directly the UTF-8 codec
2016-09-05 15:40:10 -07:00
Eric Snow
92a6c170e6
Issue #24254 : Preserve class attribute definition order.
2016-09-05 14:50:11 -07:00
Benjamin Peterson
55f445282d
remove memory indirections in dict_traverse ( closes #27956 )
2016-09-05 12:12:59 -07:00
Victor Stinner
2250c4cb81
Issue #27830 : Remove unused _PyStack_AsDict()
...
I forgot to remove this function, I made a mistake in my revert.
2016-09-05 11:43:18 -07:00
Benjamin Peterson
7b24b27302
merge 3.5 ( #27812 )
2016-09-05 10:40:34 -07:00
Benjamin Peterson
98020812e6
merge 3.5 ( closes #27811 )
2016-09-05 10:16:31 -07:00
Mark Dickinson
7c4e409d07
Issue #11734 : Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens.
2016-09-03 17:21:29 +01:00
Victor Stinner
1a05d6c04d
PEP 7 style for if/else in C
...
Add also a newline for readability in normalize_encoding().
2016-09-02 12:12:23 +02:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Mark Dickinson
82a95277b8
Issue #27870 : A left shift of zero by a large integer no longer attempts to allocate large amounts of memory.
2016-08-29 19:27:06 +01:00
Mark Dickinson
4e1de16f88
Issue #25402 : in int-to-decimal-string conversion, reduce intermediate storage requirements and relax restriction on converting large integers. Patch by Serhiy Storchaka.
2016-08-29 17:26:43 +01:00
Mark Dickinson
583c6e860c
Issue #27214 : Fix potential bug and remove useless optimization in long_invert. Thanks Oren Milman.
2016-08-29 16:40:29 +01:00
Martin Panter
1b6c6da85d
Issue #27506 : Support bytes/bytearray.translate() delete as keyword argument
...
Patch by Xiang Zhang.
2016-08-27 08:35:02 +00:00
Raymond Hettinger
f74c33ad5c
Merge
2016-08-25 21:12:16 -07:00
Raymond Hettinger
7ea386e56e
Issue 19504: Change "customise" to "customize" American spelling.
2016-08-25 21:11:50 -07:00
Victor Stinner
e90bdb19f2
Issue #27830 : Revert, remove _PyFunction_FastCallKeywords()
2016-08-25 23:26:50 +02:00
Victor Stinner
3f1057a4b6
method_call() and slot_tp_new() now uses fast call
...
Issue #27841 : Add _PyObject_Call_Prepend() helper function to prepend an
argument to existing arguments to call a function. This helper uses fast calls.
Modify method_call() and slot_tp_new() to use _PyObject_Call_Prepend().
2016-08-25 01:04:14 +02:00
Victor Stinner
f7507dd3e8
Issue #27830 : Fix _PyObject_FastCallKeywords()
...
Pass stack, not unrelated and uninitialized args!
2016-08-25 01:00:31 +02:00
Victor Stinner
53cb489ed0
_PyObject_FastCallDict(): avoid _Py_CheckFunctionResult()
...
_PyObject_FastCallDict() only requires _Py_CheckFunctionResult() for the
slow-path. Other cases already check for the result.
2016-08-25 00:39:34 +02:00
Victor Stinner
577e1f8cb4
Add _PyObject_FastCallKeywords()
...
Issue #27830 : Similar to _PyObject_FastCallDict(), but keyword arguments are
also passed in the same C array than positional arguments, rather than being
passed as a Python dict.
2016-08-25 00:29:32 +02:00
Victor Stinner
74319ae219
Use Py_ssize_t type for number of arguments
...
Issue #27848 : use Py_ssize_t rather than C int for the number of function
positional and keyword arguments.
2016-08-25 00:04:09 +02:00
Victor Stinner
dd69564c38
PyObject_CallMethodObjArgs() now uses fast call
...
Issue #27809 :
* PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and
PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a
temporary tuple
* Rename objargs_mktuple() to objargs_mkstack()
* objargs_mkstack() now stores objects in a C array using borrowed references,
instead of storing arguments into a tuple
objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments
or less, or allocates a buffer in the heap memory.
Note: this change is different than the change 0e4f26083bbb, I fixed the test
to decide if the small stack can be used or not. sizeof(PyObject**) was also
replaced with sizeof(stack[0]) since the sizeof() was wrong (but gave the same
result).
2016-08-24 01:14:54 +02:00
Victor Stinner
d48af09043
Backed out changeset 0e4f26083bbb (PyObject_CallMethodObjArgs)
2016-08-24 00:59:40 +02:00
Victor Stinner
e62b852605
PyObject_CallMethodObjArgs() now uses fast call
...
Issue #27809 :
* PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and
PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a
temporary tuple
* Rename objargs_mktuple() to objargs_mkstack()
* objargs_mkstack() now stores objects in a C array using borrowed references,
instead of storing arguments into a tuple
objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments
or less, or allocates a buffer in the heap memory.
2016-08-24 00:01:56 +02:00
Victor Stinner
463b86a881
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* init_subclass()
* builtin___build_class__()
Fix also a bug in init_subclass(): check for super() failure.
2016-08-22 23:33:13 +02:00
Victor Stinner
2990fa11bc
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* builtin_sorted()
* classmethoddescr_call()
* methoddescr_call()
* wrapperdescr_call()
2016-08-22 23:21:55 +02:00
Victor Stinner
b900939186
_PyFunction_FastCallDict() supports keyword args
...
Issue #27809 :
* Rename _PyFunction_FastCall() to _PyFunction_FastCallDict()
* Rename _PyCFunction_FastCall() to _PyCFunction_FastCallDict()
* _PyFunction_FastCallDict() now supports keyword arguments
2016-08-22 23:15:44 +02:00
Victor Stinner
559bb6a713
Rename _PyObject_FastCall() to _PyObject_FastCallDict()
...
Issue #27809 :
* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Mark Dickinson
b820d7f631
Issue #27792 : force int return type for modulo operations involving bools.
2016-08-22 12:24:46 +01:00
Serhiy Storchaka
54cd1969ea
Issue #26984 : int() now always returns an instance of exact int.
2016-08-21 20:03:08 +03:00
Mark Dickinson
1dc3c898a8
Untabify Objects/longobject.c.
2016-08-21 10:33:36 +01:00
Mark Dickinson
dc590a4cc3
Issue #25604 : Fix minor bug in integer true division, which could
...
have caused off-by-one-ulp results on certain platforms.
2016-08-21 10:23:23 +01:00
Mark Dickinson
5d13238f6e
Issue #27662 : don't use PY_SIZE_MAX for overflow checking in List_New. Patch by Xiang Zhang.
2016-08-21 08:55:15 +01:00
Nick Coghlan
cbcd221de4
Merge #27782 fix from 3.5
2016-08-21 17:43:58 +10:00
Nick Coghlan
8682f578c1
Issue #27782 : Fix m_methods handling in multiphase init
...
Multi-phase extension module import now correctly allows the
``m_methods`` field to be used to add module level functions
to instances of non-module types returned from ``Py_create_mod``.
Patch by Xiang Zhang.
2016-08-21 17:41:56 +10:00
Serhiy Storchaka
3766572a48
Issue #27692 : Removed unnecessary NULL checks in exceptions.c.
...
Patch by Xiang Zhang.
2016-08-20 21:22:03 +03:00
Victor Stinner
253021dd94
Issue #27366 : Fix init_subclass()
...
Handle PyTuple_New(0) failure.
2016-08-20 02:37:41 +02:00
Victor Stinner
9def0901e2
PyFile_WriteObject() now uses fast call
...
Issue #27128 : PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the
creation of a temporary tuple.
2016-08-20 00:44:04 +02:00
Victor Stinner
99ee9c70a7
calliter_iternext() now uses fast call
...
Issue #27128 : calliter_iternext() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
Cleanup also the code to reduce the indentation level.
2016-08-19 18:47:10 +02:00
Victor Stinner
6911267615
slot_tp_iter() now uses fast call
...
Issue #27128 : slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
2016-08-19 18:41:02 +02:00
Victor Stinner
20a3007a8d
slot_nb_bool() now uses fast call
...
Issue #27128 : slot_nb_bool() now calls _PyObject_FastCall() to avoid a
temporary empty tuple to call the slot function.
2016-08-19 18:28:25 +02:00
Victor Stinner
a12eec48b6
Issue #27128 : Cleanup slot_nb_bool()
...
Use an error label to reduce the level of indentation.
2016-08-19 18:26:05 +02:00
Victor Stinner
5e87749a8e
Issue #27128 : slot_sq_item() uses fast call
...
slot_sq_item() now calls _PyObject_FastCall() to avoid the creation of a
temporary tuple of 1 item to pass the 'item' argument to the slot function.
2016-08-19 18:19:42 +02:00
Victor Stinner
018016d8e3
Issue #27128 : Cleanup slot_sq_item()
...
* Invert condition of test to avoid levels of indentation
* Remove useless Py_XDECREF(args) in the error block
* Replace Py_XDECREF(func) with Py_DECREF(func) in the error block: func cannot
be NULL when reaching the error block
2016-08-19 18:17:37 +02:00
Victor Stinner
f736c261a2
call_method() and call_maybe() now use fast call
...
Issue #27128 . The call_method() and call_maybe() functions of typeobject.c now
use fast call for empty format string to avoid the creation of a temporary
empty tuple.
2016-08-19 18:05:37 +02:00
Victor Stinner
94463c980e
Cleanup call_method() and call_maybe()
...
Issue #27128 . Move va_start/va_end around Py_VaBuildValue().
2016-08-19 18:01:41 +02:00
Victor Stinner
56142c701b
Merge 3.5 (fix refleak in call_maybe())
2016-08-19 17:58:30 +02:00
Victor Stinner
6902ddf2ca
Fix a refleak in call_maybe()
...
Issue #27128 . Fix a reference leak if creating the tuple to pass positional
parameters fails.
2016-08-19 17:58:12 +02:00
Victor Stinner
59e9ca6bda
Merge 3.5 (fix refleak in call_method)
2016-08-19 17:52:08 +02:00
Victor Stinner
d925bd5794
Fix a refleak in call_method()
...
Issue #27128 . Fix a reference leak if creating the tuple to pass positional
parameters fails.
2016-08-19 17:51:49 +02:00
Victor Stinner
a7720f61aa
contains and rich compare slots use fast call
...
Issue #27128 . Modify slot_sq_contains() and slot_tp_richcompare() to use fast
call to avoid a temporary tuple to pass a single positional parameter.
2016-08-19 17:48:51 +02:00
Victor Stinner
8a31c82093
Fix PyObject_Call() parameter names
...
Issue #27128 : arg=>args, kw=>kwargs.
Same change for PyEval_CallObjectWithKeywords().
2016-08-19 17:12:23 +02:00
Victor Stinner
0d1a799343
Avoid call_function_tail() for empty format str
...
Issue #27128 , PyObject_CallFunction(), _PyObject_FastCall() and callmethod():
if the format string of parameters is empty, avoid the creation of an empty
tuple: call _PyObject_FastCall() without parameters.
2016-08-19 17:04:54 +02:00
Victor Stinner
71aea8e981
PEP 7: add {...} around null_error() in abstract.c
...
Issue #27128 .
2016-08-19 16:59:55 +02:00
Victor Stinner
d042f1f5eb
Cleanup callmethod()
...
Make callmethod() less weird: don't decrement func reference counter,
the caller is now responsible to do that.
Issue #27128 .
2016-08-19 16:56:49 +02:00
Victor Stinner
64faad6e45
Cleanup call_function_tail()
...
Make call_function_tail() less weird: don't decrement args reference counter,
the caller is now responsible to do that. The caller now also checks if args is
NULL.
Issue #27128 .
2016-08-19 16:50:49 +02:00
Victor Stinner
8880708f81
call_function_tail() uses fast call
...
Issue #27128 : Modify call_function_tail() to use _PyObject_FastCall() when args
is not a tuple to avoid the creation of a temporary tuple.
call_function_tail() is used by:
* PyObject_CallFunction()
* PyObject_CallMethod()
* _PyObject_CallMethodId()
2016-08-19 16:44:19 +02:00
Victor Stinner
9be7e7b52f
Add _PyObject_FastCall()
...
Issue #27128 : Add _PyObject_FastCall(), a new calling convention avoiding a
temporary tuple to pass positional parameters in most cases, but create a
temporary tuple if needed (ex: for the tp_call slot).
The API is prepared to support keyword parameters, but the full implementation
will come later (_PyFunction_FastCall() doesn't support keyword parameters
yet).
Add also:
* _PyStack_AsTuple() helper function: convert a "stack" of parameters to
a tuple.
* _PyCFunction_FastCall(): fast call implementation for C functions
* _PyFunction_FastCall(): fast call implementation for Python functions
2016-08-19 16:11:43 +02:00
Berker Peksag
7fbce56a57
Issue #12946 : Remove dead code in PyModule_GetDict
...
PyModule_NewObject already sets md_dict to PyDict_New():
m->md_dict = PyDict_New();
2016-08-19 12:00:13 +03:00
Berker Peksag
3f015a64b8
Issue #27157 : Make only type() itself accept the one-argument form
...
Patch by Eryk Sun and Emanuel Barry.
2016-08-19 11:04:07 +03:00
Guido van Rossum
97c1adf393
Anti-registration of various ABC methods.
...
- Issue #25958 : Support "anti-registration" of special methods from
various ABCs, like __hash__, __iter__ or __len__. All these (and
several more) can be set to None in an implementation class and the
behavior will be as if the method is not defined at all.
(Previously, this mechanism existed only for __hash__, to make
mutable classes unhashable.) Code contributed by Andrew Barnert and
Ivan Levkivskyi.
2016-08-18 09:22:23 -07:00
Victor Stinner
8bcf312d09
Issue #27786 : Simplify x_sub()
...
The z variable is known to be a fresh number which cannot be shared, Py_SIZE()
can be used directly to negate the number.
2016-08-17 19:48:33 +02:00
Serhiy Storchaka
eb24988962
Issue #27704 : Optimized creating bytes and bytearray from byte-like objects
...
and iterables. Speed up to 3 times for short objects. Original patch by
Naoki Inada.
2016-08-15 09:46:07 +03:00
Serhiy Storchaka
9171a8b4ce
Issue #27574 : Decreased an overhead of parsing keyword arguments in functions
...
implemented with using Argument Clinic.
2016-08-14 10:52:18 +03:00
Serhiy Storchaka
febc332056
Issue #26754 : Undocumented support of general bytes-like objects
...
as path in compile() and similar functions is now deprecated.
2016-08-06 23:29:29 +03:00
Martin Panter
02b75abf73
Merge spelling and grammar fixes from 3.5
2016-08-05 01:51:39 +00:00
Martin Panter
69332c1a64
Fix spelling and grammar in documentation and code comments
2016-08-04 13:07:31 +00:00
Berker Peksag
a787e5f31d
Issue #27652 : Expose ESHUTDOWN conditionally
...
ESHUTDOWN is also exposed conditionally in Modules/errnomodule.c.
Patch by Ed Schouten.
2016-07-30 14:14:12 +03:00
Berker Peksag
01d1719062
Issue #27366 : Tweak PEP 487 documentation
...
* Added versionadded directives
* Deleted duplicate sentence from __init_subclass__ docstring
* Modernized tests
2016-07-30 14:06:15 +03:00
Nick Coghlan
d78448e912
Issue #27366 : Implement PEP 487
...
- __init_subclass__ called when new subclasses defined
- __set_name__ called when descriptors are part of a
class definition
2016-07-30 16:26:03 +10:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Xavier de Gaye
8d4989687c
(merge from 3.5) Issue #26662 : Set PYTHON_FOR_GEN in configure
...
as the Python program to be used for file generation during the build.
2016-07-26 12:55:20 +02:00
Xavier de Gaye
fd0d5939bd
Issue #26662 : Set PYTHON_FOR_GEN in configure
...
as the Python program to be used for file generation during the build.
2016-07-26 12:48:08 +02:00
Martin Panter
b93d8637a6
Issue #1621 : Avoid signed overflow in list and tuple operations
...
Patch by Xiang Zhang.
2016-07-25 02:39:20 +00:00
Martin Panter
32d2ce3561
Issue #27581 : Merge overflow fix from 3.5
2016-07-25 03:31:29 +00:00
Martin Panter
e8db861f47
Issue #27581 : Don’t rely on overflow wrapping in PySequence_Tuple()
...
Patch by Xiang Zhang.
2016-07-25 02:30:05 +00:00
Berker Peksag
ced8d4c6eb
Issue #27454 : Use PyDict_SetDefault in PyUnicode_InternInPlace
...
Patch by INADA Naoki.
2016-07-25 04:40:39 +03:00
Martin Panter
bd09f15b69
Issue #27507 : Merge overflow check from 3.5
2016-07-18 08:18:32 +00:00
Martin Panter
371731ebfd
Issue #27507 : Check for integer overflow in bytearray.extend()
...
Patch by Xiang Zhang.
2016-07-18 07:53:13 +00:00
Benjamin Peterson
ab078e9ed1
Backed out changeset af29d89083b3 ( closes #25548 ) ( closes #27498 )
2016-07-13 21:13:29 -07:00
Serhiy Storchaka
ca0da9b0a3
Issue #27473 : Fixed possible integer overflow in bytes and bytearray
...
concatenations. Patch by Xiang Zhang.
2016-07-10 20:51:35 +03:00
Serhiy Storchaka
06cfb0cd70
Issue #27473 : Fixed possible integer overflow in bytes and bytearray
...
concatenations. Patch by Xiang Zhang.
2016-07-10 20:48:43 +03:00
R David Murray
ce85acff3a
Merge: #20647 : Update dictobject.c comments to account for randomized string hashes.
2016-07-10 12:40:03 -04:00
R David Murray
537ad7ad9f
#20647 : Update dictobject.c comments to account for randomized string hashes.
...
Patch by Jaysinh Shukla.
2016-07-10 12:33:18 -04:00
Serhiy Storchaka
f9efb8b18b
Issue #27474 : Unified error messages in the __contains__ method of bytes and
...
bytearray for integers in and out of the Py_ssize_t range.
Patch by Xiang Zhang.
2016-07-10 12:37:30 +03:00
Benjamin Peterson
c13d85bf8d
merge 3.5 ( #27248 )
...
Patch from Xiang Zhang.
2016-07-06 23:28:19 -07:00
Benjamin Peterson
27007dccec
fix refleaks in PyDict_SetItem error cases ( closes #27248 )
2016-07-06 23:26:32 -07:00
Serhiy Storchaka
f54d7811c3
Issue #27460 : Unified error messages in bytes constructor for integers
...
in and out of the Py_ssize_t range. Patch by Xiang Zhang.
2016-07-06 21:39:44 +03:00
Serhiy Storchaka
7e160ce356
Issue #23034 : The output of a special Python build with defined COUNT_ALLOCS,
...
SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can
be re-enabled using the "-X showalloccount" option. It now outputs to stderr
instead of stdout.
2016-07-03 21:03:53 +03:00
Serhiy Storchaka
6c94d10a19
Issue #27443 : __length_hint__() of bytearray itearator no longer return
...
negative integer for resized bytearray.
2016-07-03 14:42:17 +03:00
Serhiy Storchaka
af65872da2
Issue #27443 : __length_hint__() of bytearray itearator no longer return
...
negative integer for resized bytearray.
2016-07-03 14:41:36 +03:00
Serhiy Storchaka
e09132f2c7
Backed out changeset b0087e17cd5e (issue #26765 )
...
For unknown reasons it perhaps caused a crash on 32-bit Windows (issue #).
2016-07-03 13:57:48 +03:00
Serhiy Storchaka
ab8bcb34dc
Issue #26765 : Fixed parsing Py_ssize_t arguments on 32-bit Windows.
2016-07-03 13:26:52 +03:00
Serhiy Storchaka
355048970b
Issue #26765 : Moved wrappers for bytes and bytearray methods to common header
...
file.
2016-07-01 17:57:30 +03:00
Serhiy Storchaka
0855e706aa
Issue #27007 : The fromhex() class methods of bytes and bytearray subclasses
...
now return an instance of corresponding subclass.
2016-07-01 17:22:31 +03:00
Martin Panter
590dcab95a
Merge spelling fixes from 3.5
2016-06-20 07:55:14 +00:00
Martin Panter
2275e626b1
Fix spelling errors in code comments
2016-06-20 07:52:50 +00:00
Serhiy Storchaka
f95de0e8cc
Issue #26754 : PyUnicode_FSDecoder() accepted a filename argument encoded as
...
an iterable of integers. Now only strings and byte-like objects are accepted.
2016-06-18 13:56:16 +03:00
Serhiy Storchaka
9305d83425
Issue #26754 : PyUnicode_FSDecoder() accepted a filename argument encoded as
...
an iterable of integers. Now only strings and byte-like objects are accepted.
2016-06-18 13:53:36 +03:00
Serhiy Storchaka
5d062d7ba3
Issue #27333 : Simplified testing step on 0.
2016-06-18 09:51:55 +03:00
Serhiy Storchaka
cfdfbb4d3c
Issue #27342 : Replaced some Py_XDECREFs with Py_DECREFs.
...
Patch by Xiang Zhang.
2016-06-18 09:44:03 +03:00
Serhiy Storchaka
5697c4b641
Comment fixes extracted from patch by Demur Rumed.
2016-06-12 17:02:10 +03:00
Yury Selivanov
711d25db48
Merge 3.5 (issue #27243 )
2016-06-09 15:13:16 -04:00
Yury Selivanov
a6f6edbda8
Issue #27243 : Fix __aiter__ protocol
2016-06-09 15:08:31 -04:00
Serhiy Storchaka
5dee6551e2
Issue #26305 : Argument Clinic now uses braces in C code as required by PEP 7.
2016-06-09 16:16:06 +03:00
Victor Stinner
e18719509f
odict: Remove useless ";" after function definition
...
Fix a "gcc -pendatic" warning.
2016-06-08 10:18:18 +02:00
Serhiy Storchaka
841de28035
Issue #27225 : Fixed a reference leak in type_new when setting __new__ fails.
...
Patch by Xiang Zhang.
2016-06-05 10:50:16 +03:00
Serhiy Storchaka
484c913ed9
Issue #27225 : Fixed a reference leak in type_new when setting __new__ fails.
...
Patch by Xiang Zhang.
2016-06-05 10:48:36 +03:00
Kushal Das
5801ecb440
Issue #25548 : Showing memory address of class objects in repl
2016-06-04 16:21:13 -07:00
Serhiy Storchaka
64c26e5f60
Issue #20041 : Fixed TypeError when frame.f_trace is set to None.
...
Patch by Xavier de Gaye.
2016-06-04 20:33:33 +03:00
Serhiy Storchaka
64a263a1ce
Issue #20041 : Fixed TypeError when frame.f_trace is set to None.
...
Patch by Xavier de Gaye.
2016-06-04 20:32:36 +03:00
Serhiy Storchaka
e63e5d60ee
Issue #27073 : Removed redundant checks in long_add and long_sub.
...
Patch by Oren Milman.
2016-06-04 00:06:45 +03:00
Serhiy Storchaka
16931c3559
Issue #26983 : float() now always return an instance of exact float.
...
The deprecation warning is emitted if __float__ returns an instance of
a strict subclass of float. In a future versions of Python this can
be an error.
2016-06-03 21:42:55 +03:00
Martin Panter
0b7d84de6b
Issue #27171 : Merge typo fixes from 3.5
2016-06-02 10:11:18 +00:00
Martin Panter
e26da7c03a
Issue #27171 : Fix typos in documentation, comments, and test function names
2016-06-02 10:07:09 +00:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00:00
Martin Panter
e501a93c18
Issue #27125 : Merge typo fixes from 3.5
...
Also merge changes from Issue #27117 ; no actual code changes to 3.6.
2016-05-29 09:05:06 +00:00
Martin Panter
8d56c026a5
Issue #27125 : Fix various errors like “will [be] inherited”
2016-05-29 04:13:35 +00:00
Benjamin Peterson
6ca4260219
merge 3.5
2016-05-28 14:05:11 -07:00
Benjamin Peterson
c352620c92
backout 3c9512d8ac0d
2016-05-28 14:04:40 -07:00
Serhiy Storchaka
27ba8864a4
Issue #27118 : Clean up Py_XINCREF/Py_XDECREF in typeobject.c.
...
Patch by Xiang Zhang.
2016-05-25 16:14:55 +03:00
Serhiy Storchaka
b0f80b0312
Issue #26647 : Python interpreter now uses 16-bit wordcode instead of bytecode.
...
Patch by Demur Rumed.
2016-05-24 09:15:14 +03:00
Serhiy Storchaka
4b23494ded
Issue #27039 : Fixed bytearray.remove() for values greater than 127.
...
Based on patch by Joe Jevnik.
2016-05-16 22:24:03 +03:00
Serhiy Storchaka
7bf36dace8
Issue #27039 : Fixed bytearray.remove() for values greater than 127.
...
Patch by Joe Jevnik.
2016-05-16 22:15:38 +03:00
Serhiy Storchaka
bcde10aa7e
Issue #26765 : Ensure that bytes- and unicode-specific stringlib files are used
...
with correct type.
2016-05-16 09:42:29 +03:00
Benjamin Peterson
99740925ed
merge 3.5
2016-05-12 23:14:28 -07:00
Benjamin Peterson
07451ddd4f
fix indentation of comments in cellobject.c ( closes #27011 )
2016-05-12 23:12:21 -07:00
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:37:58 +03:00
Serhiy Storchaka
1f364438ad
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:39:32 +03:00
Serhiy Storchaka
5787ef621a
Issue #27005 : Fixed the call of PyObject_CallFunctionObjArgs().
2016-05-12 10:32:30 +03:00
Serhiy Storchaka
25885d1dc5
Issue #27005 : Optimized the float.fromhex() class method for exact float.
2016-05-12 10:21:14 +03:00
Serhiy Storchaka
17e22959a4
Issue #17765 : weakref.ref() no longer silently ignores keyword arguments.
...
Patch by Georg Brandl.
2016-05-07 15:43:59 +03:00
Serhiy Storchaka
21eb48764c
Issue #17765 : weakref.ref() no longer silently ignores keyword arguments.
...
Patch by Georg Brandl.
2016-05-07 15:41:09 +03:00
Serhiy Storchaka
fb81d3cbe7
Issue #26765 : Moved common code for the replace() method of bytes and bytearray
...
to a template file.
2016-05-05 09:26:07 +03:00
Serhiy Storchaka
dd40fc3e57
Issue #26765 : Moved common code and docstrings for bytes and bytearray methods
...
to bytes_methods.c.
2016-05-04 22:23:26 +03:00
Serhiy Storchaka
fcce462e9c
Issue #26811 : gc.get_objects() no longer contains a broken tuple with NULL
...
pointer.
2016-05-04 21:42:52 +03:00
Serhiy Storchaka
7822f151b6
Issue #26811 : gc.get_objects() no longer contains a broken tuple with NULL
...
pointer.
2016-05-04 21:42:05 +03:00
Serhiy Storchaka
7a9579c0ce
Got rid of redundand "self" parameter declarations.
...
Argument Clinic is now able to infer all needed information.
2016-05-02 13:45:20 +03:00
Berker Peksag
0ac70c0e90
Fix typos. Reported by andportnoy on GitHub.
2016-04-29 16:54:10 +03:00
Raymond Hettinger
8421d714d0
Removed unused initialization and the uninteresting comment.
2016-04-29 01:37:05 -07:00
Serhiy Storchaka
fa070298e9
Issue #26880 : Removed redundant checks in set.__init__.
2016-04-29 11:31:52 +03:00
Victor Stinner
71dc3d878a
Issue #25349 , #26249 : Fix memleak in formatfloat()
2016-04-26 12:35:13 +02:00
Victor Stinner
15932593ba
Issue #26249 : Try test_capi on Windows
2016-04-22 18:52:22 +02:00
Victor Stinner
f5c4b99034
PyMem_Malloc() now uses the fast pymalloc allocator
...
Issue #26249 : PyMem_Malloc() allocator family now uses the pymalloc allocator
rather than system malloc(). Applications calling PyMem_Malloc() without
holding the GIL can now crash: use PYTHONMALLOC=debug environment variable to
validate the usage of memory allocators in your application.
2016-04-22 16:26:23 +02:00
Martin Panter
abe4d52a1a
Merge doc and comment fixes from 3.5
2016-04-19 23:23:16 +00:00
Victor Stinner
0621e0ea86
Don't define _PyMem_PymallocEnabled() if pymalloc is disabled
...
Isse #26516 .
2016-04-19 17:02:55 +02:00
Martin Panter
8f26565ba9
Fix spelling (inital), grammar (may translates) in documentation, comments
2016-04-19 04:03:41 +00:00
Serhiy Storchaka
55c861f637
Issue #26745 : Removed redundant code in _PyObject_GenericSetAttrWithDict.
...
Based on patch by Xiang Zhang.
2016-04-17 20:31:51 +03:00
Serhiy Storchaka
b6a9c9761c
Issue #26778 : Fixed "a/an/and" typos in code comment, documentation and error
...
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka
6a7b3a77b4
Issue #26778 : Fixed "a/an/and" typos in code comment and documentation.
2016-04-17 08:32:47 +03:00
Benjamin Peterson
a4ed2daea3
merge 3.5
2016-04-16 15:12:37 -07:00
Benjamin Peterson
b0c04cb98c
fix slice cache finalization to use gc del
2016-04-16 15:12:29 -07:00
Benjamin Peterson
259d247b31
merge 3.5 ( #26659 )
2016-04-16 14:54:27 -07:00
Benjamin Peterson
2b601d3905
add gc support to slice ( closes #26659 )
2016-04-16 14:47:12 -07:00
Berker Peksag
43de36d2c7
Issue #26766 : Remove redundant bytearray_format() from bytearrayobject.c
2016-04-16 01:20:47 +03:00
Victor Stinner
e914d41312
Issue #26766 : Fix _PyBytesWriter_Finish()
...
Return a bytearray object when bytearray is requested and when the small buffer
is used.
Fix also test_bytes: bytearray%args must return a bytearray type.
2016-04-15 17:52:27 +02:00
Serhiy Storchaka
c9a59e6e4f
Issue #26764 : Fixed SystemError in bytes.__rmod__.
2016-04-15 14:11:10 +03:00
Martin Panter
cda80940ed
Issue #15984 : Merge PyUnicode doc from 3.5
2016-04-15 02:27:11 +00:00
Martin Panter
6245cb3c01
Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
...
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Serhiy Storchaka
21a663ea28
Issue #26057 : Got rid of nonneeded use of PyUnicode_FromObject().
2016-04-13 15:37:23 +03:00
Serhiy Storchaka
131b8f8eee
Issue #26718 : super.__init__ no longer leaks memory if called multiple times.
...
NOTE: A direct call of super.__init__ is not endorsed!
2016-04-13 15:28:53 +03:00
Serhiy Storchaka
3d7497608b
Issue #26718 : super.__init__ no longer leaks memory if called multiple times.
...
NOTE: A direct call of super.__init__ is not endorsed!
2016-04-13 15:27:33 +03:00
Serhiy Storchaka
59865e7fe1
Issue #26200 : Restored more safe usages of Py_SETREF.
2016-04-11 09:57:37 +03:00
Serhiy Storchaka
f01e408c16
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka
57a01d3a0e
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka
03f17f8671
Issue #17339 : Improved TypeError message in bytes constructor.
2016-04-10 14:44:59 +03:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03:00
Serhiy Storchaka
ab479c49d3
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka
fbb1c5ee06
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Raymond Hettinger
3625af5f21
Moved misplaced functions to the section for C API functions.
2016-03-27 01:15:07 -07:00
Raymond Hettinger
2c257ab0f8
Responsibility for argument checking belongs in set.__init__() rather than set.__new__().
...
See dict.__new__() and list.__new__() for comparison. Neither of those examine or touch
args or kwds. That work is done in the __init__() methods.
2016-03-26 04:10:11 -07:00
Raymond Hettinger
b72e21b9ab
Speed-up construction of empty sets by approx 12-14%.
2016-03-25 02:29:59 -07:00
Victor Stinner
f963c13597
longobject.c: fix compilation warning on Windows 64-bit
...
We know that Py_SIZE(b) is -1 or 1 an so fits into the sdigit type.
2016-03-23 18:36:54 +01:00
Victor Stinner
0aed3a4ebc
_PyMem_DebugFree(): fix compiler warning on Windows
...
Don't return a void value.
2016-03-23 11:30:43 +01:00
Victor Stinner
fac395681f
Optimize bytes.replace(b'', b'.')
...
Issue #26574 : Optimize bytes.replace(b'', b'.') and
bytearray.replace(b'', b'.'): up to 80% faster. Patch written by Josh Snider.
2016-03-21 10:38:58 +01:00
Victor Stinner
ad524375af
Fail if PyMem_Malloc() is called without holding the GIL
...
Issue #26563 : Debug hooks on Python memory allocators now raise a fatal error
if functions of the PyMem_Malloc() family are called without holding the GIL.
2016-03-16 12:12:53 +01:00
Victor Stinner
ffcf1a54d3
Oops, revert unwanted change used to create an example
...
Issue #26564 .
2016-03-15 22:49:40 +01:00
Victor Stinner
0611c26a58
On memory error, dump the memory block traceback
...
Issue #26564 : _PyObject_DebugDumpAddress() now dumps the traceback where a
memory block was allocated on memory block. Use the tracemalloc module to get
the traceback.
2016-03-15 22:22:13 +01:00
Victor Stinner
c4aec3628b
Check the GIL in PyObject_Malloc()
...
Issue #26558 : The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
2016-03-14 22:26:53 +01:00
Victor Stinner
34be807ca4
Add PYTHONMALLOC env var
...
Issue #26516 :
* Add PYTHONMALLOC environment variable to set the Python memory
allocators and/or install debug hooks.
* PyMem_SetupDebugHooks() can now also be used on Python compiled in release
mode.
* The PYTHONMALLOCSTATS environment variable can now also be used on Python
compiled in release mode. It now has no effect if set to an empty string.
* In debug mode, debug hooks are now also installed on Python memory allocators
when Python is configured without pymalloc.
2016-03-14 12:04:26 +01:00
Benjamin Peterson
0f04bc7959
merge 3.5 ( closes #26478 )
2016-03-03 22:10:52 -08:00
Benjamin Peterson
cfc2a1fc70
merge 3.4 ( closes #26478 )
2016-03-03 22:08:01 -08:00
Benjamin Peterson
f11b25b081
properly use the ObjArgs variant of CallMethod in dictview binary operations ( closes #26478 )
2016-03-03 22:05:36 -08:00
Yury Selivanov
d2dc15b26b
Merge 3.5 (issue #25888 )
2016-03-02 11:31:06 -05:00
Yury Selivanov
c724bae51c
coroutines: Error when awaiting on coroutine that's being awaited
...
Issue #25888
2016-03-02 11:30:46 -05:00
Victor Stinner
f2192855dd
Merge 3.5
2016-03-01 22:07:53 +01:00
Victor Stinner
337986740f
Issue #26464 : Fix unicode_fast_translate() again
...
Initialize i variable if the string is non-ASCII.
2016-03-01 21:59:58 +01:00
Victor Stinner
3d9d77a3dc
Merge 3.5
2016-03-01 21:30:50 +01:00
Victor Stinner
6c9aa8f2bf
Fix str.translate()
...
Issue #26464 : Fix str.translate() when string is ASCII and first replacements
removes character, but next replacement uses a non-ASCII character or a string
longer than 1 character. Regression introduced in Python 3.5.0.
2016-03-01 21:30:30 +01:00
Yury Selivanov
3e48b38dff
Merge 3.5 (issue #25887 )
2016-02-13 18:00:31 -05:00
Yury Selivanov
77c96813ab
Issue #25887 : Raise a RuntimeError when a coroutine is awaited more than once.
2016-02-13 17:59:05 -05:00
Yury Selivanov
e0b23095ee
Issues #26289 and #26315 : Optimize floor/modulo div for single-digit longs
...
Microbenchmarks show 2-2.5x improvement. Built-in 'divmod' function
is now also ~10% faster.
-m timeit -s "x=22331" "x//2;x//-3;x//4;x//5;x//-6;x//7;x//8;x//-99;x//100;"
with patch: 0.321 without patch: 0.633
-m timeit -s "x=22331" "x%2;x%3;x%-4;x%5;x%6;x%-7;x%8;x%99;x%-100;"
with patch: 0.224 without patch: 0.66
Big thanks to Serhiy Storchaka, Mark Dickinson and Victor Stinner for
thorow code reviews and algorithms improvements.
2016-02-11 10:26:27 -05:00
Martin Panter
7e3a91a5fc
Issue #26136 : Upgrade the generator_stop warning to DeprecationWarning
...
Patch by Anish Shah.
2016-02-10 04:40:48 +00:00
Serhiy Storchaka
d2962f145a
Issue #25949 : __dict__ for an OrderedDict instance is now created only when
...
needed.
2016-02-08 16:39:05 +02:00
Yury Selivanov
a0fcaca4e1
Issue #26288 : Fix comment
2016-02-06 12:21:33 -05:00
Yury Selivanov
186c30b7ae
Issue #26288 : Optimize PyLong_AsDouble.
2016-02-05 19:40:01 -05:00
Raymond Hettinger
f50215412c
Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
2016-02-04 02:46:16 -08:00
Raymond Hettinger
ce5179fcba
Issue #23601 : Use small object allocator for dict key objects
2016-01-31 08:56:21 -08:00
Victor Stinner
5b96f17b1c
Merge 3.5
2016-01-27 17:01:13 +01:00
Victor Stinner
5bc03a6d4d
Fix resize_compact()
...
Issue #26217 : resize_compact() must set wstr_length to 0 after freeing the wstr
string. Otherwise, an assertion fails in _PyUnicode_CheckConsistency().
2016-01-27 16:56:53 +01:00
Raymond Hettinger
0dceb91866
Tests versus zero are more compact than tests versus -1.
2016-01-25 10:33:30 -08:00
Victor Stinner
3cdd5fb970
code_richcompare() now uses the constants types
...
Issue #25843 : When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.
Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Victor Stinner
efb2413ce8
code_richcompare() now uses the constants types
...
Issue #25843 : When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.
Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Victor Stinner
9f78939552
Issue #26107 : Fix typo in Objects/lnotab_notes.txt
...
Double parenthesis
2016-01-21 18:12:29 +01:00
Victor Stinner
f3914eb16d
co_lnotab supports negative line number delta
...
Issue #26107 : The format of the co_lnotab attribute of code objects changes to
support negative line number delta.
Changes:
* assemble_lnotab(): if line number delta is less than -128 or greater than
127, emit multiple (offset_delta, lineno_delta) in co_lnotab
* update functions decoding co_lnotab to use signed 8-bit integers
- dis.findlinestarts()
- PyCode_Addr2Line()
- _PyCode_CheckLineNumber()
- frame_setlineno()
* update lnotab_notes.txt
* increase importlib MAGIC_NUMBER to 3361
* document the change in What's New in Python 3.6
* cleanup also PyCode_Optimize() to use better variable names
2016-01-20 12:16:21 +01:00
Victor Stinner
b56837a033
Merge 3.5
...
Issue #26154 : Add a new private _PyThreadState_UncheckedGet() function.
2016-01-20 11:19:46 +01:00
Victor Stinner
bfd316e750
Add _PyThreadState_UncheckedGet()
...
Issue #26154 : Add a new private _PyThreadState_UncheckedGet() function which
gets the current thread state, but don't call Py_FatalError() if it is NULL.
Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to
no more expose complex and private atomic types. Atomic types depends on the
compiler or can even depend on compiler options. The new function
_PyThreadState_UncheckedGet() allows to get the variable value without having
to care of the exact implementation of atomic types.
Changes:
* Replace direct usage of the _PyThreadState_Current variable with a call to
_PyThreadState_UncheckedGet().
* In pystate.c, replace direct usage of the _PyThreadState_Current variable
with the PyThreadState_GET() macro for readability.
* Document also PyThreadState_Get() in pystate.h
2016-01-20 11:12:38 +01:00
Serhiy Storchaka
4918b47c64
Issue #25935 : Garbage collector now breaks reference loops with OrderedDict.
2016-01-19 14:48:42 +02:00
Serhiy Storchaka
d205d0145c
Issue #25935 : Garbage collector now breaks reference loops with OrderedDict.
2016-01-19 14:46:25 +02:00
Benjamin Peterson
2c028492d4
merge 3.5 ( #25731 )
2016-01-18 21:18:35 -08:00
Benjamin Peterson
9ad11544bf
set tp_new from the class in the hierarchy that actually owns the descriptor ( closes #25731 )
...
Debugging by Eryk Sun.
2016-01-18 21:11:18 -08:00
doko@ubuntu.com
3b63dc3aa9
- merge 3.5
2016-01-14 14:05:21 +01:00
doko@ubuntu.com
17210f50d2
dictobject.c(dict_sizeof): Make it static again.
2016-01-14 14:04:59 +01:00
Barry Warsaw
3d220cc4d7
As per further discussion, re-enable the typeobject.c guard for picklability.
...
upstreams such as Cython will have to adjust.
2016-01-11 15:51:27 -05:00
Barry Warsaw
09880c89e9
Comment out some tests that won't pass now that we've reverted the
...
picklability regression. Also, as per further discussion, remove the
regressing code.
2016-01-11 15:14:53 -05:00
Barry Warsaw
ec71f1779f
Issue #22995 : [UPDATE] Comment out the one of the pickleability tests in
...
_PyObject_GetState() due to regressions observed in Cython-based projects.
2016-01-11 13:49:40 -05:00
Barry Warsaw
885e1939be
Issue #22995 : [UPDATE] Comment out the one of the pickleability tests in
...
_PyObject_GetState() due to regressions observed in Cython-based projects.
2016-01-11 13:24:02 -05:00
Serhiy Storchaka
576f132b98
Issue #20440 : Cleaning up the code by using Py_SETREF.
2016-01-05 21:27:54 +02:00
Benjamin Peterson
3e47a1337c
merge 3.5
2016-01-01 11:56:35 -06:00
Benjamin Peterson
4e3dd51396
merge 3.4
2016-01-01 11:56:16 -06:00
Benjamin Peterson
630329e4ea
merge 3.3
2016-01-01 11:55:47 -06:00
Benjamin Peterson
0e617e22f0
remove some copyright notices supserseded by the toplevel ones
2016-01-01 11:53:47 -06:00
Serhiy Storchaka
288cb25f1a
Issue #25961 : Disallowed null characters in the type name.
...
Simplified testing for null characters in __name__ setter.
2015-12-30 21:41:53 +02:00
Serhiy Storchaka
42bf8fc901
Issue #25961 : Disallowed null characters in the type name.
...
Simplified testing for null characters in __name__ setter.
2015-12-30 21:40:49 +02:00
Serhiy Storchaka
4e6aad1f7a
Clean up float.as_integer_ratio().
2015-12-29 22:55:48 +02:00
Serhiy Storchaka
0d250bc119
Issue #25971 : Optimized creating Fractions from floats by 2 times and from
...
Decimals by 3 times.
Unified error messages in float.as_integer_ratio(), Decimal.as_integer_ratio(),
and Fraction constructors.
2015-12-29 22:34:23 +02:00
Serhiy Storchaka
1ed017ae92
Issue #20440 : Cleaning up the code by using Py_SETREF and Py_CLEAR.
...
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner.
This patch doesn't fix bugs and hence there is no need to backport it.
2015-12-27 15:51:32 +02:00
Serhiy Storchaka
726fc139a5
Issue #20440 : More use of Py_SETREF.
...
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:44:33 +02:00
Serhiy Storchaka
191321d11b
Issue #20440 : More use of Py_SETREF.
...
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:41:34 +02:00
Serhiy Storchaka
bdb908ea54
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:38:28 +02:00
Serhiy Storchaka
4a1e70fc31
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:36:18 +02:00
Serhiy Storchaka
f9253c96fd
Issue #22995 : Instances of extension types with a state that aren't
...
subclasses of list or dict and haven't implemented any pickle-related
methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__,
or __getstate__), can no longer be pickled. Including memoryview.
2015-12-25 21:05:35 +02:00
Serhiy Storchaka
f81be8aa3f
Issue #22995 : Instances of extension types with a state that aren't
...
subclasses of list or dict and haven't implemented any pickle-related
methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__,
or __getstate__), can no longer be pickled. Including memoryview.
2015-12-25 21:04:29 +02:00
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Serhiy Storchaka
2d06e84455
Issue #25923 : Added the const qualifier to static constant arrays.
2015-12-25 19:53:18 +02:00
Serhiy Storchaka
f006940351
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:39:57 +02:00