Raymond Hettinger
6c3c1ccd1b
Update copyright.
2013-08-31 21:34:24 -07:00
Raymond Hettinger
95c0d67581
Further reduce the cost of hash collisions by inspecting an additional nearby entry.
2013-08-31 21:27:08 -07:00
Ethan Furman
fb13721b1b
Close #18780 : %-formatting now prints value for int subclasses with %d, %i, and %u codes.
2013-08-31 10:18:55 -07:00
Raymond Hettinger
afe890923f
Tighten-up the lookkey() logic and beautify the code a bit.
...
Use less code by moving many of the steps from the initial
lookup into the main search loop.
Beautify the code but keep the overall logic unchanged.
2013-08-28 20:59:31 -07:00
Serhiy Storchaka
46e1ce214b
Issue #18783 : Removed existing mentions of Python long type in docstrings,
...
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka
9594942716
Issue #18783 : Removed existing mentions of Python long type in docstrings,
...
error messages and comments.
2013-08-27 19:40:23 +03: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
Victor Stinner
e51321020c
Issue #18408 : _PyObject_Dump() now saves/restores the current exception
...
So it can be called even if an exception was raised
2013-08-26 13:49:06 +02:00
Tim Peters
1544fc5312
Various clarifications based on feedback & questions over the years.
2013-08-24 15:31:07 -05:00
Tim Peters
ec8147ba55
Various clarifications based on feedback & questions over the years.
...
(grafted from 23181bf411a16287a0a54e910fc0f9ecd2764bf0)
2013-08-24 15:15:19 -05:00
Antoine Pitrou
9d95254bb7
Issue #18772 : fix the gdb plugin after the set implementation changes
2013-08-24 21:07:07 +02:00
Antoine Pitrou
91541931f5
Back out 5bd9db528aed (issue #18408 ). It caused unsolved buildbot failures.
2013-08-23 23:18:20 +02:00
Raymond Hettinger
bfc1e1a9cd
Add the same dummy type that is used in dictionaries.
2013-08-23 03:22:15 -05:00
Tim Peters
a1db94554b
Add line explaining the "%sort" test.
2013-08-22 18:42:02 -05:00
Tim Peters
01e75a699d
Add line explaining the "%sort" test.
...
(grafted from 1ea833ecaf5a9d43a886e9e73b4e2551d0d5b548)
2013-08-22 18:32:53 -05:00
Raymond Hettinger
fcf3b500ba
Issue 18797: Remove unneeded refcount adjustments for dummy objects.
...
It suffices to keep just one reference when the object is created.
2013-08-22 08:20:31 -07:00
Raymond Hettinger
5bb1b1dd6f
Hoist the global dummy lookup out of the inner loop for set_merge().
2013-08-21 01:34:18 -07:00
Raymond Hettinger
929cbac307
Remove a redundant hash table probe (this was artifact from an earlier draft of the patch).
2013-08-20 23:03:28 -07:00
Raymond Hettinger
ae9e616a00
Issue 18772: Restore set dummy object back to unicode and restore the identity checks in lookkey().
...
The Gdb prettyprint plugin depended on the dummy object being displayable.
Other solutions besides a unicode object are possible. For now, get it
back up and running.
The identity checks in lookkey() need to be there to prevent the dummy
object from leaking through Py_RichCompareBool() into user code in the
rare circumstance where the dummy's hash value exactly matches the hash
value of the actual key being looked up.
2013-08-20 22:28:24 -07:00
Raymond Hettinger
3c0a4f5def
Issue18771: Reduce the cost of hash collisions for set objects.
2013-08-19 07:36:04 -07:00
Raymond Hettinger
07351a0449
Remove the else-clause because the conditions are no longer mutually exclusive.
2013-08-17 02:39:46 -07:00
Raymond Hettinger
237b34b074
Use a known unique object for the dummy entry.
...
This lets us run PyObject_RichCompareBool() without
first needing to check whether the entry is a dummy.
2013-08-17 02:31:53 -07:00
Serhiy Storchaka
8fa8ee3970
Issue #18701 : Remove support of old CPython versions (<3.0) from C code.
2013-08-17 00:48:02 +03:00
Raymond Hettinger
8ad3919577
Hoist the global "dummy" lookup outside of the reinsertion loop.
2013-08-15 02:18:55 -07:00
Raymond Hettinger
d06eeb4a24
merge
2013-08-13 18:20:55 -07:00
Raymond Hettinger
b1b915c796
Issue 18719: Remove a false optimization
...
Remove an unused early-out test from the critical path for
dict and set lookups.
When the strings already have matching lengths, kinds, and hashes,
there is no additional information gained by checking the first
characters (the probability of a mismatch is already known to
be less than 1 in 2**64).
2013-08-13 18:16:34 -07:00
Antoine Pitrou
9ed5f27266
Issue #18722 : Remove uses of the "register" keyword in C code.
2013-08-13 20:18:52 +02:00
Raymond Hettinger
c629d4c9a2
Replace outdated optimization with clearer code that compiles better.
...
Letting the compiler decide how to optimize the multiply by five
gives it the freedom to make better choices for the best technique
for a given target machine.
For example, GCC on x86_64 produces a little bit better code:
Old-way (3 steps with a data dependency between each step):
shrq $5, %r13
leaq 1(%rbx,%r13), %rax
leaq (%rax,%rbx,4), %rbx
New-way (3 steps with no dependency between the first two steps
which can be run in parallel):
leaq (%rbx,%rbx,4), %rax # i*5
shrq $5, %r13 # perturb >>= PERTURB_SHIFT
leaq 1(%r13,%rax), %rbx # 1 + perturb + i*5
2013-08-05 22:24:50 -07:00
Antoine Pitrou
58720d6145
Issue #17934 : Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
2013-08-05 23:26:40 +02:00
Raymond Hettinger
c86d7e989c
Silence compiler warning for an unused declaration
2013-08-04 12:00:36 -07:00
Raymond Hettinger
e56666d17f
Silence compiler warning about an uninitialized variable
2013-08-04 11:51:03 -07:00
Raymond Hettinger
5ed1b38a7d
merge
2013-08-04 11:51:35 -07:00
Serhiy Storchaka
579ddc2fd4
Issue #16741 : Fix an error reporting in int().
2013-08-03 21:14:05 +03:00
Serhiy Storchaka
f6d0aeeadc
Issue #16741 : Fix an error reporting in int().
2013-08-03 20:55:06 +03:00
Mark Dickinson
02515f7a3a
Minor consistency fixes for some longobject.c exception messages:
...
- replace 'long int' / 'long' by 'int'
- fix capitalization of "Python" in PyLong_AsUnsignedLong
- "is too large" -> "too large", for consistency with other messages.
2013-08-03 12:08:22 +01:00
Antoine Pitrou
dcedaf6e53
Issue #18214 : Improve finalization of Python modules to avoid setting their globals to None, in most cases.
2013-07-31 23:14:08 +02:00
Antoine Pitrou
796564c27b
Issue #18112 : PEP 442 implementation (safe object finalization).
2013-07-30 19:59:21 +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
34f96b8dd3
Issue #18520 : Fix PyFunction_NewWithQualName() error handling
2013-07-22 23:04:55 +02:00
Victor Stinner
4d1f5d6eee
Reindent PyFunction_NewWithQualName()
2013-07-22 23:02:05 +02:00
Victor Stinner
1c8f059019
Issue #18520 : Add a new PyStructSequence_InitType2() function, same than
...
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).
* PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
* Fix also some calls to PyDict_SetItemString(): handle error
2013-07-22 22:24:54 +02:00
Christian Heimes
6895947570
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
...
CID 715334
2013-07-21 02:04:44 +02:00
Christian Heimes
c731bbe665
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
...
CID 715334
2013-07-21 02:04:35 +02:00
Christian Heimes
b578735dff
Check return value of PyType_Ready(&EncodingMapType)
...
CID 486654
2013-07-20 14:57:28 +02:00
Christian Heimes
26532f7519
Check return value of PyType_Ready(&EncodingMapType)
...
CID 486654
2013-07-20 14:57:16 +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
2c40f640d9
Issue #18408 : Fix list_ass_slice(), handle list_resize() failure
...
I tested the patch manually by injecting a fault using gdb: list items are
correctly restored on failure.
2013-07-19 23:06:21 +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
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
08a80b11ad
longobject.c: add an assertion to ensure that MEDIUM_VALUE() is only called on
...
small integers (0 or 1 digit)
2013-07-17 22:33:42 +02:00