Commit Graph

128 Commits

Author SHA1 Message Date
Serhiy Storchaka 142566c028
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
Turn deprecation warnings added in 3.8 into TypeError.
2019-06-05 18:22:31 +03:00
Serhiy Storchaka 2085bd0877
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700) 2019-06-01 11:00:15 +03:00
Matthias Bussonnier eea47e0939 bpo-36953: Delay removal of ABCs from collections. (GH-13409)
Bump the removal to 3.9, indicate collections.abc available since 3.3,
replace version-changed directive to deprecated-removed.


https://bugs.python.org/issue36953
2019-05-30 14:45:48 -07:00
Batuhan Taşkaya 7abf8c6081 bpo-25652: Fix __rmod__ of UserString (GH-13326)
The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable. 


https://bugs.python.org/issue25652
2019-05-21 13:27:36 -07:00
Bar Harel f4e1babf44 bpo-27141: Fix collections.UserList and UserDict shallow copy. (GH-4094) 2019-05-19 16:57:13 +03:00
Michael Blahay b1c3167c23 bpo-27639: Correct return type for UserList slicing operation (#13169)
* BPO-27639: Correct return type for UserList slicing operation

Added logic to __getitem__ magic method for UserList to ensure that the return
type matches that of self.
2019-05-07 17:41:06 -04:00
Serhiy Storchaka d53cf99dca
bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705) 2019-05-06 22:40:27 +03:00
Slam 76b387bf74 Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() (GH-12139)
Semantically the same, but more idiomatic by checking against `kwargs` instead of `len(kwargs)`.
2019-04-02 14:47:41 -07:00
Raymond Hettinger 23581c018f
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) 2019-03-18 00:27:39 -07:00
Raymond Hettinger 407c734326
bpo-36057 Update docs and tests for ordering in collections.Counter [no behavior change] (#11962)
* Add tests for Counter order.  No behavior change.

* Update docs and tests

* Fix doctest output and capitalization
2019-02-21 09:19:00 -08:00
Raymond Hettinger 64360ada0f Complete and neaten-up namedtuple's replacement of builtin function lookups with derefs (GH-11794) 2019-02-08 10:37:39 -08:00
Amador Pahim 85d83ec7c9 bpo-35864: fix namedtuple._asdict() docstring (GH-11720) 2019-02-01 12:38:57 -08:00
Raymond Hettinger 0bb4bdf0d9
bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)
* Change from OrderedDict to a regular dict

