Commit Graph

4425 Commits

Author SHA1 Message Date
Stefan Krah 674a42b114 Fix error messages. 2013-02-19 13:44:49 +01:00
R David Murray 702a5dc1ed #7963: fix error message when 'object' called with arguments. 2013-02-18 21:39:18 -05:00
R David Murray 6b30759022 #7963: fix error message when 'object' called with arguments.
Patch by Alexander Belopolsky.
2013-02-18 21:20:08 -05:00
Serhiy Storchaka 801d955f04 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:42:01 +02:00
Serhiy Storchaka 5e61f14c6d Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:36:00 +02:00
Antoine Pitrou c73c561181 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:14:42 +01:00
Antoine Pitrou 4de7457009 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
2013-02-09 23:11:27 +01:00
Victor Stinner bbbac2ec34 Issue #17137: When an Unicode string is resized, the internal wide character
string (wstr) format is now cleared.
2013-02-07 23:12:46 +01:00
Serhiy Storchaka 03ee12ed72 Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
2013-02-07 16:25:25 +02:00
Serhiy Storchaka 3fd4ab356d Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
2013-02-07 16:23:21 +02:00
Serhiy Storchaka d357a3f841 Issue #17034: Use Py_CLEAR() in bytesobject.c. 2013-02-02 18:45:54 +02:00
Serhiy Storchaka f458a03617 Issue #17034: Use Py_CLEAR() in bytesobject.c. 2013-02-02 18:45:22 +02:00
Gregory P. Smith ce9e3c3af9 Silence a -Wformat-extra-argument warning when compiling. 2013-02-01 16:14:00 -08:00
Serhiy Storchaka afb1cb5579 Issue #16971: Fix a refleak in the charmap decoder. 2013-01-29 12:13:22 +02:00
Serhiy Storchaka 24193debd4 Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. 2013-01-29 10:28:07 +02:00
Serhiy Storchaka d679377be7 Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. 2013-01-29 10:20:44 +02:00
Ezio Melotti 3f5db3940f Fix a few typos and a double semicolon. Patch by Eitan Adler. 2013-01-27 06:20:14 +02:00
Serhiy Storchaka 678db84b37 Issue #10156: In the interpreter's initialization phase, unicode globals
are now initialized dynamically as needed.
2013-01-26 12:16:36 +02:00
Serhiy Storchaka 059972535f Issue #10156: In the interpreter's initialization phase, unicode globals
are now initialized dynamically as needed.
2013-01-26 12:14:02 +02:00
Serhiy Storchaka 73e38809e0 Issue #16980: Fix processing of escaped non-ascii bytes in the
unicode-escape-decode decoder.
2013-01-25 23:52:21 +02:00
Serhiy Storchaka e58785b200 Issue #16975: Fix error handling bug in the escape-decode bytes decoder. 2013-01-25 23:32:41 +02:00
Serhiy Storchaka ace3ad3bf7 Issue #16975: Fix error handling bug in the escape-decode bytes decoder. 2013-01-25 23:31:43 +02:00
Serhiy Storchaka c35f3a9f61 Issue #16335: Fix integer overflow in unicode-escape decoder. 2013-01-21 11:42:57 +02:00
Serhiy Storchaka 4f5f0e54e0 Issue #16335: Fix integer overflow in unicode-escape decoder. 2013-01-21 11:38:00 +02:00
Serhiy Storchaka 441d30fac7 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka 45d16d9924 Issue #14850: Now a chamap decoder treates U+FFFE as "undefined mapping"
in any mapping, not only in an unicode string.
2013-01-15 15:01:20 +02:00
Serhiy Storchaka 4fb8caee87 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:43:21 +02:00
Serhiy Storchaka 18ba40b945 Check for NULL before the pointer aligning in fastsearch_memchr_1char.
There is no guarantee that NULL is aligned.
2013-01-15 13:27:28 +02:00
Benjamin Peterson 0c270a8bb7 correct static string clearing loop (closes #16906) 2013-01-09 09:52:01 -06:00
Serhiy Storchaka ae3b32ad6b 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:40:52 +02:00
Serhiy Storchaka 48e188e573 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:14:24 +02:00
Serhiy Storchaka dec798eb46 Fix out of bound read in UTF-32 decoder on "narrow Unicode" builds. 2013-01-08 22:45:42 +02:00
Serhiy Storchaka 6c83e739d7 Issue #16856: Fix a segmentation fault from calling repr() on a dict with
a key whose repr raise an exception.
2013-01-04 12:39:34 +02:00
Victor Stinner 7ae320d667 (Merge 3.2) Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
2013-01-03 01:21:07 +01:00
Victor Stinner 20b654acb5 Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
2013-01-03 01:08:58 +01:00
Antoine Pitrou 0811f98e10 Fix the advertised size of PyCFunctionObjects in sys._debugmallocstats(). 2012-12-30 22:46:04 +01:00
Serhiy Storchaka 00e2843115 Issue #16761: Raise TypeError when int() called with base argument only. 2012-12-28 10:02:42 +02:00
Serhiy Storchaka 0b386d5247 Issue #16761: Raise TypeError when int() called with base argument only. 2012-12-28 09:42:11 +02:00
Benjamin Peterson 5ff3f73d94 try to call __bytes__ before __index__ (closes #16722) 2012-12-19 15:27:41 -06:00
Gregory P. Smith a6be61ec71 Keep y a Py_hash_t instead of Py_uhash_t as it is compared with == -1 and the
compiler logic will do the right thing with just x as a Py_uhash_t.  This
matches what was already done in the 3.3 version.

cleanup only - no functionality or hash values change.
2012-12-10 18:34:09 -08:00
Gregory P. Smith c2176e46d7 Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.

NOTE: This change is smaller compared to 3.2 as much of this cleanup had
already been done.  I added the comment that my change in 3.2 added so that the
code would match up.  Otherwise this just adds or synchronizes appropriate UL
designations on some constants to be pedantic.

In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.

Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).

Cleanup only - no functionality or hash values change.
2012-12-10 18:32:53 -08:00
Gregory P. Smith 27cbcd6241 Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.

In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.

Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).

Cleanup only - no functionality or hash values change.
2012-12-10 18:15:46 -08:00
Antoine Pitrou f93ed3fa67 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:17:03 +01:00
Antoine Pitrou 62a0d6ea40 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
Victor Stinner 2660e427d1 (Merge 3.2) Issue #16416: On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
2012-12-03 12:48:53 +01:00
Victor Stinner 27b1ca29cc Issue #16416: On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
2012-12-03 12:47:59 +01:00
Antoine Pitrou 6d5ad227a5 Issue #16215: Fix potential double memory free in str.replace().
Patch by Serhiy Storchaka.
2012-11-17 23:28:17 +01:00
Antoine Pitrou f6a50cfa07 Issue #16453: Fix equality testing of dead weakref objects.
Also add tests for ordering and hashing.
2012-11-11 19:37:41 +01:00
Antoine Pitrou e11fecb5a9 Issue #16453: Fix equality testing of dead weakref objects.
Also add tests for ordering and hashing.
2012-11-11 19:36:51 +01:00