Commit Graph

314 Commits

Author SHA1 Message Date
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 2f6fe51860 merge 2013-05-17 03:24:54 -07:00
Raymond Hettinger 36f74aa7f7 Issue #17563: Fix dict resize performance regression. 2013-05-17 03:01:13 -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