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