Serhiy Storchaka
9c967611e3
Issue #25558 : Refactoring OrderedDict iteration.
2015-11-06 10:39:51 +02:00
Serhiy Storchaka
710cd34bdb
Issue #25449 : Fixed a crash and leaking NULL in repr() of OrderedDict that
...
was mutated by direct calls of dict methods.
2015-11-04 22:33:07 +02:00
Serhiy Storchaka
b45b7b2137
Issue #25449 : Iterating OrderedDict with keys with unstable hash now raises
...
KeyError in C implementations as well as in Python implementation.
Added tests for OrderedDict subclasses.
2015-11-04 22:05:38 +02:00
Serhiy Storchaka
a84f6c3dd3
Issue #25523 : Merge a-to-an corrections from 3.4.
2015-11-02 14:39:05 +02:00
Serhiy Storchaka
d65c9496da
Issue #25523 : Further a-to-an corrections.
2015-11-02 14:10:23 +02:00
Martin Panter
2eb819f7a8
Issue #25523 : Merge "a" to "an" fixes from 3.4 into 3.5
2015-11-02 04:04:57 +00:00
Martin Panter
7462b64911
Issue #25523 : Correct "a" article to "an" article
...
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Serhiy Storchaka
14eefe353e
Issue #25395 : Fixed crash when highly nested OrderedDict structures were
...
garbage collected.
2015-11-01 16:12:34 +02:00
Serhiy Storchaka
4575beba4b
Issue #25410 : C implementation of OrderedDict now uses type(self) instead of
...
self.__class__ in __repr__() and __reduce__() for simplicity and reliability.
2015-10-22 20:18:24 +03:00
Serhiy Storchaka
d17427b7bd
Issue #25410 : Fixed a memory leak in OrderedDict in the case when key's hash
...
calculation fails.
2015-10-20 18:21:48 +03:00
Serhiy Storchaka
8003bafd7f
Issue #25410 : Cleaned up and fixed minor bugs in C implementation of OrderedDict.
2015-10-18 09:53:17 +03:00
Serhiy Storchaka
992ec46acc
Issue #25406 : Fixed a bug in C implementation of OrderedDict.move_to_end()
...
that caused segmentation fault or hang in iterating after moving several
items to the start of ordered dict.
2015-10-14 19:21:24 +03:00
Martin Panter
ec1aa5c2a1
More typos in 3.5 documentation and comments
2015-10-07 11:03:53 +00:00
Martin Panter
3f930dcd87
Merge typo fixes from 3.4 into 3.5
2015-10-07 11:01:47 +00:00
Martin Panter
9955a373a8
Various minor typos in documentation and comments
2015-10-07 10:26:23 +00:00
Benjamin Peterson
59dc696821
merge 3.4 ( #24806 )
2015-10-06 19:42:02 -07:00
Benjamin Peterson
bd6c41a185
prevent unacceptable bases from becoming bases through multiple inheritance ( #24806 )
2015-10-06 19:36:54 -07:00
Serhiy Storchaka
58c8f2bb6d
Issue #24848 : Fixed bugs in UTF-7 decoding of misformed data:
...
1. Non-ASCII bytes were accepted after shift sequence.
2. A low surrogate could be emitted in case of error in high surrogate.
3. In some circumstances the '\xfd' character was produced instead of the
replacement character '\ufffd' (due to a bug in _PyUnicodeWriter).
2015-10-02 13:13:14 +03:00
Serhiy Storchaka
28b21e50c8
Issue #24848 : Fixed bugs in UTF-7 decoding of misformed data:
...
1. Non-ASCII bytes were accepted after shift sequence.
2. A low surrogate could be emitted in case of error in high surrogate.
2015-10-02 13:07:28 +03: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
Victor Stinner
ae86da9b20
(Merge 3.4) Issue #25182 : Fix compilation on Windows
2015-09-30 15:03:31 +02:00
Victor Stinner
89719e1daf
Issue #25182 : Fix compilation on Windows
...
Restore also errno value before calling PyErr_SetFromErrno().
2015-09-30 15:01:34 +02:00
Serhiy Storchaka
008fc77e1e
Issue #25182 : The stdprinter (used as sys.stderr before the io module is
...
imported at startup) now uses the backslashreplace error handler.
2015-09-30 15:50:32 +03:00
Serhiy Storchaka
a59018c7ab
Issue #25182 : The stdprinter (used as sys.stderr before the io module is
...
imported at startup) now uses the backslashreplace error handler.
2015-09-30 15:46:53 +03:00
Victor Stinner
5783fd2c58
Issue #24999 : In longobject.c, use two shifts instead of ">> 2*PyLong_SHIFT" to
...
avoid undefined behaviour when LONG_MAX type is smaller than 60 bits.
This change should fix a warning with the ICC compiler.
2015-09-19 13:39:03 +02:00
Victor Stinner
4a0d1e7c36
odictobject.c: fix compiler warning
...
PyObject_Length() returns a P_ssize_t, not an int. Use a Py_ssize_t to avoid
overflow.
2015-09-18 13:44:11 +02:00
Guido van Rossum
37fdcbc4c3
Issue #24912 : Prevent __class__ assignment to immutable built-in objects. (Merge 3.5.0 -> 3.5)
2015-09-05 15:20:08 -07:00
Guido van Rossum
7d293ee97d
Issue #24912 : Prevent __class__ assignment to immutable built-in objects.
2015-09-04 20:54:07 -07:00
Victor Stinner
ca30b02abe
Issue #24992 : Fix error handling and a race condition (related to garbage
...
collection) in collections.OrderedDict constructor.
Patch reviewed by Serhiy Storchaka.
2015-09-03 17:50:04 +02:00
Zachary Ware
79b98df023
Issue #21279 : Flesh out str.translate docs
...
Initial patch by Kinga Farkas, Martin Panter, and John Posner.
2015-08-05 23:54:15 -05:00
Stefan Krah
0c51595a78
Issue #15944 : memoryview: Allow arbitrary formats when casting to bytes.
...
Original patch by Martin Panter.
2015-08-08 13:38:10 +02:00
Eric Snow
8c7f9558eb
Issue #24667 : Resize odict in all cases that the underlying dict resizes.
2015-08-07 17:45:12 -06:00
Zachary Ware
d987a81d29
Issue #21279 : Merge with 3.4
2015-08-06 00:04:23 -05:00
Serhiy Storchaka
d92d4efe3d
Issue #23573 : Restored optimization of bytes.rfind() and bytearray.rfind()
...
for single-byte argument on Linux.
2015-07-20 22:58:02 +03:00
Raymond Hettinger
a3626bc5bd
Issue #24583 : Fix crash when set is mutated while being updated.
2015-07-15 23:50:14 -07: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
Yury Selivanov
f488fb422a
Issue #19235 : Add new RecursionError exception. Patch by Georg Brandl.
2015-07-03 01:04:23 -04:00
Yury Selivanov
e13f8f3cab
Issue #24450 : Add gi_yieldfrom to generators; cr_await to coroutines.
...
Patch by Benno Leslie and Yury Selivanov.
2015-07-03 00:23:30 -04:00
Serhiy Storchaka
bc9e75ed02
Issue #24467 : Fixed possible buffer over-read in bytearray. The bytearray
...
object now always allocates place for trailing null byte and it's buffer now
is always null-terminated.
2015-06-29 21:18:01 +03:00
Serhiy Storchaka
7b6e3b91f5
Issue #24467 : Fixed possible buffer over-read in bytearray. The bytearray
...
object now always allocates place for trailing null byte and it's buffer now
is always null-terminated.
2015-06-29 21:14:06 +03:00
Benjamin Peterson
4801383c29
upgrade to Unicode 8.0.0
2015-06-27 15:45:56 -05:00
Yury Selivanov
66f8828bfc
Issue #24439 : Improve PEP 492 related docs.
...
Patch by Martin Panter.
2015-06-24 11:04:15 -04:00
Yury Selivanov
5376ba9630
Issue #24400 : Introduce a distinct type for 'async def' coroutines.
...
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 12:19:30 -04:00
Serhiy Storchaka
553e156921
Fixed indentation of Python examples in C comments.
2015-06-11 00:07:47 +03:00
Serhiy Storchaka
d741a88049
Fixed indentation of Python examples in C comments.
2015-06-11 00:06:39 +03:00
Benjamin Peterson
0718de9770
repair my irrational excuberance
2015-06-07 00:00:42 -05:00
Benjamin Peterson
99e96f2bb0
remove unnecessary braces and indentation
2015-06-06 23:20:32 -05:00
Benjamin Peterson
2ad80f53c1
fix refleak when keys() fails
2015-06-04 14:34:20 -05:00
Eric Snow
4fabf02633
Issue #24369 : Defend against key-changes during iteration.
2015-06-04 00:09:56 -06:00
Eric Snow
db4061cb9d
Issue #24377 : Fix a ref leak in OrderedDict.__repr__.
2015-06-03 11:09:48 -06:00
Eric Snow
4c72918a59
Issue #24362 : Simplify the C OrderedDict fast nodes resize logic.
2015-06-03 10:50:37 -06:00
Eric Snow
ac02ef373f
Issue #24368 : Support keyword arguments in OrderedDict methods.
2015-06-02 20:42:14 -06:00
Eric Snow
b952ab43f2
Issue #24359 : Check for changed OrderedDict size during iteration.
2015-06-01 23:35:13 -06:00
Eric Snow
d171975609
Issue #24348 : Drop superfluous increfs/decrefs.
2015-06-01 23:12:13 -06:00
Eric Snow
a762af74b2
Issue #24347 : Set KeyError if PyDict_GetItemWithError returns NULL.
2015-06-01 22:59:08 -06:00
Benjamin Peterson
0969a9f8ab
add Py_tp_finalize slot ( closes #24345 )
...
Patch from Petr Viktorin.
2015-06-01 10:12:48 -05:00
Serhiy Storchaka
d4ea03c785
Issue #24284 : The startswith and endswith methods of the str class no longer
...
return True when finding the empty string and the indexes are completely out
of range.
2015-05-31 09:15:51 +03:00
Eric Snow
e3dfa9e5ce
Issue #16991 : Fix a few leaks and other memory-related concerns in OrderedDict.
2015-05-30 12:51:15 -06:00
Eric Snow
67fb92e8c6
Issue #16991 : Do not return None from OrderedDict.__reversed__.
2015-05-30 11:43:36 -06:00
Eric Snow
c5e59609ac
Issue #16991 : Properly handle return values in several places.
2015-05-30 11:28:56 -06:00
Yury Selivanov
7aa5341164
Reverting my previous commit.
...
Something went horribly wrong when I was doing `hg rebase`.
2015-05-30 10:57:56 -04:00
Serhiy Storchaka
e90982111a
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
...
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:48:54 +03:00
Serhiy Storchaka
ac5569b1fa
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
...
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:48:19 +03:00
Serhiy Storchaka
fa494fd883
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
...
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:45:22 +03:00
Serhiy Storchaka
2806518e0c
Specify default values of semantic booleans in Argument Clinic generated signatures as booleans.
2015-05-30 11:32:58 +03:00
Serhiy Storchaka
8b2e8b6cce
Specify default values of semantic booleans in Argument Clinic generated signatures as booleans.
2015-05-30 11:30:39 +03:00
Eric Snow
96c6af9b20
Issue #16991 : Add a C implementation of collections.OrderedDict.
2015-05-29 22:21:39 -06:00
Eric Snow
47db71756d
Issue #16991 : Add a C implementation of collections.OrderedDict.
2015-05-29 22:21:39 -06:00
Yury Selivanov
ac0bffb962
Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc.
2015-05-28 11:22:41 -04:00
Yury Selivanov
6ef059097c
Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc.
2015-05-28 11:21:31 -04:00
Raymond Hettinger
8651a50475
Issue #23359 : Specialize set_lookkey intoa lookup function and an insert function.
2015-05-27 10:37:20 -07:00
Serhiy Storchaka
a7a0ad6f73
Issue #24276 : Fixed optimization of property descriptor getter.
2015-05-24 21:38:06 +03:00
Nick Coghlan
a48db2bc8b
Issue #24268 : Address some PEP 489 refleaks
...
- missing DECREF in PyModule_FromDefAndSpec2
- missing DECREF in PyType_FromSpecAndBases2
- missing DECREF in _testmultiphase module
Patch by Petr Viktorin
2015-05-24 01:03:46 +10:00
Nick Coghlan
d5cacbb1d9
PEP 489: Multi-phase extension module initialization
...
Known limitations of the current implementation:
- documentation changes are incomplete
- there's a reference leak I haven't tracked down yet
The leak is most visible by running:
./python -m test -R3:3 test_importlib
However, you can also see it by running:
./python -X showrefcount
Importing the array or _testmultiphase modules, and
then deleting them from both sys.modules and the local
namespace shows significant increases in the total
number of active references each cycle. By contrast,
with _testcapi (which continues to use single-phase
initialisation) the global refcounts stabilise after
a couple of cycles.
2015-05-23 22:24:10 +10:00
Yury Selivanov
683333955a
Issue 24237: Raise PendingDeprecationWarning per PEP 479
...
Raise PendingDeprecationWarning when generator raises StopIteration
and no __future__ import is used. Fix offenders in the stdlib
and tests.
See also issue 22906.
Thanks to Nick Coghlan and Berker Peksag for reviews.
2015-05-22 11:16:47 -04:00
Serhiy Storchaka
e79ec70801
Issue #24257 : Fixed incorrect uses of PyObject_IsInstance().
...
Fixed segmentation fault in sqlite3.Row constructor with faked cursor type.
Fixed system error in the comparison of faked types.SimpleNamespace.
2015-05-22 11:13:20 +03:00
Serhiy Storchaka
08d230a540
Issue #24257 : Fixed incorrect uses of PyObject_IsInstance().
...
Fixed segmentation fault in sqlite3.Row constructor with faked cursor type.
Fixed system error in the comparison of faked types.SimpleNamespace.
2015-05-22 11:02:49 +03:00
Serhiy Storchaka
b2f3c2357c
Issue #23985 : Fixed integer overflow in iterator object. Patch by
...
Clement Rouault.
2015-05-21 20:51:53 +03:00
Serhiy Storchaka
4faf5c5655
Issue #23985 : Fixed integer overflow in iterator object. Patch by
...
Clement Rouault.
2015-05-21 20:50:25 +03:00
Antoine Pitrou
873e0df946
Fix some compilation warnings when using gcc (-Wmaybe-uninitialized).
2015-05-19 21:06:04 +02:00
Antoine Pitrou
f6d1f1fa8a
Fix some compilation warnings when using gcc (-Wmaybe-uninitialized).
2015-05-19 21:04:33 +02:00
Antoine Pitrou
ef64847f71
Issue #23985 : Fix a possible buffer overrun when deleting a slice from the front of a bytearray and then appending some other bytes data.
...
Patch by Martin Panter.
2015-05-19 20:55:42 +02:00
Antoine Pitrou
2545411e28
Issue #23985 : Fix a possible buffer overrun when deleting a slice from the front of a bytearray and then appending some other bytes data.
...
Patch by Martin Panter.
2015-05-19 20:52:27 +02:00
Serhiy Storchaka
9ce71a6475
Fixed typos in comments.
2015-05-18 22:20:18 +03:00
Serhiy Storchaka
7e29eea926
Fixed typos in comments.
2015-05-18 22:19:42 +03:00
Raymond Hettinger
740d6134f1
merge
2015-05-17 14:47:00 -07:00
Raymond Hettinger
610a51f364
Issue #23757 : Only call the concrete list API for exact lists.
2015-05-17 14:45:58 -07:00
Raymond Hettinger
d4be691494
Issue #24064 : Help property() support GC
2015-05-13 11:12:33 -07:00
Raymond Hettinger
5af9e13c18
Minor stylistic and consistency cleanup.
2015-05-13 01:44:36 -07:00
Raymond Hettinger
1bd8d75be3
Issue #23290 : Optimize set_merge() for cases where the target is empty.
...
(Contributed by Serhiy Storchaka.)
2015-05-13 01:26:14 -07:00
Raymond Hettinger
eac503aeac
Issue #24064 : Property() docstrings are now writeable.
...
(Patch by Berker Peksag.)
2015-05-13 01:09:59 -07:00
Serhiy Storchaka
48e47aaa28
Issue #22486 : Added the math.gcd() function. The fractions.gcd() function now is
...
deprecated. Based on patch by Mark Dickinson.
2015-05-13 00:19:51 +03:00
Serhiy Storchaka
0d4df752ac
Issue #15027 : The UTF-32 encoder is now 3x to 7x faster.
2015-05-12 23:12:45 +03:00
Yury Selivanov
df52e67d85
Fix warnings for gen_get_iter()
2015-05-11 23:23:05 -04:00
Yury Selivanov
7544508f02
PEP 0492 -- Coroutines with async and await syntax. Issue #24017 .
2015-05-11 22:57:16 -04:00
Yury Selivanov
18c30a29f8
Issue #22906 : Do incref before SetCause/SetContext
2015-05-10 15:09:46 -04:00
Yury Selivanov
80e4dbea0e
Issue 22906: Increment refcount after PyException_SetContext
2015-05-09 14:04:17 -04:00
Yury Selivanov
8170e8c0d1
PEP 479: Change StopIteration handling inside generators.
...
Closes issue #22906 .
2015-05-09 11:44:30 -04:00