Commit Graph

3591 Commits

Author SHA1 Message Date
Tim Peters 61e9ffa191 Issue #19171: speed some cases of 3-argument long pow().
Reduce the base by the modulus when the base is larger than
the modulus.  This can unboundedly speed the "startup costs"
of doing modular exponentiation, particularly in cases where
the base is much larger than the modulus.  Original patch
by Armin Rigo, inspired by https://github.com/pyca/ed25519.
(grafted from f34c59494420765b013136ca93f63b716d9f1d30)
2013-10-05 16:53:52 -05:00
Ezio Melotti 38386149ab #19069: use imperative mood in float object docstrings. Patch by Marco Buttu. 2013-10-06 00:44:32 +03:00
Ezio Melotti eb053167a8 #19068: use imperative mood in complex object docstrings. Patch by Marco Buttu. 2013-10-06 00:39:18 +03:00
Tim Peters 59a06f5020 Various clarifications based on feedback & questions over the years. 2013-08-24 15:15:19 -05:00
Tim Peters 78cc8daa9b Add line explaining the "%sort" test. 2013-08-22 18:32:53 -05:00
Raymond Hettinger 0e413bd288 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 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:34:49 -07:00
Serhiy Storchaka e822b034e7 Issue #15866: The xmlcharrefreplace error handler no more produces two XML
entities for a non-BMP character on narrow build.
2013-08-06 16:56:26 +03:00
Raymond Hettinger 007684a701 Silence compiler warning for unused declaration. 2013-08-04 22:35:37 -07:00
Ronald Oussoren 3687e8055c Issue #18427: str.replace could crash the interpreter with huge strings.
This fixes two places where 'int'  was used to represent
the size of strings, instead of 'Py_ssize_t'.

(The issue is not present in the corresponding code in the 3.x branches)

