Commit Graph

95285 Commits

Author SHA1 Message Date
Victor Stinner 71cb64acc2 PyErr_PrintEx() now uses fast call
Issue #27128.
2016-08-20 00:57:43 +02:00
Victor Stinner df142fdc4b import_name() now uses fast call
Issue #27128: import_name() now calls _PyObject_FastCall() to avoid the
creation of a temporary tuple.
2016-08-20 00:44:42 +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 75210697ec Issue #27128: _pickle uses fast call
Use _PyObject_FastCall() to avoid the creation of temporary tuple.
2016-08-19 18:59:15 +02:00
Victor Stinner f7a4c488b5 keyobject_richcompare() now uses fast call
Issue #27128: keyobject_richcompare() now calls _PyObject_FastCall() using a
small stack allocated on the C stack to avoid a temporary tuple.
2016-08-19 18:52:35 +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 f2abf5c11a regrtest: replace "Result:" with "Tests result:" 2016-08-19 17:54:25 +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
Berker Peksag 53926f19cd Issue #27801: Skip test_update_lines_cols when update_lines_cols() is not available 2016-08-19 17:59:01 +03: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 3f745bf1d9 PyEval_CallObjectWithKeywords() uses fast call
Issue #27128: Modify PyEval_CallObjectWithKeywords() to use
_PyObject_FastCall() when args==NULL and kw==NULL. It avoids the creation of a
temporary empty tuple for positional arguments.
2016-08-19 16:42:42 +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 fa46aa7899 Issue #27801: Merge from 3.5 2016-08-19 17:59:31 +03:00
Victor Stinner 4bb31e90f0 Fix a clang warning in grammar.c
Clang is smarter than GCC and emits a warning for dead code after a function
declared with __attribute__((__noreturn__)) (Py_FatalError).
2016-08-19 15:11:56 +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 7a01508bbe Issue #12946: Merge from 3.5 2016-08-19 11:52:08 +03:00
Berker Peksag c01e766b54 Issue #12946: Document that PyModule_GetDict can fail in some cases 2016-08-19 11:51:39 +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
R David Murray 2a400fd62a Rewrap long lines in Misc/NEWS.
Also moved news item for #2466 to the correct place.
2016-08-18 21:45:12 -04:00
R David Murray db5380517f Rewrap long lines in Misc/NEWS. 2016-08-18 21:40:48 -04:00
R David Murray c199603853 Merge: #2466: ismount now recognizes mount points user can't access. 2016-08-18 21:31:13 -04:00
R David Murray 750018b91a #2466: ismount now recognizes mount points user can't access.
Patch by Robin Roth, reviewed by Serhiy Storchaka, comment wording
tweaked by me.
2016-08-18 21:27:48 -04:00
Vinay Sajip 696738cf1b Updated NEWS with information on the argparse change. 2016-08-18 21:26:56 +01:00
Vinay Sajip ef948cd058 Closes #12713: Allowed abbreviation of subcommands in argparse. 2016-08-18 21:23:48 +01: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 0a6996d87d Merge 3.5 (fix raise) 2016-08-18 18:14:15 +02:00
Victor Stinner eec9331b20 Fix SystemError in "raise" statement
Issue #27558: Fix a SystemError in the implementation of "raise" statement.
In a brand new thread, raise a RuntimeError since there is no active
exception to reraise.

Patch written by Xiang Zhang.
2016-08-18 18:13:10 +02:00
Serhiy Storchaka 989df09db2 Issue #16764: Move NEWS entry to correct section and remove too strict test. 2016-08-18 09:14:47 +03:00
Alexander Belopolsky e09594d5eb Issue #24773: Include Tallinn 1999-10-31 transition in tests.
Does not appear to be a problem anymore and I cannot figure
out why it was skipped in the first place.
2016-08-17 19:56:17 -04:00
Ned Deily dc35cda2de Issue #27594: Prevent assertion error when running test_ast with coverage
enabled: ensure code object has a valid first line number.
Patch suggested by Ivan Levkivskyi.
2016-08-17 17:18:33 -04: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
Vinay Sajip 82df3b3071 Closes #9998: Allowed find_library to search additional locations for libraries. 2016-08-17 16:20:07 +01:00
Zachary Ware 48e4bd6a02 Merge with 3.5 2016-08-17 09:52:32 -05:00
Zachary Ware 54005afeee Use sys.version_info, not sys.version.
sys.version[0] gives a string, which fails > comparison with 2.
Reported by Arne Maximilian Richter on docs@
2016-08-17 09:51:20 -05:00