INADA Naoki
d1c82c5cc7
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
2018-04-03 11:43:53 +09:00
bennorth
d7773d92bd
bpo-18533: Avoid RecursionError from repr() of recursive dictview ( #4823 )
...
dictview_repr(): Use a Py_ReprEnter() / Py_ReprLeave() pair to check
for recursion, and produce "..." if so.
test_recursive_repr(): Check for the string rather than a
RecursionError. (Test cannot be any tighter as contents are
implementation-dependent.)
test_deeply_nested_repr(): Add new test, replacing the original
test_recursive_repr(). It checks that a RecursionError is raised in
the case of a non-recursive but deeply nested structure. (Very
similar to what test_repr_deep() in test/test_dict.py does for a
normal dict.)
OrderedDictTests: Add new test case, to test behavior on OrderedDict
instances containing their own values() or items().
2018-01-26 07:46:01 -08:00
Serhiy Storchaka
f320be77ff
bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code (GH-5222)
...
Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
2018-01-25 17:49:40 +09:00
Yury Selivanov
b0a7a037b8
bpo-31179: Make dict.copy() up to 5.5 times faster. ( #3067 )
2018-01-22 11:54:41 -05:00
Serhiy Storchaka
60c3d3551a
bpo-31572: Get rid of _PyObject_HasAttrId() in dict and OrderedDict. ( #3728 )
...
Silence only AttributeError when get "key" and "items" attributes in
the constructor and the update() method of dict and OrderedDict .
2017-11-11 16:19:56 +02:00
luzpaz
a5293b4ff2
Fix miscellaneous typos ( #4275 )
2017-11-05 15:37:50 +02:00
Barry Warsaw
b2e5794870
bpo-31338 ( #3374 )
...
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
2017-09-14 18:13:16 -07:00
Eric Snow
2ebc5ce42a
bpo-30860: Consolidate stateful runtime globals. ( #3397 )
...
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-07 23:51:28 -06:00
INADA Naoki
a6296d34a4
bpo-31095: fix potential crash during GC (GH-2974)
2017-08-24 14:55:17 +09:00
INADA Naoki
778928b0c7
bpo-29304: Simplify dict lookup functions (GH-2407)
...
* remove hashpos parameter from lookdict functions.
* remove many duplicated code from lookdict functions.
2017-08-03 23:45:15 +09:00
Serhiy Storchaka
6969eaf468
bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make ( #1955 )
...
the bare METH_FASTCALL be used for functions with positional-only
parameters.
2017-07-03 21:20:15 +03:00
INADA Naoki
870c286e27
bp-29304: Simplify dictobject.c (GH-2347)
...
replace `(i << 2) + 1` with `i*5`
2017-06-24 09:03:19 +09:00
INADA Naoki
073ae487b3
bpo-29304: simplify lookdict_index() function. (GH-2273)
2017-06-23 15:22:50 +09:00
Serhiy Storchaka
753bca3934
bpo-27945: Fixed various segfaults with dict. ( #1657 )
...
Based on patches by Duane Griffin and Tim Mitchell.
2017-05-20 12:30:02 +03:00
T. Wouters
a00c3fd12d
bpo-29941: Assert fixes ( #886 )
...
Make a non-Py_DEBUG, asserts-enabled build of CPython possible. This means
making sure helper functions are defined when NDEBUG is not defined, not
just when Py_DEBUG is defined.
Also fix a division-by-zero in obmalloc.c that went unnoticed because in Py_DEBUG mode, elsize is never zero.
2017-03-31 09:14:41 -07:00
Serhiy Storchaka
c61ac1642d
Don't use Py_SIZE for dict object. ( #747 )
2017-03-21 08:52:38 +02:00
INADA Naoki
1b8df107f8
bpo-24274: fix erroneous comment in dictobject.c (GH-196)
...
lookdict_unicode() and lookdict_unicode_nodummy() may raise exception
when key is not unicode.
2017-02-20 22:48:10 +09:00
INADA Naoki
2294f3aee1
bpo-29438: fixed use-after-free in key sharing dict ( #17 )
2017-02-12 13:51:30 +09:00
Serhiy Storchaka
19d2597ed5
Issue #29311 : Regenerate Argument Clinic.
2017-02-04 08:05:07 +02:00
Serhiy Storchaka
78d9e58f20
Issues #29311 , #29289 : Fixed and improved docstrings for dict and OrderedDict
...
methods.
2017-01-25 00:30:04 +02:00
Serhiy Storchaka
48088ee9ba
Issue #29311 : Argument Clinic generates reasonable name for the parameter "default".
2017-01-19 19:00:30 +02:00
Victor Stinner
91f0d4aa2f
Add a note explaining why dict_update() doesn't use METH_FASTCALL
...
Issue #29312 .
2017-01-19 12:45:06 +01:00
Victor Stinner
7dc6a5f50a
dict.get() and dict.setdefault() now use AC
...
Issue #29311 : dict.get() and dict.setdefault() methods now use Argument Clinic
to parse arguments. Their calling convention changes from METH_VARARGS to
METH_FASTCALL which avoids the creation of a temporary tuple.
The signature of docstrings is also enhanced. For example,
get(...)
becomes:
get(self, key, default=None, /)
2017-01-19 12:37:13 +01:00
Serhiy Storchaka
617c7753ce
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:42:20 +02:00
Serhiy Storchaka
42e1ea9a10
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:12:21 +02:00
Serhiy Storchaka
67796521dd
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 18:34:33 +02:00
Antoine Pitrou
c06ae208eb
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:34:54 +01:00
Antoine Pitrou
d741ed492f
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:23:43 +01:00
Antoine Pitrou
e10ca3a0fe
Issue #28427 : old keys should not remove new values from
...
WeakValueDictionary when collecting from another thread.
2016-12-27 14:19:20 +01:00
INADA Naoki
6165d55f13
Issue #28147 : Fix a memory leak in split-table dictionaries
...
setattr() must not convert combined table into split table.
2016-12-20 09:54:24 +09:00
Victor Stinner
5cc70c9935
Merge 3.6
2016-12-15 17:23:24 +01:00
Victor Stinner
3d3f264849
Fix a memory leak in split-table dictionaries
...
Issue #28147 : Fix a memory leak in split-table dictionaries: setattr() must not
convert combined table into split table.
Patch written by INADA Naoki.
2016-12-15 17:21:23 +01:00
INADA Naoki
ba6097734d
Issue #28818 : Simplify lookdict functions
2016-12-07 20:41:42 +09:00
Victor Stinner
a5ed5f000a
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallObject(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* 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 .
2016-12-01 14:43:22 +01:00
INADA Naoki
2c5a830f2a
Issue #28731 : Optimize _PyDict_NewPresized() to create correct size dict.
...
Improve speed of dict literal with constant keys up to 30%.
2016-12-07 18:34:44 +09:00
INADA Naoki
92c50eee52
Issue #28731 : Optimize _PyDict_NewPresized() to create correct size dict
...
Improve speed of dict literal with constant keys up to 30%.
2016-11-22 00:57:02 +09:00
Victor Stinner
c7a8f67411
Issue #28618 : Mark dict lookup functions as hot
...
It's common to see these functions in the top 3 of "perf report".
2016-11-15 15:13:40 +01:00
Victor Stinner
0cae609847
Use PyThreadState_GET() in performance critical code
...
It seems like _PyThreadState_UncheckedGet() is not inlined as expected, even
when using gcc -O3.
2016-11-11 01:43:56 +01:00
Serhiy Storchaka
f0b311bd73
Issue #28123 : _PyDict_GetItem_KnownHash() now can raise an exception as
...
PyDict_GetItemWithError(). Patch by Xiang Zhang.
2016-11-06 13:18:24 +02:00
INADA Naoki
93f26f794d
Issue #28583 : PyDict_SetDefault didn't combine split table when needed.
...
Patch by Xiang Zhang.
2016-11-02 18:45:16 +09:00
Serhiy Storchaka
7f0514ad54
Backed out changeset 6b88dfc7b25d
2016-10-31 20:14:05 +02:00
Serhiy Storchaka
e26e20db95
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:50:00 +03:00
Serhiy Storchaka
04230c4087
Issue #28123 : _PyDict_GetItem_KnownHash() now can raise an exception as
...
PyDict_GetItemWithError(). Patch by Xiang Zhang.
2016-11-06 13:19:38 +02:00
INADA Naoki
ca2d8be4ba
Issue #28580 : Optimize iterating split table values.
...
Patch by Xiang Zhang.
2016-11-04 16:59:10 +09:00
INADA Naoki
a3498c7569
Issue #28583 : PyDict_SetDefault didn't combine split table when needed.
...
Patch by Xiang Zhang.
2016-11-02 18:47:24 +09:00
Serhiy Storchaka
5e325d9c41
Merge from 3.6.
2016-10-31 20:15:48 +02:00
Serhiy Storchaka
041794908b
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:50:00 +03:00
Serhiy Storchaka
d76d8bfee1
Issue #28199 : Microoptimized dict resizing. Based on patch by Naoki Inada.
2016-10-29 10:49:43 +03:00
Yury Selivanov
f0bbee6228
Merge 3.6 (issue #28544 )
2016-10-28 19:01:46 -04:00
Yury Selivanov
684ef2c888
Issue #28544 : Pass `PyObject*` to _PyDict_Pop, not `PyDictObject*`
2016-10-28 19:01:21 -04:00
INADA Naoki
b574e77122
Issue #28509 : dict.update() no longer allocate unnecessary large memory
2016-10-27 19:30:10 +09:00
INADA Naoki
b1152be2de
Issue #28509 : dict.update() no longer allocate unnecessary large memory
2016-10-27 19:26:50 +09:00
Raymond Hettinger
b12785d456
Reference the original compact-and-ordered proposal
2016-10-22 09:58:14 -07:00
doko@ubuntu.com
de69ee71e2
- dictobject.c: Make dict_merge symbol a static symbol
2016-10-11 08:04:02 +02:00
doko@ubuntu.com
c96df68ea3
- dictobject.c: Make dict_merge symbol a static symbol
2016-10-11 08:04:02 +02:00
Serhiy Storchaka
49f5cdde1a
Issue #28183 : Optimize and cleanup dict iteration.
2016-10-09 23:08:05 +03:00
INADA Naoki
267941c675
Issue #28201 : Dict reduces possibility of 2nd conflict in hash table.
...
Do perturb shift after first conflict.
2016-10-06 15:19:07 +09:00
Serhiy Storchaka
e036ef8fa2
Issue #27358 : Optimized merging var-keyword arguments and improved error
...
message when pass a non-mapping as a var-keyword argument.
2016-10-02 11:06:43 +03:00
Serhiy Storchaka
97932e4c4f
issue #28144 : Decrease empty_keys_struct's dk_refcnt
...
since there is no dummy_struct any more.
Patch by Xiang Zhang.
2016-09-26 23:01:23 +03:00
Serhiy Storchaka
46825d2399
Issue #28194 : Clean up some checks in dict implementation.
...
Patch by Xiang Zhang.
2016-09-26 21:29:34 +03: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
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
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
3c336c5915
Issue #28077 : find_empty_slot() only supports combined dict
2016-09-12 14:17:40 +02: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
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
Berker Peksag
71c01d43a7
Issue #28033 : Fix typo in dictobject.c
...
Patch by Wesley Emeneker.
2016-09-09 03:57:23 +03: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
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
Victor Stinner
dee6e252cc
Split lookdict_unicode_nodummy() assertion to debug
...
Issue #27350 .
2016-09-08 11:16:07 -07:00
Victor Stinner
71211e3386
Add assertions to dk_set_index()
...
Issue #27350 .
2016-09-08 10:52:46 -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
55f445282d
remove memory indirections in dict_traverse ( closes #27956 )
2016-09-05 12:12:59 -07: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
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
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
Raymond Hettinger
ce5179fcba
Issue #23601 : Use small object allocator for dict key objects
2016-01-31 08:56:21 -08: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
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
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
3987e26e75
Issue #25914 : Fixed and simplified OrderedDict.__sizeof__.
2015-12-22 08:22:05 +02:00
Serhiy Storchaka
0ce7a3a34c
Issue #25914 : Fixed and simplified OrderedDict.__sizeof__.
2015-12-22 08:16:18 +02:00
Serhiy Storchaka
a9406e77fa
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
...
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:07:11 +02:00
Serhiy Storchaka
5c4064e8bd
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
...
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Victor Stinner
b4efc963d6
Issue #25557 : Refactor _PyDict_LoadGlobal()
...
Don't fallback to PyDict_GetItemWithError() if the hash is unknown: compute the
hash instead. Add also comments to explain the optimization a little bit.
2015-11-20 09:24:02 +01:00
Serhiy Storchaka
b9d98d532c
Issue #24483 : C implementation of functools.lru_cache() now calculates key's
...
hash only once.
2015-10-02 12:47:11 +03:00
Benjamin Peterson
e54d5321cc
merge 3.4 ( #24407 )
2015-07-04 19:59:24 -05:00
Benjamin Peterson
2a48a6eb33
merge 3.3 ( #24407 )
2015-07-04 19:58:11 -05:00
Benjamin Peterson
a82f77fb00
protect against mutation of the dict during insertion ( closes #24407 )
2015-07-04 19:55:16 -05:00
Eric Snow
96c6af9b20
Issue #16991 : Add a C implementation of collections.OrderedDict.
2015-05-29 22:21:39 -06:00
Benjamin Peterson
025e9ebd0a
PEP 448: additional unpacking generalizations ( closes #2292 )
...
Patch by Neil Girdhar.
2015-05-05 20:16:41 -04:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Antoine Pitrou
bc92bbd4d2
Issue #22653 : Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode.
2014-10-18 00:35:44 +02:00
Antoine Pitrou
d696732025
Issue #22653 : Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode.
2014-10-18 00:35:00 +02:00
Raymond Hettinger
4b74fba62f
Issue 21101: Internal API for dict getitem and setitem where the hash value is known.
2014-05-03 16:32:11 -07: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
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
c20472640c
Issue #20390 : Small fixes and improvements for Argument Clinic.
2014-01-25 20:43:29 -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
Meador Inge
e02de8c2ad
Fix minor bug in dict.__contains__ docstring.
...
When dict got clinicized in 8fde1a2c94dc for Issue #16612 an erroneous
trailing quote was left in the clinic docstring summary line.
2014-01-14 16:48:31 -06:00
Larry Hastings
61272b77b0
Issue #19273 : The marker comments Argument Clinic uses have been changed
...
to improve readability.
2014-01-07 12:41:53 -08:00
Larry Hastings
44e2eaab54
Issue #19674 : inspect.signature() now produces a correct signature
...
for some builtins.
2013-11-23 15:37:55 -08:00
Victor Stinner
f91929b1d8
Issue #19646 : repr(dict) now uses _PyUnicodeWriter API for better performances
2013-11-19 13:07:38 +01:00
Larry Hastings
ed4a1c5703
Argument Clinic: rename "self" to "module" for module-level functions.
2013-11-18 09:32:13 -08:00
Victor Stinner
5fd2e5ae8a
Issue #19512 : Add a new _PyDict_DelItemId() function, similar to
...
PyDict_DelItemString() but using an identifier for the key
2013-11-06 18:58:22 +01:00
Larry Hastings
3182680210
Issue #16612 : Add "Argument Clinic", a compile-time preprocessor
...
for C files to generate argument parsing code. (See PEP 436.)
2013-10-19 00:09:25 -07:00
Raymond Hettinger
69492dab07
Factor-out the common code for setting a KeyError.
2013-09-02 15:59:26 -07:00
Antoine Pitrou
9ed5f27266
Issue #18722 : Remove uses of the "register" keyword in C code.
2013-08-13 20:18:52 +02:00
Victor Stinner
5b3b1006bb
Issue #18520 : Fix _PyDict_GetItemId(), suppress _PyUnicode_FromId() error
...
As PyDict_GetItem(), _PyDict_GetItemId() suppresses all errors that may occur,
for historical reasons.
2013-07-22 23:50:57 +02:00
Victor Stinner
f97dfd7b59
Issue #18408 : Fix dict_repr(), don't call PyObject_Repr() with an exception set
...
PyObject_Repr() can removes the current exception. For example, module_repr()
calls PyErr_Clear() if calling loader.module_repr(mod) failed.
2013-07-18 01:00:45 +02:00
Victor Stinner
ac2a4fe8a2
Issue #18408 : dict_new() now fails on new_keys_object() error
...
Pass the MemoryError exception to the caller, instead of using empty keys.
2013-07-16 22:19:00 +02:00
Victor Stinner
a9f61a5a23
Cleanup dictobject.c
2013-07-16 22:17:26 +02:00
Victor Stinner
fdcbab9602
Issue #18408 : Fix PyDict_GetItemString(), suppress PyUnicode_FromString() error
...
As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may
occur for historical reasons.
2013-07-16 22:16:05 +02:00
Victor Stinner
c9b7f51ec2
Issue #18408 : Fix PyDict_New() to handle correctly new_keys_object() failure
...
(MemoryError).
2013-07-08 22:19:20 +02:00
Raymond Hettinger
36f74aa7f7
Issue #17563 : Fix dict resize performance regression.
2013-05-17 03:01:13 -07:00
Raymond Hettinger
2f6fe51860
merge
2013-05-17 03:24:54 -07:00
Brett Cannon
f27541653b
Touch up grammar for dict.update() docstring.
2013-05-11 14:46:48 -04:00
Benjamin Peterson
5589850c14
fix warning ( closes #17327 )
2013-03-08 08:36:49 -05:00
Benjamin Peterson
00e9886bd9
Add PyDict_SetDefault. ( closes #17327 )
...
Patch by Stefan Behnel and I.
2013-03-07 22:16:29 -05:00
Benjamin Peterson
42f382facd
merge 3.3 ( #17328 )
2013-03-04 09:48:30 -05:00
Benjamin Peterson
b1efa53662
fix possible setdefault refleak ( closes #17328 )
2013-03-04 09:47:50 -05:00
Antoine Pitrou
0e9958b543
Issue #16562 : Optimize dict equality testing.
...
Patch by Serhiy Storchaka (reviewed by Martin and Raymond).
2012-12-02 19:10:07 +01:00
Benjamin Peterson
591c921411
merge 3.2
2012-10-31 14:22:25 -04:00
Benjamin Peterson
9892f52145
avoid a function call with redundant checks for dict size
2012-10-31 14:22:12 -04:00
Benjamin Peterson
d97eb0d338
merge 3.2 ( #16345 )
2012-10-31 14:09:11 -04:00
Benjamin Peterson
d1f2cb37a2
only fast-path fromkeys() when the constructor returns a empty dict ( closes #16345 )
2012-10-31 14:05:55 -04:00
Antoine Pitrou
a504a7a7d1
Issue #15055 : update dictnotes.txt. Patch by Mark Shannon.
2012-06-24 21:03:45 +02:00
David Malcolm
49526f48fc
Issue #14785 : Add sys._debugmallocstats() to help debug low-level memory allocation issues
2012-06-22 14:55:41 -04:00
Antoine Pitrou
9a2349030a
Issue #14417 : Mutating a dict during lookup now restarts the lookup instead of raising a RuntimeError (undoes issue #14205 ).
2012-05-13 20:48:01 +02:00
Antoine Pitrou
2d169b268b
Make the reference counting of dictkeys objects participate in refleak hunting
...
(issue #13903 ).
2012-05-12 23:43:44 +02:00
Benjamin Peterson
a6f195e48e
change insertdict to not steal references ( #13903 )
2012-04-30 10:23:40 -04:00
Benjamin Peterson
15ee821eb5
distiguish between refusing to creating shared keys and error ( #13903 )
2012-04-24 14:44:18 -04:00
Martin v. Loewis
4f2f3b6217
Account for shared keys in type's __sizeof__ ( #13903 ).
2012-04-24 19:13:57 +02:00
Benjamin Peterson
7ce67e45f8
fix dict gc tracking ( #13903 )
2012-04-24 10:32:57 -04:00
Benjamin Peterson
db780d0d13
fix instance dicts with str subclasses ( #13903 )
2012-04-23 13:44:32 -04:00
Benjamin Peterson
53b977127f
don't make shared keys with dict subclasses
2012-04-23 11:50:47 -04:00
Benjamin Peterson
7d95e40721
Implement PEP 412: Key-sharing dictionaries ( closes #13903 )
...
Patch from Mark Shannon.
2012-04-23 11:24:50 -04:00
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
...
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Antoine Pitrou
a701388de1
Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI.
2012-04-05 00:04:20 +02:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Victor Stinner
3c1e48176e
Issue #14383 : Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
...
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
2012-03-26 22:10:51 +02:00
Victor Stinner
198b291df7
Close #14205 : dict lookup raises a RuntimeError if the dict is modified during
...
a lookup.
"if you want to make a sandbox on top of CPython, you have to fix segfaults"
so let's fix segfaults!
2012-03-06 01:03:13 +01:00
Antoine Pitrou
70d2717f2e
Issue #13521 : dict.setdefault() now does only one lookup for the given key, making it "atomic" for many purposes.
...
Patch by Filip Gruszczyński.
2012-02-27 00:59:34 +01:00
Antoine Pitrou
e965d97ed1
Issue #13521 : dict.setdefault() now does only one lookup for the given key, making it "atomic" for many purposes.
...
Patch by Filip Gruszczyński.
2012-02-27 00:45:12 +01:00
Benjamin Peterson
ce79852077
use the static identifier api for looking up special methods
...
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
2012-01-22 11:24:29 -05:00
Georg Brandl
ac0675cc01
Small clarification in docstring of dict.update(): the positional argument is not required.
2011-12-18 19:30:55 +01:00
Georg Brandl
f928b5d27e
Merge with 3.2.
2011-12-18 19:32:37 +01:00
Antoine Pitrou
9a812cbc89
Issue #13389 : Full garbage collection passes now clear the freelists for
...
list and dict objects. They already cleared other freelists in the
interpreter.
2011-11-15 00:00:12 +01:00
Petri Lehtinen
24bd5adcff
Merge 3.2
2011-10-24 21:17:52 +03:00
Petri Lehtinen
a94200e6ce
Issue #13018 : Fix reference leaks in error paths in dictobject.c.
...
Patch by Suman Saha.
2011-10-24 21:12:58 +03:00
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Victor Stinner
d1a9cc29b9
dictviews_or() uses _Py_identifier
2011-10-13 22:51:17 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Mark Dickinson
57e683e53e
Issue #1621 : Fix undefined behaviour in bytes.__hash__, str.__hash__, tuple.__hash__, frozenset.__hash__ and set indexing operations.
2011-09-24 18:18:40 +01:00
Brian Curtin
dfc80e3d97
Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
...
The macro was introduced in #12724 .
2011-08-10 20:28:54 -05:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Benjamin Peterson
f609654b0e
handle dict subclasses gracefully in PyArg_ValidateKeywordArguments
2010-11-17 22:33:12 +00:00
Raymond Hettinger
7529afce3c
Issue 10221: Improve error message for dict.pop().
2010-10-30 08:14:53 +00:00
Raymond Hettinger
dd4215483f
Issue 10221: Improve error message for dict.pop().
2010-10-30 08:10:29 +00:00
Antoine Pitrou
fbb1c6191c
Follow up to #9778 : fix regressions on 64-bit Windows builds
2010-10-23 17:37:54 +00:00
Georg Brandl
00da4e0b5a
Remove unneeded casts to hashfunc.
2010-10-18 07:32:48 +00:00
Benjamin Peterson
e6baa46aab
fix prototype
2010-10-17 21:20:58 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Daniel Stutzbach
045b3ba184
Issue #9212 : Added the missing isdisjoint method to the dict_keys and
...
dict_items views. The method is required by the collections.Set ABC,
which the views register as supporting.
2010-09-02 15:06:06 +00:00
Antoine Pitrou
7f14f0d8a0
Recorded merge of revisions 81032 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Jeffrey Yasskin
39370830a9
Make (most of) Python's tests pass under Thread Sanitizer.
...
http://code.google.com/p/data-race-test/wiki/ThreadSanitizer is a dynamic data
race detector that runs on top of valgrind. With this patch, the binaries at
http://code.google.com/p/data-race-test/wiki/ThreadSanitizer#Binaries pass many
but not all of the Python tests. All of regrtest still passes outside of tsan.
I've implemented part of the C1x atomic types so that we can explicitly mark
variables that are used across threads, and get defined behavior as compilers
advance.
I've added tsan's client header and implementation to the codebase in
dynamic_annotations.{h,c} (docs at
http://code.google.com/p/data-race-test/wiki/DynamicAnnotations ).
Unfortunately, I haven't been able to get helgrind and drd to give sensible
error messages, even when I use their client annotations, so I'm not supporting
them.
2010-05-03 19:29:34 +00:00
Benjamin Peterson
fb88636199
prevent the dict constructor from accepting non-string keyword args #8419
...
This adds PyArg_ValidateKeywordArguments, which checks that keyword arguments
are all strings, using an optimized method if possible.
2010-04-24 18:21:17 +00:00
Ezio Melotti
807e98e0af
Merged revisions 78541 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r78541 | ezio.melotti | 2010-03-01 06:08:34 +0200 (Mon, 01 Mar 2010) | 17 lines
Merged revisions 78515-78516,78522 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78515 | georg.brandl | 2010-02-28 20:19:17 +0200 (Sun, 28 Feb 2010) | 1 line
#8030 : make builtin type docstrings more consistent: use "iterable" instead of "seq(uence)", use "new" to show that set() always returns a new object.
........
r78516 | georg.brandl | 2010-02-28 20:26:37 +0200 (Sun, 28 Feb 2010) | 1 line
The set types can also be called without arguments.
........
r78522 | ezio.melotti | 2010-03-01 01:59:00 +0200 (Mon, 01 Mar 2010) | 1 line
#8030 : more docstring fix for builtin types.
........
................
2010-03-01 04:10:55 +00:00
Ezio Melotti
7f807b79d8
Merged revisions 78515-78516,78522 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78515 | georg.brandl | 2010-02-28 20:19:17 +0200 (Sun, 28 Feb 2010) | 1 line
#8030 : make builtin type docstrings more consistent: use "iterable" instead of "seq(uence)", use "new" to show that set() always returns a new object.
........
r78516 | georg.brandl | 2010-02-28 20:26:37 +0200 (Sun, 28 Feb 2010) | 1 line
The set types can also be called without arguments.
........
r78522 | ezio.melotti | 2010-03-01 01:59:00 +0200 (Mon, 01 Mar 2010) | 1 line
#8030 : more docstring fix for builtin types.
........
2010-03-01 04:08:34 +00:00
Georg Brandl
01a30523f9
Merged revisions 74264 via svnmerge from
...
svn+ssh://svn.python.org/python/branches/py3k
................
r74264 | alexandre.vassalotti | 2009-07-29 22:12:15 +0200 (Mi, 29 Jul 2009) | 32 lines
Merged revisions 74075,74187,74197,74201,74216,74225 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74075 | georg.brandl | 2009-07-18 05:06:31 -0400 (Sat, 18 Jul 2009) | 1 line
#6505 : fix typos.
........
r74187 | benjamin.peterson | 2009-07-23 10:19:08 -0400 (Thu, 23 Jul 2009) | 1 line
use bools for autoraise
........
r74197 | benjamin.peterson | 2009-07-24 22:03:48 -0400 (Fri, 24 Jul 2009) | 1 line
clarify
........
r74201 | amaury.forgeotdarc | 2009-07-25 12:22:06 -0400 (Sat, 25 Jul 2009) | 2 lines
Better name a variable: 'buf' seems to imply a mutable buffer.
........
r74216 | michael.foord | 2009-07-26 17:12:14 -0400 (Sun, 26 Jul 2009) | 1 line
Issue 6581. Michael Foord
........
r74225 | kurt.kaiser | 2009-07-27 12:09:28 -0400 (Mon, 27 Jul 2009) | 5 lines
1. Clean workspace more thoughly before build.
2. Add url of branch we are building to 'results' webpage.
(url is now available in $repo_path, could be added to failure email.)
3. Adjust permissions to improve upload reliability.
........
................
2009-08-13 08:37:59 +00:00
Alexandre Vassalotti
e223eb8477
Merged revisions 74075,74187,74197,74201,74216,74225 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74075 | georg.brandl | 2009-07-18 05:06:31 -0400 (Sat, 18 Jul 2009) | 1 line
#6505 : fix typos.
........
r74187 | benjamin.peterson | 2009-07-23 10:19:08 -0400 (Thu, 23 Jul 2009) | 1 line
use bools for autoraise
........
r74197 | benjamin.peterson | 2009-07-24 22:03:48 -0400 (Fri, 24 Jul 2009) | 1 line
clarify
........
r74201 | amaury.forgeotdarc | 2009-07-25 12:22:06 -0400 (Sat, 25 Jul 2009) | 2 lines
Better name a variable: 'buf' seems to imply a mutable buffer.
........
r74216 | michael.foord | 2009-07-26 17:12:14 -0400 (Sun, 26 Jul 2009) | 1 line
Issue 6581. Michael Foord
........
r74225 | kurt.kaiser | 2009-07-27 12:09:28 -0400 (Mon, 27 Jul 2009) | 5 lines
1. Clean workspace more thoughly before build.
2. Add url of branch we are building to 'results' webpage.
(url is now available in $repo_path, could be added to failure email.)
3. Adjust permissions to improve upload reliability.
........
2009-07-29 20:12:15 +00:00
Benjamin Peterson
e5caf1034b
Merged revisions 74140 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r74140 | benjamin.peterson | 2009-07-21 09:11:27 -0500 (Tue, 21 Jul 2009) | 9 lines
Merged revisions 74139 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74139 | benjamin.peterson | 2009-07-21 09:08:40 -0500 (Tue, 21 Jul 2009) | 1 line
must use _PyThreadState_Current so it isn't checked for NULL #6530
........
................
2009-07-21 14:16:13 +00:00
Benjamin Peterson
9d7c3cd6d7
Merged revisions 74139 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74139 | benjamin.peterson | 2009-07-21 09:08:40 -0500 (Tue, 21 Jul 2009) | 1 line
must use _PyThreadState_Current so it isn't checked for NULL #6530
........
2009-07-21 14:11:27 +00:00
Benjamin Peterson
87c8d87b91
Merged revisions 73196,73278-73280,73299,73308,73312-73313,73317-73318,73321,73324,73331,73335,73340,73363 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73196 | benjamin.peterson | 2009-06-03 20:40:29 -0500 (Wed, 03 Jun 2009) | 1 line
use the offical api
........
r73278 | benjamin.peterson | 2009-06-07 17:33:11 -0500 (Sun, 07 Jun 2009) | 1 line
inherit from object
........
r73279 | benjamin.peterson | 2009-06-07 17:35:00 -0500 (Sun, 07 Jun 2009) | 1 line
always inherit from an appropiate base class
........
r73280 | benjamin.peterson | 2009-06-07 17:54:35 -0500 (Sun, 07 Jun 2009) | 1 line
use booleans for flags
........
r73299 | georg.brandl | 2009-06-08 13:41:36 -0500 (Mon, 08 Jun 2009) | 1 line
Typo fix.
........
r73308 | benjamin.peterson | 2009-06-08 17:18:32 -0500 (Mon, 08 Jun 2009) | 1 line
remove useless assertion
........
r73312 | benjamin.peterson | 2009-06-08 18:44:13 -0500 (Mon, 08 Jun 2009) | 1 line
remove error checks already done in set_context()
........
r73313 | r.david.murray | 2009-06-08 19:44:22 -0500 (Mon, 08 Jun 2009) | 4 lines
Issue 2947: document how return code handling translates from
os.popen to subprocess. Also fixes reference link in the
os.spawn documentation.
........
r73317 | benjamin.peterson | 2009-06-09 12:24:26 -0500 (Tue, 09 Jun 2009) | 1 line
make ast.c depend on the grammar
........
r73318 | benjamin.peterson | 2009-06-09 12:29:51 -0500 (Tue, 09 Jun 2009) | 1 line
explain why keyword names are not just NAME
........
r73321 | benjamin.peterson | 2009-06-09 16:13:43 -0500 (Tue, 09 Jun 2009) | 1 line
update symbol.py from with statement changes
........
r73324 | amaury.forgeotdarc | 2009-06-09 17:53:16 -0500 (Tue, 09 Jun 2009) | 2 lines
Avoid invoking the parser/compiler just to test the presence of a function.
........
r73331 | benjamin.peterson | 2009-06-10 08:45:31 -0500 (Wed, 10 Jun 2009) | 1 line
fix spelling
........
r73335 | raymond.hettinger | 2009-06-10 11:15:40 -0500 (Wed, 10 Jun 2009) | 1 line
Fix signed/unsigned compiler warning.
........
r73340 | amaury.forgeotdarc | 2009-06-10 15:30:19 -0500 (Wed, 10 Jun 2009) | 2 lines
Fix a typo spotted by Nick Coghlan.
........
r73363 | benjamin.peterson | 2009-06-11 12:51:17 -0500 (Thu, 11 Jun 2009) | 1 line
use multi-with syntax
........
2009-06-11 22:54:11 +00:00
Benjamin Peterson
0ffaaa634d
Merged revisions 72958 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72958 | benjamin.peterson | 2009-05-26 22:08:44 -0500 (Tue, 26 May 2009) | 1 line
plug ref leak
........
2009-05-27 03:18:19 +00:00
Benjamin Peterson
a720559878
Merged revisions 72957 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72957 | benjamin.peterson | 2009-05-26 21:43:46 -0500 (Tue, 26 May 2009) | 1 line
correctly handle descrs with __missing__
........
2009-05-27 03:08:59 +00:00
Antoine Pitrou
acc5d6b195
Merged revisions 70550 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70550 | antoine.pitrou | 2009-03-23 20:17:00 +0100 (lun., 23 mars 2009) | 3 lines
The tracking statistics were actually too pessimistic
........
2009-03-23 19:19:54 +00:00