Commit Graph

582 Commits

Author SHA1 Message Date
Serhiy Storchaka d7a4415599 Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now
rejects builtin types with not defined __new__.
Added tests for non-pickleable types.
2015-11-12 11:23:04 +02:00
Martin Panter 9955a373a8 Various minor typos in documentation and comments 2015-10-07 10:26:23 +00:00
Benjamin Peterson bd6c41a185 prevent unacceptable bases from becoming bases through multiple inheritance (#24806) 2015-10-06 19:36:54 -07:00
Serhiy Storchaka d741a88049 Fixed indentation of Python examples in C comments. 2015-06-11 00:06:39 +03:00
Serhiy Storchaka d357b89f0b Issue #22079: Deprecation warning now is issued in PyType_Ready() instead of
raising TypeError when statically allocated type subclasses dynamically
allocated type
2015-03-22 09:46:36 +02:00
Antoine Pitrou a654510150 Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects. 2015-03-10 22:32:00 +01:00
Steve Dower b4e20bb588 Fix definition mismatch for type_is_subtype_base_chain. 2015-02-06 08:50:23 -08:00
Benjamin Peterson 104b9e0cca fix many custom mro() edge cases and improve code quality (#22735)
Patch by Eldar Abusalimov.
2015-02-05 22:29:14 -05:00
Serhiy Storchaka e09bcc874a Issue #22079: PyType_Ready() now checks that statically allocated type has
no dynamically allocated bases.
2015-01-28 11:03:33 +02:00
Serhiy Storchaka f4b7a02e93 Issue #21408: The default __ne__() now returns NotImplemented if __eq__()
returned NotImplemented.  Removed incorrect implementations of __ne__().
2015-01-26 09:57:07 +02:00
Benjamin Peterson e823933f9f remove tautological condition (closes #22954) 2014-11-26 23:03:11 -06:00
Georg Brandl e1d26f377e Closes #22772: fix __ifloordiv__ and __itruediv__ docstring. 2014-10-31 13:12:57 +01:00
Victor Stinner 1c6970fac9 Issue #21418: Fix a crash in the builtin function super() when called without
argument and without current frame (ex: embedded Python).
2014-05-13 01:32:36 +02:00
Zachary Ware 715ef02ddc Fix a typo in the docstring of nb_index. 2014-04-18 09:23:14 -05:00
Zachary Ware ea42b4cc80 Fix a typo in the signature for object.__ge__ 2014-04-18 09:14:31 -05:00
Benjamin Peterson df813791db correct the fix for #20637; allow slot descriptor inheritance to take place before creating cached keys 2014-03-17 15:57:17 -05:00
Yury Selivanov 056e265491 Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__ 2014-03-02 12:25:27 -05:00
Antoine Pitrou f0b5a7c0f6 Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson. 2014-02-23 16:50:07 +01:00
Benjamin Peterson e686c5c3e8 look up __getnewargs__ and __getnewargs_ex__ on the object type (#16251) 2014-02-16 13:49:16 -05:00
Larry Hastings 69a2547cd5 Issue #20530: The signatures for slot builtins have been updated
to reflect the fact that they only accept positional-only arguments.
2014-02-09 22:22:38 -08:00
Larry Hastings 2623c8c23c Issue #20530: Argument Clinic's signature format has been revised again.
The new syntax is highly human readable while still preventing false
positives.  The syntax also extends Python syntax to denote "self" and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.
2014-02-08 22:15:29 -08:00
Victor Stinner 1ea4e4174b Issue #17162: Fix compilation, replace non-breaking space with an ASCII space 2014-02-04 09:49:14 +01:00
Martin v. Löwis ca7b04644c Issue #17162: Add PyType_GetSlot. 2014-02-04 09:33:05 +01:00
Larry Hastings 581ee3618c Issue #20326: Argument Clinic now uses a simple, unique signature to
annotate text signatures in docstrings, resulting in fewer false
positives.  "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.

Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00
Larry Hastings 5c66189e88 Issue #20189: Four additional builtin types (PyTypeObject,
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08:00
Christian Heimes d3afe781b1 Silence expression result unused warnings with clang.
The PyObject_INIT() macros returns obj:

../cpython/Objects/methodobject.c:32:23: warning: expression result unused [-Wunused-value]
        PyObject_INIT(op, &PyCFunction_Type);
                      ^~
../cpython/Include/objimpl.h:139:69: note: expanded from macro 'PyObject_INIT'
    ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
                                                                    ^
1 warning generated.
2013-12-04 09:27:47 +01:00
Alexandre Vassalotti cc6e87b2cf Issue #19088: Merge with 3.3. 2013-11-30 01:05:51 -08:00
Alexandre Vassalotti 1a83070d9e Issue #19088: Fix incorrect caching of the copyreg module.
This fix does not cause any degradation in performance.
2013-11-30 00:53:09 -08:00
Christian Heimes 2489bd83f5 Issue #17810: Fixed NULL check in _PyObject_GetItemsIter()
CID 1131948:  Logically dead code  (DEADCODE)
2013-11-23 21:19:43 +01:00
Antoine Pitrou c9dc4a2a8a Issue #17810: Implement PEP 3154, pickle protocol 4.
Most of the work is by Alexandre.
2013-11-23 18:59:12 +01:00
Victor Stinner 3f36a5736b Issue #19515: Remove identifiers duplicated in the same file.
Patch written by Andrei Dorian Duma.
2013-11-12 21:39:02 +01:00
Victor Stinner bd303c165b Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Martin v. Löwis e75fc14813 Issue #19514: Deduplicate some _Py_IDENTIFIER declarations.
Patch by Andrei Dorian Duma.
2013-11-07 18:46:53 +01:00
Victor Stinner ad14ccd047 Issue #19512: add _PyUnicode_CompareWithId() function
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.

Add also _PyId_builtins identifier for "builtins" common string.
2013-11-07 00:46:04 +01:00
Victor Stinner 3688aa9a04 Issue #19512: type_abstractmethods() and type_set_abstractmethods() now use an
identifier for the "__abstractmethods__" string
2013-11-06 18:59:18 +01:00
Antoine Pitrou 84745ab464 Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses of a given type. 2013-10-29 21:31:25 +01:00
Victor Stinner bebba5059c fix indent 2013-10-29 10:56:34 +01:00
Raymond Hettinger c13516b0a0 merge 2013-10-01 01:00:59 -07:00
Raymond Hettinger 2ff2190b62 Issue #18594: Fix the fast path for collections.Counter().
The path wasn't being taken due to an over-restrictive type check.
2013-10-01 00:55:43 -07:00
Victor Stinner 33824f6fd7 Restore changeset 5bd9db528aed (issue #18408)
"Issue #18408: PyObject_Str(), PyObject_Repr() and type_call() now fail with an
assertion error if they are called with an exception set (PyErr_Occurred()).

As PyEval_EvalFrameEx(), they may clear the current exception and so the caller
looses its exception."
2013-08-26 14:05:19 +02:00
Antoine Pitrou 91541931f5 Back out 5bd9db528aed (issue #18408). It caused unsolved buildbot failures. 2013-08-23 23:18:20 +02:00
Antoine Pitrou 796564c27b Issue #18112: PEP 442 implementation (safe object finalization). 2013-07-30 19:59:21 +02:00
Christian Heimes de4d183955 Issue #18327: Fix argument order in call to compatible_for_assignment(oldto, newto, attr).
The fix only affects the error message of __class__ assignment. CID 983564
2013-07-20 14:19:46 +02:00
Victor Stinner 8e47832737 Issue #18408: PyObject_Str(), PyObject_Repr() and type_call() now fail with an
assertion error if they are called with an exception set (PyErr_Occurred()).

As PyEval_EvalFrameEx(), they may clear the current exception and so the caller
looses its exception.
2013-07-18 01:49:30 +02:00
Victor Stinner 5967bf4928 Issue #18408: Fix PyType_Ready(), handle _PyDict_SetItemId() failure 2013-07-17 22:01:37 +02:00
Victor Stinner 3997cfdb7f Cleanup type_call() to ease debug
It was easy to miss the call to type->tp_init because it was done in a long
conditional expression. Split the long expression in multiple lines to make the
debug step by step easier.
2013-07-16 22:51:21 +02:00
Victor Stinner 53510cda59 Issue #18408: type_new() and PyType_FromSpecWithBases() now raise MemoryError
on memory allocation failure
2013-07-15 19:34:20 +02:00
Victor Stinner a41f085144 Issue #18408: pmerge() help of mro_implementation() now raises MemoryError on
memory allocation failure

Replace also PyMem_Free() with PyMem_FREE() to be consistent with the rest of
the function.
2013-07-12 00:42:14 +02:00
Victor Stinner 2e8474ddde Issue #18408: slot_tp_str() must not fallback on slot_tp_repr() on error
type->tp_str must not point to slot_tp_str() if type has no __str__ attribute,
so there is no reason for slot_tp_str() to fallback on slot_tp_str() on lookup
error. Moreover, calling PyErr_Clear() may hide a real bug like MemoryError.

If __str__ attribute is removed, slots must be updated (which is done by
type_setattro()).
2013-07-11 22:46:11 +02:00
Victor Stinner 54e4ca76c9 typeobject.c: remove trailing spaces 2013-07-11 22:42:25 +02:00