summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Remove useless variable initializationVictor Stinner2016-12-091-9/+6
| | | | Don't initialize variables which are not used before they are assigned.
* Use PyObject_CallFunctionObjArgs()Victor Stinner2016-12-092-2/+2
| | | | | | | | | Issue #28915: Replace PyObject_CallFunction() with PyObject_CallFunctionObjArgs() when the format string was only made of "O" formats, PyObject* arguments. PyObject_CallFunctionObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
* Use _PyObject_FastCallVa() in type slotsVictor Stinner2016-12-081-81/+50
| | | | | Issue #28915: Replace Py_VaBuildValue()+PyObject_Call() with _PyObject_FastCallVa() to avoid the creation of temporary tuple.
* Add _PyObject_VaCallFunctionObjArgs() private functionVictor Stinner2016-12-081-5/+5
| | | | | Issue #28915: Similar to _PyObject_CallFunctionObjArgs() but use va_list to pass arguments.
* Use _PyObject_CallMethodIdObjArgs()Victor Stinner2016-12-081-1/+2
| | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string only use the format 'O' for objects, like "(O)". _PyObject_CallMethodIdObjArgs() avoids the code to parse a format string and avoids the creation of a temporary tuple.
* _PyObject_CallFunctionVa() uses fast callVictor Stinner2016-12-081-9/+25
| | | | | | | | Issue #28915: Use _Py_VaBuildStack() to build a C array of PyObject* and then use _PyObject_FastCall(). The function has a special case if the stack only contains one parameter and the parameter is a tuple: "unpack" the tuple of arguments in this case.
* Add _PyObject_CallFunctionVa() helperVictor Stinner2016-12-081-54/+29
| | | | | | | | | Issue #28915: Add _PyObject_CallFunctionVa() helper to factorize code of functions: * PyObject_CallFunction() * _PyObject_CallFunction_SizeT() * callmethod()
* Add _PyObject_FastCallVa() helperVictor Stinner2016-12-081-71/+37
| | | | | | | | | | | Issue #28915: Add _PyObject_FastCallVa() helper to factorize code of functions: * PyObject_CallFunctionObjArgs() * PyObject_CallMethodObjArgs() * _PyObject_CallMethodIdObjArgs() Inline objargs_mkstack() into _PyObject_FastCallVa(), remove objargs_mkstack().
* Issue #28818: Simplify lookdict functionsINADA Naoki2016-12-073-125/+97
|
* Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code.Serhiy Storchaka2016-12-071-1/+28
|\ | | | | | | Original patch by Andreas Stührk.
| * Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code.Serhiy Storchaka2016-12-071-1/+28
| |\ | | | | | | | | | Original patch by Andreas Stührk.
| | * Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code.Serhiy Storchaka2016-12-021-1/+28
| | | | | | | | | | | | Original patch by Andreas Stührk.
* | | _PyObject_FastCallKeywords() now calls directly tp_callVictor Stinner2016-12-061-15/+45
| | | | | | | | | | | | | | | _PyObject_FastCallKeywords() doesn't call _PyObject_FastCallDict() anymore: call directly tp_call.
* | | Fix typo in a comment of abstract.cVictor Stinner2016-12-061-1/+1
| | |
* | | Use _PyObject_CallNoArg()Victor Stinner2016-12-066-8/+8
| | | | | | | | | | | | | | | | | | | | | Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable)
* | | Use _PyObject_CallNoArg()Victor Stinner2016-12-062-6/+6
| | | | | | | | | | | | | | | | | | | | | Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
* | | Uniformize argument names of "call" functionsVictor Stinner2016-12-062-75/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #28838: Rename parameters of the "calls" functions of the Python C API. * Rename 'callable_object' and 'func' to 'callable': any Python callable object is accepted, not only Python functions * Rename 'method' and 'nameid' to 'name' (method name) * Rename 'o' to 'obj' * Move, fix and update documentation of PyObject_CallXXX() functions in abstract.h * Update also the documentaton of the C API (update parameter names)
* | | Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-2/+16
|\ \ \ | |/ /
| * | Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-2/+16
| |\ \ | | |/
| | * Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-2/+16
| | |
* | | Use directly _PyObject_GenericSetAttrWithDict()Victor Stinner2016-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Modify type_setattro() to call directly _PyObject_GenericSetAttrWithDict() instead of PyObject_GenericSetAttr(). PyObject_GenericSetAttr() is a thin wrapper to _PyObject_GenericSetAttrWithDict().
* | | Issue #28858: Remove _PyObject_CallArg1() macroVictor Stinner2016-12-054-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace _PyObject_CallArg1(func, arg) with PyObject_CallFunctionObjArgs(func, arg, NULL) Using the _PyObject_CallArg1() macro increases the usage of the C stack, which was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this issue.
* | | Merge #23722 from 3.6Nick Coghlan2016-12-051-2/+9
|\ \ \ | |/ /
| * | Issue #23722: improve __classcell__ compatibilityNick Coghlan2016-12-051-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling zero-argument super() in __init_subclass__ and __set_name__ involved moving __class__ initialisation to type.__new__. This requires cooperation from custom metaclasses to ensure that the new __classcell__ entry is passed along appropriately. The initial implementation of that change resulted in abruptly broken zero-argument super() support in metaclasses that didn't adhere to the new requirements (such as Django's metaclass for Model definitions). The updated approach adopted here instead emits a deprecation warning for those cases, and makes them work the same way they did in Python 3.5. This patch also improves the related class machinery documentation to cover these details and to include more reader-friendly cross-references and index entries.
* | | Backed out changeset b9c9691c72c5Victor Stinner2016-12-0417-30/+40
| | | | | | | | | | | | | | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* | | Replace PyObject_CallFunction() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack.
* | | Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-0117-40/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* | | Backed out changeset 7efddbf1aa70Victor Stinner2016-11-302-71/+68
| | |
* | | Uniformize argument names of "call" functionsVictor Stinner2016-11-292-68/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Callable object: callable, o, callable_object => func * Object for method calls: o => obj * Method name: name or nameid => method Cleanup also the C code: * Don't initialize variables to NULL if they are not used before their first assignement * Add braces for readability
* | | Issue #28797: Modifying the class __dict__ inside the __set_name__ method ofSerhiy Storchaka2016-11-291-3/+11
|\ \ \ | |/ / | | | | | | | | | a descriptor that is used inside that class no longer prevents calling the __set_name__ method of other descriptors.
| * | Issue #28797: Modifying the class __dict__ inside the __set_name__ method ofSerhiy Storchaka2016-11-291-3/+11
| | | | | | | | | | | | | | | a descriptor that is used inside that class no longer prevents calling the __set_name__ method of other descriptors.
* | | Merge 3.6Victor Stinner2016-11-241-0/+9
|\ \ \ | |/ /
| * | Fix _PyGen_yf()Victor Stinner2016-11-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Issue #28782: Fix a bug in the implementation ``yield from`` when checking if the next instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). Reviewed by Serhiy Storchaka and Yury Selivanov.
* | | Issue #28774: Simplified encoding a str result of an error handler in ASCIISerhiy Storchaka2016-11-231-26/+12
| | | | | | | | | | | | and Latin1 encoders.
* | | Issue #28774: Fix start/end pos in unicode_encode_ucs1().Xiang Zhang2016-11-231-2/+2
| | | | | | | | | | | | | | | | | | | | | Fix error position of the unicode error in ASCII and Latin1 encoders when a string returned by the error handler contains multiple non-encodable characters (non-ASCII for the ASCII codec, characters out of the U+0000-U+00FF range for Latin1).
* | | Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef,Serhiy Storchaka2016-11-221-1/+1
| | | | | | | | | | | | | | | PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of type "const char *" rather of "char *".
* | | Issue #28731: Optimize _PyDict_NewPresized() to create correct size dictINADA Naoki2016-11-211-5/+19
| | | | | | | | | | | | Improve speed of dict literal with constant keys up to 30%.
* | | Issue #28760: Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().Serhiy Storchaka2016-11-211-10/+4
|\ \ \ | |/ / | | | | | | Patch by Xiang Zhang.
| * | Issue #28760: Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().Serhiy Storchaka2016-11-211-10/+4
| | | | | | | | | | | | Patch by Xiang Zhang.
* | | Issue #28748: Private variable _Py_PackageContext is now of type "const char *"Serhiy Storchaka2016-11-211-1/+1
| | | | | | | | | | | | rather of "char *".
* | | Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-206-72/+67
| | | | | | | | | | | | functions.
* | | Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-207-15/+14
| | | | | | | | | | | | UTF-8 represenatation of Unicode objects.
* | | Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-206-13/+13
|\ \ \ | |/ / | | | | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
| * | Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-206-13/+13
| | | | | | | | | | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* | | Merge 3.6 (issue #28721)Yury Selivanov2016-11-161-3/+11
|\ \ \ | |/ /
| * | Issue #28721: Fix asynchronous generators aclose() and athrow()Yury Selivanov2016-11-161-3/+11
| | |
* | | Issue #28701: _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString nowSerhiy Storchaka2016-11-161-0/+11
|\ \ \ | |/ / | | | | | | require ASCII right argument and assert this condition in debug build.
| * | Issue #28701: _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString nowSerhiy Storchaka2016-11-161-0/+11
| | | | | | | | | | | | require ASCII right argument and assert this condition in debug build.
* | | Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).Serhiy Storchaka2016-11-161-1/+1
|\ \ \ | |/ /
| * | Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).Serhiy Storchaka2016-11-161-1/+1
| |\ \ | | |/