* Add blurb
2019-01-31 00:59:50 -08:00
Serhiy Storchaka 052b2dfdc9
bpo-32492: Tweak _collections._tuplegetter. (GH-11367)
* Replace the docstrings cache with sys.intern().
* Improve tests.
* Unify names of tp_descr_get and tp_descr_set functions.
2018-12-31 14:15:16 +02:00
Pablo Galindo 3f5fc70c62 bpo-32492: 1.6x speed up in namedtuple attribute access using C fast-path (#10495)
* bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path

* Add News entry

* fixup! bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path

* Check for tuple in the __get__ of the new descriptor and don't cache the descriptor itself

* Don't inherit from property. Implement GC methods to handle __doc__

* Add a test for the docstring substitution in descriptors

* Update NEWS entry to reflect time against 3.7 branch

* Simplify implementation with argument clinic, better error messages, only __new__

* Use positional-only parameters for the __new__

* Use PyTuple_GET_SIZE and PyTuple_GET_ITEM to tighter the implementation of tuplegetterdescr_get

* Implement __set__ to make tuplegetter a data descriptor

* Use Py_INCREF now that we inline PyTuple_GetItem

* Apply the valid_index() function, saving one test

* Move Py_None test out of the critical path.
2018-12-30 01:24:03 -08:00
Raymond Hettinger dc9bc54899
Clarify that example in comment is about fromkeys() (GH-8141) 2018-07-06 08:52:26 -07:00
Raymond Hettinger 0c4d20bcaa
Add more detail to the Counter.fromkeys() comment block (GH-8124) 2018-07-05 16:36:24 -07:00
Raymond Hettinger 136c8e0795
Code beautification using f-strings (#5618) 2018-02-11 08:00:11 -08:00
Raymond Hettinger 3793f95f98
bpo-32792: Preserve mapping order in ChainMap() (GH-5586) 2018-02-11 00:30:31 -08:00
Serhiy Storchaka c66f9f8d39
bpo-25988: Emit a warning when use or import ABCs from 'collections'. (#5460) 2018-01-31 19:19:33 +02:00
Raymond Hettinger e6d342156d
bpo-25988: Deprecate exposing collections.abc in collections GH-5414 2018-01-29 08:27:49 -08:00
INADA Naoki a49ac99029
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342) 2018-01-27 14:06:21 +09:00
Raymond Hettinger 3948207c61
bpo-32320: Add default value support to collections.namedtuple() (#4859) 2018-01-10 21:45:19 -08:00
Raymond Hettinger 8b57d73639 bpo-28638: Optimize namedtuple() creation time by minimizing use of exec() (#3454)
* Working draft without _source

* Re-use itemgetter() instances

* Speed-up calls to __new__() with a pre-bound tuple.__new__()

* Add note regarding string interning

* Remove unnecessary create function wrappers

* Minor sync-ups with PR-2736.  Mostly formatting and f-strings

* Bring-in qualname/__module fix-ups from PR-2736

* Formally remove the verbose flag and _source attribute

* Restore a test of potentially problematic field names

* Restore kwonly_args test but without the verbose option

* Adopt Inada's idea to reuse the docstrings for the itemgetters

* Neaten-up a bit

* Add news blurb

* Serhiy pointed-out the need for interning

* Jelle noticed as missing f on an f-string

* Add whatsnew entry for feature removal

* Accede to request for dict literals instead keyword arguments

* Leave the method.__module__ attribute pointing the actual location of the code

* Improve variable names and add a micro-optimization for an non-public helper function

* Simplify by in-lining reuse_itemgetter()

* Arrange steps in more logical order

* Save docstring in local cache instead of interning
2017-09-10 10:23:36 -07:00
Jonathan Eunice faa57cbe70 bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (#2179)
* fixed OrderedDict.__init__ docstring re PEP 468

* tightened comment and mirrored to C impl

* added space after period per marco-buttu

* preserved substituted for stable

* drop references to Python 3.6 and PEP 468
2017-09-05 16:23:49 -07:00
Serhiy Storchaka 78d9e58f20 Issues #29311, #29289: Fixed and improved docstrings for dict and OrderedDict
methods.
2017-01-25 00:30:04 +02:00
Raymond Hettinger a67619ec5f merge 2016-12-31 12:02:42 -07:00
Raymond Hettinger b46ea90343 Issue #29119: Fix weakref in OrderedDict.move_to_end(). Work by Andra Bogildea. 2016-12-31 12:01:59 -07:00
Raymond Hettinger 0d5048cb21 Issue #17941: Add a *module* parameter to collections.namedtuple() 2016-09-12 00:18:31 -07:00
Raymond Hettinger dc65c68524 Remove main section that was only used during testing and development 2016-08-21 20:52:26 -07:00
Raymond Hettinger 8579a8fd63 Minor readability tweak 2016-08-17 00:46:48 -07:00
Raymond Hettinger 6538b430cf Issue #25628: Make namedtuple "rename" and "verbose" parameters keyword-only. 2016-08-16 10:55:43 -07:00
Martin Panter e501a93c18 Issue #27125: Merge typo fixes from 3.5
Also merge changes from Issue #27117; no actual code changes to 3.6.
2016-05-29 09:05:06 +00:00
Martin Panter 8d56c026a5 Issue #27125: Fix various errors like “will [be] inherited” 2016-05-29 04:13:35 +00:00
Martin Panter 3e04d5b306 Issue #27076: Merge spelling from 3.5 2016-05-26 06:03:19 +00:00
Martin Panter 46f50726a0 Issue #27076: Doc, comment and tests spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Raymond Hettinger 62bc321819 Fix out-of-date comment 2016-02-25 00:25:45 -08:00
Raymond Hettinger 2831b383e9 merge 2015-11-23 21:04:53 -08:00
Raymond Hettinger c3f7d1753f Fix non-ascii character 2015-11-23 21:03:09 -08:00
Raymond Hettinger a89013d930 merge 2015-11-23 20:43:56 -08:00
Raymond Hettinger c9c3dd87c1 Add a missing docstring 2015-11-23 20:43:28 -08:00
Serhiy Storchaka 5527cf119d Issue #22609: Constructor of collections.UserDict now accepts the self keyword
argument.
2015-09-29 23:38:34 +03:00
Serhiy Storchaka f4ee1c23e8 Issue #22609: Constructor of collections.UserDict now accepts the self keyword
argument.
2015-09-29 23:37:09 +03:00
Serhiy Storchaka 68f5ef226e Issue #22609: Constructor of collections.UserDict now accepts the self keyword
argument.
2015-09-29 23:36:06 +03:00
Raymond Hettinger 3ada93fc86 merge 2015-09-08 00:36:56 -04:00
Raymond Hettinger 8ba03cf33f Fix whitespace in comment. 2015-09-08 00:36:29 -04:00
Raymond Hettinger 9157545c11 merge 2015-08-30 09:15:36 -07:00
Raymond Hettinger 7a3602e7cf Issue #24931: Resolve __dict__ conflict in namedtuple subclasses. 2015-08-30 09:13:48 -07:00
Raymond Hettinger 4c97a62ae3 Issue #23509: Speed up Counter operators
(Based on patch by Serhiy Storchaka.)
2015-05-29 22:14:07 -07:00
Eric Snow 96c6af9b20 Issue #16991: Add a C implementation of collections.OrderedDict. 2015-05-29 22:21:39 -06:00