Fixes #18427
2013-07-11 13:33:55 +02:00
Serhiy Storchaka ba908c72a0 Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise
OverflowError when an argument of %c format is out of range.
2013-06-23 20:22:09 +03:00
Victor Stinner 760388100e Issue #18137: Detect integer overflow on precision in float.__format__()
and complex.__format__().
2013-06-23 14:56:57 +02:00
Benjamin Peterson b91ef008ba add missing NULL check (closes #18019) 2013-05-19 19:38:12 -07:00
Mark Dickinson f794b143d3 Issue #16447: Fix potential segfault when setting __name__ on a class. 2013-04-13 15:19:05 +01:00
Benjamin Peterson 74001fad7d list slotdefs in offset order rather than sorting them (closes #17610)
This means we can remove our usage of qsort() than relied on undefined behavior.

Backport by Zbigniew Halas.
2013-04-07 09:52:59 -04:00
Serhiy Storchaka 6c467a41bc Revert a premature patch for issue #14010 (changeset d17d10c84d27). 2013-04-06 22:51:29 +03:00
Serhiy Storchaka bb84565cdb Issue #14010: Fix a crash when iterating or deleting deeply nested filters
in itertools module (i.e. itertools.izip(), itertools.chain(), etc).
2013-04-06 22:04:10 +03:00
Benjamin Peterson da2c7ebd23 allow any type with __getitem__ to be a mapping for the purposes of % (#15801) 2013-03-23 22:32:00 -05:00
Kristján Valur Jónsson 1d108bc714 Issue #10211 : Buffer object should support the new buffer interface. 2013-03-19 16:50:51 -07:00
Mark Dickinson 7cac1c25a1 Issue #16445: Fix potential segmentation fault when deleting an exception message. 2013-03-03 11:13:34 +00:00
Benjamin Peterson 8e830a0664 fix building without pymalloc (closes #17228) 2013-02-20 16:54:30 -05:00
R David Murray 5aff27aec1 #7963: fix error message when 'object' called with arguments.
Patch by Alexander Belopolsky.
2013-02-18 22:04:59 -05:00
Serhiy Storchaka d5327d95d2 Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
2013-02-07 16:23:11 +02:00
Serhiy Storchaka a8d64ae304 Issue #17034: Use Py_CLEAR() in stringobject.c. 2013-02-02 18:43:58 +02:00
Gregory P. Smith c0022b2d8c Silence a -Wformat-extra-argument warning when compiling. 2013-02-01 16:13:27 -08:00
Serhiy Storchaka c8e58126a2 Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. 2013-01-29 10:20:34 +02:00
Serhiy Storchaka c59c85c1ac Issue #10156: In the interpreter's initialization phase, unicode globals
are now initialized dynamically as needed.
2013-01-26 12:13:40 +02:00
Serhiy Storchaka 01b3a08f5e Issue #16975: Fix error handling bug in the escape-decode decoder. 2013-01-25 23:30:50 +02:00
Serhiy Storchaka 1d3acd4b59 Issue #16335: Fix integer overflow in unicode-escape decoder. 2013-01-21 11:48:24 +02:00
Serhiy Storchaka 926f3a37de Issue #15989: Fix possible integer overflow in str formatting as in unicode formatting. 2013-01-19 23:35:46 +02:00
Serhiy Storchaka 74f49ab28b Issue #15989: Fix several occurrences of integer overflow
when result of PyInt_AsLong() or PyLong_AsLong() narrowed
to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:55:39 +02:00
Raymond Hettinger ac7b49f407 Improve tooltips by listing the most common argument pattern first. 2013-01-18 23:23:11 -08:00
Serhiy Storchaka 9599745e2c Issue #14850: Now a chamap decoder treates U+FFFE as "undefined mapping"
in any mapping, not only in an unicode string.
2013-01-15 14:42:59 +02:00
Serhiy Storchaka c4b82c037e Issue #11461: Fix the incremental UTF-16 decoder. Original patch by
Amaury Forgeot d'Arc. Added tests for partial decoding of non-BMP
characters.
2013-01-08 23:12:00 +02:00
Serhiy Storchaka c9631a14d7 Fix out of bound read in UTF-32 decoder on "narrow Unicode" builds. 2013-01-08 22:43:18 +02:00
Benjamin Peterson 8f53ded1ee untabify 2013-01-02 12:25:15 -06:00
Benjamin Peterson a708adfcf6 call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516)
Patch from Tom Tromey.
2013-01-02 12:21:32 -06:00
Benjamin Peterson 6b3f8d375b ensure the attribute name string is initalized before using it (closes #16839) 2013-01-02 09:36:23 -06:00
Benjamin Peterson 5ca88d2b18 get the core to compile --disable-unicode 2013-01-01 23:04:16 -06:00
Serhiy Storchaka cf095f8e0f Issue #16761: Raise TypeError when int() or long() called with base argument only. 2012-12-28 09:31:59 +02:00
Antoine Pitrou d38c990bb7 Issue #16602: When a weakref's target was part of a long deallocation chain, the object could remain reachable through its weakref even though its refcount had dropped to zero.
Thanks to Eugene Toder for diagnosing and reporting the issue.
2012-12-08 21:15:26 +01:00
Mark Dickinson 115bc79df8 Issue #9742: Sneaky fix for build failure on Solaris 9. 2012-11-17 20:18:52 +00:00
Antoine Pitrou e3ae321222 Issue #15379: Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
Patch by Serhiy Storchaka.
2012-11-17 21:14:58 +01:00
Antoine Pitrou b704eab599 Issue #16453: Fix equality testing of dead weakref objects.
Also add tests for hashing.
2012-11-11 19:36:51 +01:00
Christian Heimes 146a5fead2 Fix compilation on Windows 2012-11-03 23:07:59 +01:00
Ezio Melotti 67dc4a87fc #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error. 2012-11-03 21:10:45 +02:00
Benjamin Peterson 47fa4d54e8 avoid a function call with redundant checks for dict size 2012-10-31 14:22:12 -04:00
Benjamin Peterson 0ec820fc5f only fast-path fromkeys() when the constructor returns a empty dict (closes #16345) 2012-10-31 14:05:55 -04:00
Benjamin Peterson 6da3ed63d8 initialize more global type objects (closes #16369) 2012-10-30 23:21:10 -04:00
Mark Dickinson 75d3600466 Issue #14700: Fix buggy overflow checks for large precision and width in new-style and old-style formatting. 2012-10-28 10:00:46 +00:00
Chris Jerdonek ad4b000179 Issue #14783: Backport changes from 3.2. 2012-10-07 20:37:54 -07:00