Commit Graph

4183 Commits

Author SHA1 Message Date
Victor Stinner 05d1189566 Fix post-condition in unicode_repr(): check the result, not the input 2011-10-06 01:13:58 +02:00
Victor Stinner f48323e3b3 replace() uses unicode_fromascii() if the input and replace string is ASCII 2011-10-05 23:27:08 +02:00
Victor Stinner 0617b6e18b unicode_fromascii() checks that the input is ASCII in debug mode 2011-10-05 23:26:01 +02:00
Victor Stinner c3cec7868b Add asciilib: similar to ucs1, ucs2 and ucs4 library, but specialized to ASCII
ucs1, ucs2 and ucs4 libraries have to scan created substring to find the
maximum character, whereas it is not need to ASCII strings. Because ASCII
strings are common, it is useful to optimize ASCII.
2011-10-05 21:24:08 +02:00
Victor Stinner 14f8f02826 Fix PyUnicode_Partition(): str_in->str_obj 2011-10-05 20:58:25 +02:00
Victor Stinner 31392e741d Fix my_basename(): make the string ready 2011-10-05 20:14:23 +02:00
Victor Stinner bb10a1f759 Ensure that newly created strings use the most efficient store in debug mode 2011-10-05 01:34:17 +02:00
Victor Stinner 9310abbf40 Replace PyUnicodeObject* with PyObject* where it was inappropriate 2011-10-05 00:59:23 +02:00
Victor Stinner ce5faf673e unicodeobject.c doesn't make output strings ready in debug mode
Try to only create non ready strings in debug mode to ensure that all functions
(not only in unicodeobject.c, everywhere) make input strings ready.
2011-10-05 00:42:43 +02:00
Georg Brandl 7597addbd4 More typoes. 2011-10-05 16:36:47 +02:00
Victor Stinner c80d6d20d5 Speedup str[a🅱️step] for step != 1
Try to stop the scanner of the maximum character before the end using a limit
depending on the kind (e.g. 256 for PyUnicode_2BYTE_KIND).
2011-10-05 14:13:28 +02:00
Victor Stinner ae86485517 Speedup find_maxchar_surrogates() for 32-bit wchar_t
If we have at least one character in U+10000-U+10FFFF, we know that we must use
PyUnicode_4BYTE_KIND kind.
2011-10-05 14:02:44 +02:00
Victor Stinner b9275c104e Speedup str[a:b] and PyUnicode_FromKindAndData
* str[a:b] doesn't scan the string for the maximum character if the string
   is ascii only
 * PyUnicode_FromKindAndData() stops if we are sure that we cannot use a
   shorter character type. For example, _PyUnicode_FromUCS1() stops if we
   have at least one character in range U+0080-U+00FF
2011-10-05 14:01:42 +02:00
Victor Stinner 702c734395 Speedup the ASCII decoder
It is faster for long string and a little bit faster for short strings,
benchmark on Linux 32 bits, Intel Core i5 @ 3.33GHz:

./python -m timeit 'x=b"a"' 'x.decode("ascii")'
./python -m timeit 'x=b"x"*80' 'x.decode("ascii")'
./python -m timeit 'x=b"abc"*4096' 'x.decode("ascii")'

length |   before   | after
-------+------------+-----------
     1 | 0.234 usec | 0.229 usec
    80 | 0.381 usec | 0.357 usec
12,288 |  11.2 usec |  3.01 usec
2011-10-05 13:50:52 +02:00
Victor Stinner e1335c711c Fix usage og PyUnicode_READY() 2011-10-04 20:53:03 +02:00
Victor Stinner e06e145943 _PyUnicode_READY_REPLACE() cannot be used in unicode_subtype_new() 2011-10-04 20:52:31 +02:00
Victor Stinner 17efeed284 Add DONT_MAKE_RESULT_READY to unicodeobject.c to help detecting bugs
Use also _PyUnicode_READY_REPLACE() when it's applicable.
2011-10-04 20:05:46 +02:00
Victor Stinner 6b56a7fd3d Add assertion to _Py_ReleaseInternedUnicodeStrings() if READY fails 2011-10-04 20:04:52 +02:00
Antoine Pitrou 875f29bb95 Fix naïve heuristic in unicode slicing (followup to 1b4f886dc9e2) 2011-10-04 20:00:49 +02:00
Antoine Pitrou 2242522fde Add a necessary call to PyUnicode_READY() (followup to ab5086539ab9) 2011-10-04 19:10:51 +02:00
Antoine Pitrou 7aec401966 Optimize string slicing to use the new API 2011-10-04 19:08:01 +02:00
Antoine Pitrou e19aa388e8 When expandtabs() would be a no-op, don't create a duplicate string 2011-10-04 16:04:01 +02:00
Antoine Pitrou e71d574a39 Migrate str.expandtabs to the new API 2011-10-04 15:55:09 +02:00
Benjamin Peterson 7f3140ef80 fix parens 2011-10-03 19:37:29 -04:00
Benjamin Peterson 4bfce8f81f fix formatting 2011-10-03 19:35:07 -04:00
Benjamin Peterson ccc51c1fc6 fix compiler warnings 2011-10-03 19:34:12 -04:00
Victor Stinner b092365cc6 Move in-place Unicode append to its own subfunction 2011-10-04 01:17:31 +02:00
Victor Stinner a5f9163501 Reindent internal Unicode macros 2011-10-04 01:07:11 +02:00
Victor Stinner a41463c203 Document utf8_length and wstr_length states
Ensure these states with assertions in _PyUnicode_CheckConsistency().
2011-10-04 01:05:08 +02:00
Victor Stinner 9566311014 resize_inplace() sets utf8_length to zero if the utf8 is not shared8
Cleanup also the code.
2011-10-04 01:03:50 +02:00
Victor Stinner 9e9d689d85 PyUnicode_New() sets utf8_length to zero for latin1 2011-10-04 01:02:02 +02:00
Victor Stinner 016980454e Unicode: raise SystemError instead of ValueError or RuntimeError on invalid
state
2011-10-04 00:04:26 +02:00
Victor Stinner 7f11ad4594 Unicode: document when the wstr pointer is shared with data
Add also related assertions to _PyUnicode_CheckConsistency().
2011-10-04 00:00:20 +02:00
Victor Stinner 03490918b7 Add _PyUnicode_HAS_WSTR_MEMORY() macro 2011-10-03 23:45:12 +02:00
Victor Stinner 9ce5a835bb PyUnicode_Join() checks output length in debug mode
PyUnicode_CopyCharacters() may copies less character than requested size, if
the input string is smaller than the argument. (This is very unlikely, but who
knows!?)

Avoid also calling PyUnicode_CopyCharacters() if the string is empty.
2011-10-03 23:36:02 +02:00
Victor Stinner b803895355 Fix a compiler warning in PyUnicode_Append()
Don't check PyUnicode_CopyCharacters() in release mode. Rename also some
variables.
2011-10-03 23:27:56 +02:00
Victor Stinner 8cfcbed4e3 Improve string forms and PyUnicode_Resize() documentation
Remove also the FIXME for resize_copy(): as discussed with Martin, copy the
string on resize if the string is not resizable is just fine.
2011-10-03 23:19:21 +02:00
Victor Stinner 77bb47b312 Simplify unicode_resizable(): singletons reference count is at least 2 2011-10-03 20:06:05 +02:00
Victor Stinner 85041a54bd _PyUnicode_CheckConsistency() checks utf8 field consistency 2011-10-03 14:42:39 +02:00
Victor Stinner 3cf4637e4e unicode_subtype_new() copies also the ascii flag 2011-10-03 14:42:15 +02:00
Victor Stinner 42dfd71333 unicode_kind_name() doesn't check consistency anymore
It is is called from _PyUnicode_Dump() and so must not fail.
2011-10-03 14:41:45 +02:00
Victor Stinner a3b334da6d PyUnicode_Ready() now sets ascii=1 if maxchar < 128
ascii=1 is no more reserved to PyASCIIObject. Use
PyUnicode_IS_COMPACT_ASCII(obj) to check if obj is a PyASCIIObject (as before).
2011-10-03 13:53:37 +02:00
Victor Stinner 1b4f9ceca7 Create _PyUnicode_READY_REPLACE() to reuse singleton
Only use _PyUnicode_READY_REPLACE() on just created strings.
2011-10-03 13:28:14 +02:00
Victor Stinner c379ead9af Fix resize_compact() and resize_inplace(); reenable full resize optimizations
* resize_compact() updates also wstr_len for non-ascii strings sharing wstr
 * resize_inplace() updates also utf8_len/wstr_len for strings sharing
   utf8/wstr
2011-10-03 12:52:27 +02:00
Victor Stinner 34411e17b0 resize_inplace() has been fixed: reenable this optimization 2011-10-03 12:21:33 +02:00
Victor Stinner a849a4b6b4 _PyUnicode_Dump() indicates if wstr and/or utf8 are shared 2011-10-03 12:12:11 +02:00
Victor Stinner 1c8d0c76a1 Fix resize_inplace(): update shared utf8 pointer 2011-10-03 12:11:00 +02:00
Victor Stinner ca4f7a4298 Disable unicode_resize() optimization on Windows (16-bit wchar_t) 2011-10-03 04:18:04 +02:00
Victor Stinner 126c559d05 _PyUnicode_Ready() for 16-bit wchar_t 2011-10-03 04:17:10 +02:00
Victor Stinner 2fd82278cb Fix compilation error on Windows
Fix also a compiler warning.
2011-10-03 04:06:05 +02:00
Victor Stinner a3be613a56 Use PyUnicode_WCHAR_KIND to check if a string is a wstr string
Simplify the test in wstr pointer in unicode_sizeof().
2011-10-03 02:16:37 +02:00
Victor Stinner 910337b42e Add _PyUnicode_CheckConsistency() macro to help debugging
* Document Unicode string states
 * Use _PyUnicode_CheckConsistency() to ensure that objects are always
   consistent.
2011-10-03 03:20:16 +02:00
Victor Stinner 4fae54cb0e In release mode, PyUnicode_InternInPlace() does nothing if the input is NULL or
not a unicode, instead of failing with a fatal error.

Use assertions in debug mode (provide better error messages).
2011-10-03 02:01:52 +02:00
Victor Stinner 23e5668214 PyUnicode_Append() now works in-place when it's possible 2011-10-03 03:54:37 +02:00
Victor Stinner fe226c0d37 Rewrite PyUnicode_Resize()
* Rename _PyUnicode_Resize() to unicode_resize()
 * unicode_resize() creates a copy if the string cannot be resized instead
   of failing
 * Optimize resize_copy() for wstr strings
 * Disable temporary resize_inplace()
2011-10-03 03:52:20 +02:00
Victor Stinner 829c0adca9 Add _PyUnicode_HAS_UTF8_MEMORY() macro 2011-10-03 01:08:02 +02:00
Victor Stinner fe0c155c4f Write _PyUnicode_Dump() to help debugging 2011-10-03 02:59:31 +02:00
Victor Stinner f42dc448e0 PyUnicode_CopyCharacters() fails when copying latin1 into ascii 2011-10-02 23:33:16 +02:00
Victor Stinner c53be96c54 unicode_convert_wchar_to_ucs4() cannot fail 2011-10-02 21:33:54 +02:00
Victor Stinner c3c7415639 Add _PyUnicode_DATA_ANY(op) private macro 2011-10-02 20:39:55 +02:00
Victor Stinner a464fc141d unicode_empty and unicode_latin1 are PyObject* objects, not PyUnicodeObject* 2011-10-02 20:39:30 +02:00
Victor Stinner 267aa24365 PyUnicode_FindChar() raises a IndexError on invalid index 2011-10-02 01:08:37 +02:00
Victor Stinner bc603d12b7 Optimize _PyUnicode_AsKind() for UCS1->UCS4 and UCS2->UCS4
* Ensure that the input string is ready
 * Raise a ValueError instead of of a fatal error
2011-10-02 01:00:40 +02:00
Victor Stinner 5a706cf8c0 Fix usage of PyUnicode_READY() in PyUnicode_GetLength() 2011-10-02 00:36:53 +02:00
Victor Stinner cd9950fd09 PyUnicode_WriteChar() raises IndexError on invalid index
PyUnicode_WriteChar() raises also a ValueError if the string has more than 1
reference.
2011-10-02 00:34:53 +02:00
Victor Stinner 2fe5ced752 PyUnicode_ReadChar() raises a IndexError if the index in invalid
unicode_getitem() reuses PyUnicode_ReadChar()
2011-10-02 00:25:40 +02:00
Victor Stinner 202b62bd90 PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown 2011-10-01 23:48:37 +02:00
Victor Stinner 07ac3ebd7b Optimize unicode_subtype_new(): don't encode to wchar_t and decode from wchar_t
Rewrite unicode_subtype_new(): allocate directly the right type.
2011-10-01 16:16:43 +02:00
Victor Stinner e90fe6a8f4 Add _PyUnicode_UTF8() and _PyUnicode_UTF8_LENGTH() macros
* Rename existing _PyUnicode_UTF8() macro to PyUnicode_UTF8()
 * Rename existing _PyUnicode_UTF8_LENGTH() macro to PyUnicode_UTF8_LENGTH()
 * PyUnicode_UTF8() and PyUnicode_UTF8_LENGTH() are more strict
2011-10-01 16:48:13 +02:00
Martin v. Löwis 0b1d348990 Issue 13085: Fix some memory leaks. Patch by Stefan Krah. 2011-10-01 16:35:40 +02:00
Benjamin Peterson 5c0fb00ad8 merge heads 2011-10-01 00:12:20 -04:00
Benjamin Peterson 31616ea2ff remove reference to non-existent file 2011-10-01 00:11:09 -04:00
Victor Stinner de636f3c34 PyUnicode_Substring() now accepts end bigger than string length
Fix also a bug: call PyUnicode_READY() before reading string length.
2011-10-01 03:55:54 +02:00
Victor Stinner c759f3e7ec Ooops, avoid a division by zero in unicode_repeat() 2011-10-01 03:09:58 +02:00
Victor Stinner d3a83d5eb3 PyUnicode_FromObject() ensures that its output is a ready string 2011-10-01 03:09:33 +02:00
Victor Stinner 67ca64ce54 I want a super fast 'a' * n!
* Optimize unicode_repeat() for a special case with memset()
 * Simplify integer overflow checking; remove the second check because
   PyUnicode_New() already does it and uses a smaller limit (Py_ssize_t vs
   size_t)
2011-10-01 02:47:29 +02:00
Victor Stinner e9a2935c1f Fix usage of PyUnicode_READY in unicodeobject.c 2011-10-01 02:14:59 +02:00
Victor Stinner 12bab6dace Remove private substring() function, reuse public PyUnicode_Substring()
* PyUnicode_Substring() now fails if start or end is invalid
 * PyUnicode_Substring() reuses PyUnicode_Copy() for non-exact strings
2011-10-01 01:53:49 +02:00
Victor Stinner c841e7db1f Optimize PyUnicode_Copy(): don't recompute maximum character 2011-10-01 01:34:32 +02:00
Victor Stinner 2219e0a37e PyUnicode_FromObject() reuses PyUnicode_Copy()
* PyUnicode_Copy() is faster than substring()
 * Fix also a compiler warning
2011-10-01 01:16:59 +02:00
Victor Stinner 034f6cf10c Add PyUnicode_Copy() function, include it to the public API 2011-09-30 02:26:44 +02:00
Victor Stinner b153615008 PyUnicode_CopyCharacters() uses exceptions instead of assertions
Call PyErr_BadInternalCall() if inputs are not unicode strings.
2011-09-30 02:26:10 +02:00
Victor Stinner d8f6510acc _PyUnicode_Ready() cannot be used on ready strings anymore
* Change its prototype: PyObject* instead of PyUnicodeoObject*.
 * Remove an old assertion, the result of PyUnicode_READY (_PyUnicode_Ready)
   must be checked instead
2011-09-29 19:43:17 +02:00
Victor Stinner bc8b81bc4e Move _PyUnicode_UTF8() and _PyUnicode_UTF8_LENGTH() outside unicodeobject.h
Move these macros to unicodeobject.c
2011-09-29 19:31:34 +02:00
Victor Stinner a0702ab1fe Add a note in PyUnicode_CopyCharacters() doc: it doesn't write null character
Cleanup also the code (avoid the goto).
2011-09-29 14:14:38 +02:00
Victor Stinner 6430fd56b4 Fix hex_digit_to_int() prototype: expect Py_UCS4, not Py_UNICODE 2011-09-29 04:02:13 +02:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Victor Stinner b9dcffb51e Fix 'c' format of PyUnicode_Format()
formatbuf is now an array of Py_UCS4, not of Py_UNICODE
2011-09-29 00:39:24 +02:00
Victor Stinner c17f540b7a Oops, fix my previous commit: unicode => to 2011-09-29 00:16:58 +02:00
Victor Stinner b15d4d899c PyUnicode_CopyCharacters() marks the string as dirty (reset the hash) 2011-09-28 23:59:20 +02:00
Victor Stinner f5ca1a21a5 PyUnicode_CopyCharacters() fails if 'to' has more than 1 reference 2011-09-28 23:54:59 +02:00
Ezio Melotti 2aa2b3b4d5 Clean up a few tabs that went in with PEP393. 2011-09-29 00:58:57 +03:00
Ezio Melotti 48a2f8fd97 #13054: sys.maxunicode is now always 0x10FFFF. 2011-09-29 00:18:19 +03:00
Victor Stinner 506f592769 Check size of wchar_t using the preprocessor 2011-09-28 22:34:18 +02:00
Victor Stinner 73f01c65c8 PyUnicode_CopyCharacters() initializes overflow 2011-09-28 22:28:04 +02:00
Victor Stinner e57b1c0da1 Mark PyUnicode_FromUCS[124] as private 2011-09-28 22:20:48 +02:00
Victor Stinner ff9e50fd04 Oops, fix Py_MIN/Py_MAX case 2011-09-28 22:17:19 +02:00
Victor Stinner 17222160e7 Mark _PyUnicode_FindMaxCharAndNumSurrogatePairs() as private 2011-09-28 22:15:37 +02:00
Victor Stinner 157f83fcfc Strip trailing spaces in unicodeobject.[ch] 2011-09-28 21:41:31 +02:00
Victor Stinner 6c7a52a46f Check for PyUnicode_CopyCharacters() failure 2011-09-28 21:39:17 +02:00
Victor Stinner be78eaf2de PyUnicode_CopyCharacters() checks for buffer and character overflow
It now returns the number of written characters on success.
2011-09-28 21:37:03 +02:00
Victor Stinner fb5f5f2420 Mark PyUnicode_CONVERT_BYTES as private 2011-09-28 21:39:49 +02:00
Georg Brandl 4cb0de246c Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY"). 2011-09-28 21:49:49 +02:00
Benjamin Peterson 9c6e6a0c7f don't check that the first character is XID_Continue
Current, XID_Continue is a superset of XID_Start, but that may sometime change.
2011-09-28 08:09:05 -04:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Mark Dickinson c7d93b7614 Issue #1621: Fix undefined behaviour from signed overflow in datetime module hashes, array and list iterations, and get_integer (stringlib/string_format.h) 2011-09-25 15:34:32 +01:00
Mark Dickinson 36f27c995a Issue #1621: Fix undefined behaviour from signed overflow in get_integer (stringlib/formatter.h) 2011-09-24 19:11:53 +01:00
Mark Dickinson 57e683e53e Issue #1621: Fix undefined behaviour in bytes.__hash__, str.__hash__, tuple.__hash__, frozenset.__hash__ and set indexing operations. 2011-09-24 18:18:40 +01:00
Mark Dickinson 0d5f6adbb3 Issue #13012: Allow 'keepends' to be passed as a keyword argument in str.splitlines, bytes.splitlines and bytearray.splitlines. 2011-09-24 09:14:39 +01:00
Mark Dickinson 8f53d092f2 Merge issue #12973 list_repeat fix. 2011-09-19 19:19:50 +01:00
Mark Dickinson c0420fd42a Issue #12973: Fix undefined-behaviour-inducing overflow check in list_repeat. 2011-09-19 19:18:37 +01:00
Stefan Krah 2d78a87e2e Merge fix for issue #12963. 2011-09-12 16:24:48 +02:00
Stefan Krah b77c6c65c0 Issue #12963: PyLong_AsSize_t() now returns (size_t)-1 in all error cases. 2011-09-12 16:22:47 +02:00
Nadeem Vawda 3d5881ec2b Issue #12909: Make PyLong_As* functions consistent in their use of exceptions.
PyLong_AsDouble() and PyLong_AsUnsignedLongLong() now raise TypeError (rather
than SystemError) when passed a non-integer argument, matching the behavior of
all the other PyLong_As*() functions.
2011-09-07 21:40:26 +02:00
Victor Stinner f955eb210f Merge 3.2: Fix PyUnicode_AsWideCharString() doc
- Fix PyUnicode_AsWideCharString() doc: size doesn't contain the null
   character
 - Fix spelling of the null character
2011-09-06 02:01:29 +02:00
Victor Stinner d88d9836c5 Fix PyUnicode_AsWideCharString() doc: size doesn't contain the null character
Fix also spelling of the null character.
2011-09-06 02:00:05 +02:00
Benjamin Peterson e35dc5110f merge 3.2 2011-09-01 16:33:56 -04:00
Benjamin Peterson eff61f6927 make sure to initialize the method wrapper type 2011-09-01 16:32:31 -04:00
Ezio Melotti 6f2a683a0c #9200: merge with 3.2. 2011-08-22 20:31:11 +03:00
Ezio Melotti 93e7afc5d9 #9200: The str.is* methods now work with strings that contain non-BMP characters even in narrow Unicode builds. 2011-08-22 14:08:38 +03:00
Antoine Pitrou 8fd544ffa9 Issue #12791: Break reference cycles early when a generator exits with an exception. 2011-08-20 14:18:25 +02:00
Antoine Pitrou a370fcf3b2 Issue #12791: Break reference cycles early when a generator exits with an exception. 2011-08-20 14:15:03 +02:00
Benjamin Peterson e518d4c18a merge 3.2 2011-08-18 13:52:19 -05:00
Benjamin Peterson 7a6b44ab62 the named of the character is actually NUL 2011-08-18 13:51:47 -05:00
Benjamin Peterson 020340f284 merge 3.2 2011-08-18 10:49:16 -05:00
Benjamin Peterson 5ad517a7d9 NUL -> NULL 2011-08-18 10:48:50 -05:00
Benjamin Peterson 01fc6cd056 make __doc__ mutable on heaptypes (closes #12773) 2011-08-17 12:03:47 -05:00
Benjamin Peterson d9f23d2004 factor out common checks for setting special type attributes 2011-08-17 11:54:03 -05:00
Benjamin Peterson d17cefc787 crush other possible refleaks in this section 2011-08-16 22:28:23 -05:00
Benjamin Peterson 3e6267e704 merge 3.2 2011-08-16 22:27:42 -05:00
Benjamin Peterson ae13c88d8d fix possible refleaks 2011-08-16 22:26:48 -05:00
Benjamin Peterson c4085c8470 complain when a class variable shadows a name in __slots__ (closes #12766) 2011-08-16 18:53:26 -05:00
Ezio Melotti 269e3ee3db #12266: merge with 3.2. 2011-08-15 09:26:28 +03:00
Ezio Melotti ee8d998ecf #12266: Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased non-letter characters. 2011-08-15 09:09:57 +03:00
Benjamin Peterson f8e7543df9 merge 3.2 (#12732) 2011-08-12 22:18:19 -05:00
Benjamin Peterson f413b80806 in narrow builds, make sure to test codepoints as identifier characters (closes #12732)
This fixes the use of Unicode identifiers outside the BMP in narrow builds.
2011-08-12 22:17:18 -05:00
Brian Curtin dfc80e3d97 Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
The macro was introduced in #12724.
2011-08-10 20:28:54 -05:00
Victor Stinner ab1d16b456 Issue #13093: Fix error handling on PyUnicode_EncodeDecimal()
* Add tests for PyUnicode_EncodeDecimal() and PyUnicode_TransformDecimalToASCII()
 * Remove the unused "e" variable in replace()
2011-11-22 01:45:37 +01:00
Benjamin Peterson ecb3bd93ff merge 3.2 2011-07-29 22:44:51 -05:00
Benjamin Peterson 43a976e3d9 remove duplicated type ready 2011-07-29 22:44:42 -05:00
Benjamin Peterson 18d7d7a217 also make NotImplementedType callable 2011-07-29 18:27:44 -05:00
Benjamin Peterson c4607aeedd make the types of None and Ellipsis callable 2011-07-29 18:19:43 -05:00
Raymond Hettinger 66d2be8986 Issue 12647: Add __bool__() method to the None object. 2011-07-28 09:55:13 -07:00
Senthil Kumaran fcdaaa9011 merge from 3.2 - Fix closes Issue12621 - Fix docstrings of find and rfind methods of bytes/bytearry/unicodeobject. 2011-07-27 23:34:29 +08:00
Senthil Kumaran 53516a82df Fix closes Issue12621 - Fix docstrings of find and rfind methods of bytes/bytearry/unicodeobject. 2011-07-27 23:33:54 +08:00
Eric V. Smith c12469df22 Merge from 3.2. 2011-07-18 14:08:55 -04:00
Eric V. Smith 12ebefc9d3 Closes #12579. Positional fields with str.format_map() now raise a ValueError instead of SystemError. 2011-07-18 14:03:41 -04:00
Antoine Pitrou 9b43b6e14e Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
2011-07-15 21:18:18 +02:00
Antoine Pitrou ff35050493 Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
2011-07-15 21:17:14 +02:00
Antoine Pitrou 8cdc40e3b0 Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
2011-07-15 21:15:07 +02:00
Antoine Pitrou 093c8e4bf0 Issue #12149: Update the method cache after a type's dictionnary gets
cleared by the garbage collector.  This fixes a segfault when an instance
and its type get caught in a reference cycle, and the instance's
deallocator calls one of the methods on the type (e.g. when subclassing
IOBase).

Diagnosis and patch by Davide Rizzo.
2011-07-12 21:58:39 +02:00
Antoine Pitrou 84f1b1718d Issue #12149: Update the method cache after a type's dictionnary gets
cleared by the garbage collector.  This fixes a segfault when an instance
and its type get caught in a reference cycle, and the instance's
deallocator calls one of the methods on the type (e.g. when subclassing
IOBase).

Diagnosis and patch by Davide Rizzo.
2011-07-12 21:57:15 +02:00
Victor Stinner 99b9538636 Issue #9642: Uniformize the tests on the availability of the mbcs codec
Add a new HAVE_MBCS define.
2011-07-04 14:23:54 +02:00
Senthil Kumaran bc9d8f838b merge from 3.2 2011-07-03 21:05:25 -07:00
Senthil Kumaran 9ebe08d2f6 Fix closes issue12471 - wrong TypeError message when '%i' format spec was used. 2011-07-03 21:03:16 -07:00
Benjamin Peterson f07c9a1e69 this is expressed better as a for loop 2011-07-03 17:23:22 -05:00
Senthil Kumaran 31877c9d0e merge from 3.2 2011-06-27 09:07:14 -07:00
Senthil Kumaran 84e3ccc48d Fix closes Issue12385 - Clarify maketrans method docstring for bytes and bytearray object. 2011-06-27 09:06:45 -07:00
Benjamin Peterson 9003760991 map cells to arg slots at code creation time (closes #12399)
This removes nested loops in PyEval_EvalCodeEx.
2011-06-25 22:54:45 -05:00
Benjamin Peterson f5ff22329b use a invalid name for the __class__ closure for super() (closes #12370)
This prevents the assignment of __class__ in the class body from breaking
super. (Although a determined person could do locals()["@__class__"] = 4)
2011-06-19 19:42:22 -05:00
Benjamin Peterson 722954a3d3 quaint and completely out of date comment 2011-06-11 16:33:35 -05:00
Benjamin Peterson 3bbb722654 allow __dir__ to return any sequence 2011-06-11 16:12:08 -05:00
Benjamin Peterson 8c6f88efa2 remove __version__s dependent on subversion keyword expansion (closes #12221) 2011-05-31 20:52:17 -05:00
Victor Stinner f2a94216de Close #10616: mention bytes and bytearray in PyObject_AsCharBuffer() error
message
2011-05-30 23:21:30 +02:00
Victor Stinner 4f2dab5c33 Revert my commit 7ba176c2f558: "Avoid useless "++" at the end of functions
Warnings found by the Clang Static Analyzer."

Most people prefer ++ at the end of functions.
2011-05-27 16:46:51 +02:00
Victor Stinner 92236e5651 SystemExit_init(): avoid an useless test
Make silent a false positive of the Clang Static Analyzer.
2011-05-26 14:25:54 +02:00
Victor Stinner a1a807b6ef set_repr(): handle correctly PyUnicode_FromUnicode() error (MemoryError)
Bug found by the Clang Static Analyzer.
2011-05-26 14:24:30 +02:00
Victor Stinner 97e561ef24 Avoid useless "++" at the end of functions
Warnings found by the Clang Static Analyzer.
2011-05-26 13:53:47 +02:00
Benjamin Peterson c7284122be indicate return value on __dir__ methods 2011-05-24 12:46:15 -05:00
Benjamin Peterson 1fdcf0e4b1 merge 3.2 2011-05-24 12:45:33 -05:00
Benjamin Peterson 17658a1ca0 merge 3.1 2011-05-24 12:44:26 -05:00
Benjamin Peterson fbe56bb8bd use '->' to indicate return values 2011-05-24 12:42:51 -05:00
Benjamin Peterson 82b00c1d30 move specialized dir implementations into __dir__ methods (closes #12166) 2011-05-24 11:09:06 -05:00
Benjamin Peterson 5cc10b0009 merge 3.2 2011-05-23 16:27:36 -05:00
Benjamin Peterson f5fcd33be9 merge 3.1 2011-05-23 16:22:42 -05:00
Benjamin Peterson 7963a35b41 correctly lookup __dir__ 2011-05-23 16:11:05 -05:00
Daniel Stutzbach eda70b81d3 #11335: Fix memory leak after key function failure in sort 2011-05-04 12:46:28 -07:00
Antoine Pitrou 6f26be09e0 Issue #11849: Make it more likely for the system allocator to release
free()d memory arenas on glibc-based systems.  Patch by Charles-François
Natali.
2011-05-03 18:18:59 +02:00
Victor Stinner 6a534e7e7b (Merge 3.2) Issue #9756: When calling a method descriptor or a slot wrapper
descriptor, the check of the object type doesn't read the __class__ attribute
anymore.  Fix a crash if a class override its __class__ attribute (e.g. a proxy
of the str type).
2011-05-01 23:33:06 +02:00
Victor Stinner d9561318d8 (Merge 3.1) Issue #9756: When calling a method descriptor or a slot wrapper
descriptor, the check of the object type doesn't read the __class__ attribute
anymore.  Fix a crash if a class override its __class__ attribute (e.g. a proxy
of the str type).
2011-05-01 23:31:36 +02:00
Victor Stinner 3249dec024 Issue #9756: When calling a method descriptor or a slot wrapper descriptor, the
check of the object type doesn't read the __class__ attribute anymore.  Fix a
crash if a class override its __class__ attribute (e.g. a proxy of the str
type).
2011-05-01 23:19:15 +02:00
Victor Stinner 3cbf14bfb1 Issue #10914: Initialize correctly the filesystem codec when creating a new
subinterpreter to fix a bootstrap issue with codecs implemented in Python, as
the ISO-8859-15 codec.

Add fscodec_initialized attribute to the PyInterpreterState structure.
2011-04-27 00:24:21 +02:00
Victor Stinner 793b531756 Issue #10914: Initialize correctly the filesystem codec when creating a new
subinterpreter to fix a bootstrap issue with codecs implemented in Python, as
the ISO-8859-15 codec.

Add fscodec_initialized attribute to the PyInterpreterState structure.
2011-04-27 00:24:21 +02:00
Ezio Melotti bf1253b25a #6780: merge with 3.2. 2011-04-26 06:45:24 +03:00
Ezio Melotti f2b3f780a1 #6780: merge with 3.1. 2011-04-26 06:40:59 +03:00
Ezio Melotti ba42fd5801 #6780: fix starts/endswith error message to mention that tuples are accepted too. 2011-04-26 06:09:45 +03:00
Jesus Cea 2fc8b87499 Port 5b607cd8c71b (closes #11892) 2011-04-20 22:26:57 +02:00
Jesus Cea c1ceb64e41 MERGE: startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828) 2011-04-20 17:59:29 +02:00
Jesus Cea 6159ee3cf5 MERGE: startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828) 2011-04-20 17:42:50 +02:00
Jesus Cea ac4515063c startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828) 2011-04-20 17:09:23 +02:00
Ezio Melotti a15f614a0c #11845: Merge with 3.2. 2011-04-15 08:19:32 +03:00
Ezio Melotti 982ef4e0bc #11845: Fix typo in rangeobject.c that caused a crash in compute_slice_indices. Patch by Daniel Urban. 2011-04-15 08:15:40 +03:00
Ross Lagerwall 02ba73c0ef Merge with 3.1 2011-04-05 15:48:47 +02:00
Éric Araujo be3bd57ba2 Remove traces of division_warning left over from Python 2 (#10998) 2011-03-26 01:55:15 +01:00
Eli Bendersky 1aef6b6e1e Issue #11634: Remove misleading paragraph from a comment 2011-03-24 22:32:56 +02:00
Éric Araujo 83e7a2b7db Merge from 3.2 2011-03-23 04:52:45 +01:00
Éric Araujo bbcfc1f2d9 Merge from 3.1.
The fix was already committed to 3.2, but I merged two small changes
recommended by Raymond while I was working on the 2.7 patch to ease
future merges.
2011-03-23 03:43:22 +01:00
Éric Araujo 48049911d6 Fix obscure set crashers (#8420). Backport of d56b3cafb1e6, reviewed by Raymond. 2011-03-23 02:08:07 +01:00
Victor Stinner 0a5f65ab0a Issue #7330, #10833: Replace %100s by %.100s and %200s by %.200s
I suppose that the author would like to truncate the type name, not get a
string of 100/200 characters.
2011-03-22 01:09:21 +01:00
Victor Stinner 6ced7c4333 Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
2011-03-21 18:15:42 +01:00
Victor Stinner 44afe2b35a Issue #10833: Remove the buffer allocated on the stack, it isn't used anymore 2011-03-21 18:10:02 +01:00
Victor Stinner 499dfcf29d Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of
PyOS_snprintf().
2011-03-21 13:26:24 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Ezio Melotti b88ed1549e #11565: Merge with 3.2. 2011-03-16 11:38:59 +02:00
Ezio Melotti 373089239b #11515: Merge with 3.2. 2011-03-15 06:03:08 +02:00
Jesus Cea 736e7fc0f6 Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2 2011-03-14 17:36:54 +01:00
Eric V. Smith b9cd3531c4 Issue 9856: Change object.__format__ with a non-empty format string from a PendingDeprecationWarning to a DeprecationWarning. 2011-03-12 10:08:48 -05:00
Antoine Pitrou 16c4ce1903 Issue #9935: Speed up pickling of instances of user-defined classes. 2011-03-11 21:30:43 +01:00
Benjamin Peterson 5fd4bd3796 avoid casting with this nice macro 2011-03-06 09:06:34 -06:00
Victor Stinner 0639b56672 Issue #3080: Add PyModule_NewObject() function 2011-03-04 12:57:07 +00:00
Eli Bendersky e0c8635d89 Merged revisions 88735 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88735 | eli.bendersky | 2011-03-04 06:55:25 +0200 (Fri, 04 Mar 2011) | 2 lines

  Issue #11386: Fixed the exception thrown by bytearray.pop() for empty bytearrays
........
2011-03-04 05:10:57 +00:00
Eli Bendersky 1bc4f193d8 Issue #11386: Fixed the exception thrown by bytearray.pop() for empty bytearrays 2011-03-04 04:55:25 +00:00
Eli Bendersky 4db28d3343 Issue #10516: added copy() and clear() methods to bytearrays as well 2011-03-03 18:21:02 +00:00
Daniel Stutzbach 8eda5f7cd9 #11335: Fix memory leak when a sort key function throws an exception 2011-03-02 23:37:50 +00:00
Victor Stinner 2f283c2c19 Fix my previous commit (r88709) for str.encode(errors=...) 2011-03-02 01:21:46 +00:00
Victor Stinner a5c68c3cb7 Issue #8923: cache str.encode() result
When a string is encoded to UTF-8 in strict mode, the result is cached into the
object. Examples: str.encode(), str.encode('utf-8'), PyUnicode_AsUTF8String()
and PyUnicode_AsEncodedString(unicode, "utf-8", NULL).
2011-03-02 01:03:14 +00:00
Victor Stinner f3fd733f92 Remove useless argument of _PyUnicode_AsDefaultEncodedString() 2011-03-02 01:03:11 +00:00
Victor Stinner 6d970f4713 Issue #10831: PyUnicode_FromFormat() supports %li, %lli and %zi formats 2011-03-02 00:04:25 +00:00
Victor Stinner e7faec1aa9 Fix my previous commit (r88702): initialize size_tflag in parse_format_flags() 2011-03-02 00:01:53 +00:00
Victor Stinner 968654515f Issue #10829: Refactor PyUnicode_FromFormat()
* Use the same function to parse the format string in the 3 steps
 * Fix crashs on invalid format strings
2011-03-01 23:44:09 +00:00
Victor Stinner 2b574a2332 Merged revisions 88697 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88697 | victor.stinner | 2011-03-01 23:46:52 +0100 (mar., 01 mars 2011) | 4 lines

  Issue #11246: Fix PyUnicode_FromFormat("%V")

  Decode the byte string from UTF-8 (with replace error handler) instead of
  ISO-8859-1 (in strict mode). Patch written by Ray Allen.
........
2011-03-01 22:48:49 +00:00
Victor Stinner 2512a8b62e Issue #11246: Fix PyUnicode_FromFormat("%V")
Decode the byte string from UTF-8 (with replace error handler) instead of
ISO-8859-1 (in strict mode). Patch written by Ray Allen.
2011-03-01 22:46:52 +00:00
Alexander Belopolsky 4001847a98 PEP 7 conformance changes (whitespace only). 2011-02-26 01:02:56 +00:00
Alexander Belopolsky 1d52146a25 Issue #11303: Added shortcuts for utf8 and latin1 encodings.
Documented the list of optimized encodings as CPython implementation
detail.
2011-02-25 19:19:57 +00:00
Georg Brandl f6c8fd62b9 Merged revisions 86537,86867-86868,86881,86887,86913-86915,86931-86933,86960,86964,86974,86980,86996,87008,87050 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r86537 | georg.brandl | 2010-11-19 23:09:04 +0100 (Fr, 19 Nov 2010) | 1 line

  Do not put a raw REPLACEMENT CHARACTER in the document.
........
  r86867 | georg.brandl | 2010-11-29 15:50:54 +0100 (Mo, 29 Nov 2010) | 1 line

  Fix indentation bug.
........
  r86868 | georg.brandl | 2010-11-29 15:53:15 +0100 (Mo, 29 Nov 2010) | 1 line

  Fix heading style inconsistencies.
........
  r86881 | georg.brandl | 2010-11-30 08:43:28 +0100 (Di, 30 Nov 2010) | 1 line

  #10584: fix bad links.
........
  r86887 | georg.brandl | 2010-11-30 15:57:54 +0100 (Di, 30 Nov 2010) | 1 line

  Fix typo.
........
  r86913 | georg.brandl | 2010-12-01 16:32:43 +0100 (Mi, 01 Dez 2010) | 1 line

  Add missing word, and add a better reference to the actual function.
........
  r86914 | georg.brandl | 2010-12-01 16:36:33 +0100 (Mi, 01 Dez 2010) | 1 line

  #10594: fix parameter names in PyList API docs.
........
  r86915 | georg.brandl | 2010-12-01 16:44:25 +0100 (Mi, 01 Dez 2010) | 1 line

  Fix some markup and style in the unittest docs.
........
  r86931 | georg.brandl | 2010-12-02 10:06:12 +0100 (Do, 02 Dez 2010) | 1 line

  Fix-up documentation of makedirs().
........
  r86932 | david.malcolm | 2010-12-02 17:41:00 +0100 (Do, 02 Dez 2010) | 2 lines

  Fix spelling of Jamie Zawinski's surname in urllib.parse docstring (issue 10606)
........
  r86933 | georg.brandl | 2010-12-02 19:02:01 +0100 (Do, 02 Dez 2010) | 1 line

  #10597: fix Py_SetPythonHome docs by pointing to where the meaning of PYTHONHOME is already documented.
........
  r86960 | georg.brandl | 2010-12-03 08:55:44 +0100 (Fr, 03 Dez 2010) | 1 line

  #10360: catch TypeError in WeakSet.__contains__, just like WeakKeyDictionary does.
........
  r86964 | georg.brandl | 2010-12-03 10:58:38 +0100 (Fr, 03 Dez 2010) | 1 line

  #10549: fix interface of docclass() for text documenter.
........
  r86974 | georg.brandl | 2010-12-03 16:30:09 +0100 (Fr, 03 Dez 2010) | 1 line

  Markup consistency fixes.
........
  r86980 | georg.brandl | 2010-12-03 18:19:27 +0100 (Fr, 03 Dez 2010) | 1 line

  Fix punctuation.
........
  r86996 | georg.brandl | 2010-12-03 20:56:42 +0100 (Fr, 03 Dez 2010) | 1 line

  Fix indentation.
........
  r87008 | georg.brandl | 2010-12-04 10:04:04 +0100 (Sa, 04 Dez 2010) | 1 line

  Fix typo.
........
  r87050 | georg.brandl | 2010-12-04 18:09:30 +0100 (Sa, 04 Dez 2010) | 1 line

  Fix typo.
........
2011-02-25 09:48:21 +00:00
Eli Bendersky cbbaa96036 Issue #10516: adding list.clear() and list.copy() methods 2011-02-25 05:47:53 +00:00
Antoine Pitrou 915605c59a Merged revisions 88550 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88550 | antoine.pitrou | 2011-02-24 21:50:49 +0100 (jeu., 24 févr. 2011) | 4 lines

  Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
  a buffer struct having a NULL data pointer.
........
2011-02-24 20:53:48 +00:00
Antoine Pitrou 5bffa79c22 Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
a buffer struct having a NULL data pointer.
2011-02-24 20:50:49 +00:00
Victor Stinner 659eb84457 Merged revisions 88481 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88481 | victor.stinner | 2011-02-21 22:13:44 +0100 (lun., 21 févr. 2011) | 4 lines

  Fix PyUnicode_FromFormatV("%c") for non-BMP char

  Issue #10830: Fix PyUnicode_FromFormatV("%c") for non-BMP characters on
  narrow build.
........
2011-02-23 12:14:22 +00:00
Victor Stinner bd475115c4 Issue #3080: Add PyModule_GetNameObject()
repr(module) uses %R to format module name and filenames, instead of '%s' and
'%U', so surrogates from undecodable bytes in a filename (PEP 383) are escaped.
2011-02-23 00:21:43 +00:00
Brett Cannon b94767ff44 Issue #8914: fix various warnings from the Clang static analyzer v254. 2011-02-22 20:15:44 +00:00
Victor Stinner 5ed8b2c737 Fix PyUnicode_FromFormatV("%c") for non-BMP char
Issue #10830: Fix PyUnicode_FromFormatV("%c") for non-BMP characters on
narrow build.
2011-02-21 21:13:44 +00:00
Victor Stinner fd34b3788f Remove bootstrap code of PyUnicode_AsEncodedString()
Issue #11187: Remove bootstrap code (use ASCII) of
PyUnicode_AsEncodedString(), it was replaced by a better fallback (use
the locale encoding) in PyUnicode_EncodeFSDefault().

Prepare also empty sections in NEWS.
2011-02-21 20:51:28 +00:00
Martin v. Löwis 7be5b78b4f Merged revisions 88456 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88456 | martin.v.loewis | 2011-02-21 17:24:00 +0100 (Mo, 21 Feb 2011) | 2 lines

  - Check for NULL result in PyType_FromSpec.
........
2011-02-21 16:26:47 +00:00
Martin v. Löwis 5e06a5d4cd - Check for NULL result in PyType_FromSpec. 2011-02-21 16:24:00 +00:00
Georg Brandl 032400b2d8 #11249: in PyType_FromSpec, copy tp_doc slot since it usually will point to a static string literal which should not be deallocated together with the type. 2011-02-19 21:47:02 +00:00
Martin v. Löwis cc7e23ac15 Issue #11134: Add missing fields to typeslots.h.
Reviewed by Georg Brandl.
2011-02-11 20:50:24 +00:00
Martin v. Löwis 738236dbd6 Issue #11067: Add PyType_GetFlags, to support PyUnicode_Check
in the limited ABI
2011-02-05 20:35:29 +00:00
Eric Smith a1eac7218b Issue #11302: missing type check on _string.formatter_field_name_split and _string.formatter_parser caused crash.
Originial patch by haypo, reviewed by me, okayed by Georg.
2011-01-29 11:15:35 +00:00
Antoine Pitrou 566facd39b Merged revisions 88097 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88097 | antoine.pitrou | 2011-01-18 19:57:52 +0100 (mar., 18 janv. 2011) | 4 lines

  Issue #10451: memoryview objects could allow to mutate a readable buffer.
  Initial patch by Ross Lagerwall.
........
2011-01-18 19:06:09 +00:00
Antoine Pitrou ad62b03949 Issue #10451: memoryview objects could allow to mutate a readable buffer.
Initial patch by Ross Lagerwall.
2011-01-18 18:57:52 +00:00
Benjamin Peterson 32a8fe8b56 Merged revisions 88069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88069 | benjamin.peterson | 2011-01-17 13:54:55 -0600 (Mon, 17 Jan 2011) | 1 line

  remove unneeded assertion
........
2011-01-17 20:03:01 +00:00
Benjamin Peterson 37b9e46a04 remove unneeded assertion 2011-01-17 19:54:55 +00:00
Benjamin Peterson d82f45b720 Merged revisions 88066 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88066 | benjamin.peterson | 2011-01-17 13:44:46 -0600 (Mon, 17 Jan 2011) | 1 line

  correct assertion
........
2011-01-17 19:46:48 +00:00
Benjamin Peterson 0dd5ca0882 correct assertion 2011-01-17 19:44:46 +00:00
Benjamin Peterson acd17591f5 Merged revisions 88063 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88063 | benjamin.peterson | 2011-01-17 13:24:34 -0600 (Mon, 17 Jan 2011) | 4 lines

  turn some checks into assertions, since they are implied by the caller

  Reviewed by Georg.
........
2011-01-17 19:36:44 +00:00
Benjamin Peterson 67641d25d4 turn some checks into assertions, since they are implied by the caller
Reviewed by Georg.
2011-01-17 19:24:34 +00:00
Matthias Klose 616667fbe8 rangeobject.c (compute_slice_indices): Make function static. 2011-01-16 20:57:01 +00:00
Benjamin Peterson 547d4859b9 plug reference leak 2011-01-13 04:22:54 +00:00
Benjamin Peterson a53d2acb3d Merged revisions 87960 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87960 | benjamin.peterson | 2011-01-12 12:56:07 -0600 (Wed, 12 Jan 2011) | 1 line

  use PyErr_SetString instead of PyErr_Format
........
2011-01-12 19:02:36 +00:00
Benjamin Peterson 23b628ed0b use PyErr_SetString instead of PyErr_Format 2011-01-12 18:56:07 +00:00
Benjamin Peterson de368717da Merged revisions 87952-87954 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87952 | benjamin.peterson | 2011-01-12 09:24:27 -0600 (Wed, 12 Jan 2011) | 1 line

  move this test to test_descr; it's not abc specific
........
  r87953 | benjamin.peterson | 2011-01-12 09:25:02 -0600 (Wed, 12 Jan 2011) | 1 line

  oops, wrong class
........
  r87954 | benjamin.peterson | 2011-01-12 09:34:01 -0600 (Wed, 12 Jan 2011) | 1 line

  don't segfault on deleting __abstractmethods__ #10892
........
2011-01-12 15:42:34 +00:00
Benjamin Peterson 477ba919c1 don't segfault on deleting __abstractmethods__ #10892 2011-01-12 15:34:01 +00:00
Nick Coghlan e993b10041 Issue 10889: Support slicing and indexing of large ranges (no docs changes, since, as far as I know, we never said anywhere that this *didn't* work) 2011-01-12 03:15:52 +00:00
Antoine Pitrou 5b6fc63998 Merged revisions 87834 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87834 | antoine.pitrou | 2011-01-07 22:43:59 +0100 (ven., 07 janv. 2011) | 5 lines

  Issue #8020: Avoid a crash where the small objects allocator would read
  non-Python managed memory while it is being modified by another thread.
  Patch by Matt Bandy.
........
2011-01-07 21:49:25 +00:00
Antoine Pitrou b7fb2e25fb Issue #8020: Avoid a crash where the small objects allocator would read
non-Python managed memory while it is being modified by another thread.
Patch by Matt Bandy.
2011-01-07 21:43:59 +00:00
Martin v. Löwis 189c091612 Drop bf_getbuffer/bf_releasebuffer from stable ABI,
see #10181.
2011-01-06 19:28:31 +00:00
Martin v. Löwis b30111f29e Support comment lines and missing indices in typeslots.h. 2011-01-06 19:26:21 +00:00
Victor Stinner aaa4e9a438 Remove arbitrary string length limits
PyUnicode_FromFormat() and PyErr_Format() allocates a buffer of the needed
size, it is no more a fixed-buffer of 500 bytes.
2011-01-05 03:33:26 +00:00
Victor Stinner dc5554008f Issue #9015, #9611: stdprinter.write() clamps the length to 2^31-1 on Windows 2011-01-04 13:15:39 +00:00
Victor Stinner 0fcab4a3ed Issue #9566: use Py_ssize_t instead of int 2011-01-04 12:59:15 +00:00
Alexander Belopolsky b9cc00caab Removed unneeded #include 2010-12-22 02:35:20 +00:00
Ezio Melotti 9d254f7092 Merged revisions 87368 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87368 | ezio.melotti | 2010-12-18 15:59:43 +0100 (Sat, 18 Dec 2010) | 1 line

  #5587: add a repr to dict_proxy objects.  Patch by David Stanek and Daniel Urban.
........
2010-12-18 15:06:45 +00:00
Ezio Melotti ac53ab64a6 #5587: add a repr to dict_proxy objects. Patch by David Stanek and Daniel Urban. 2010-12-18 14:59:43 +00:00
R. David Murray 800dfee91a Merged revisions 87251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87251 | r.david.murray | 2010-12-14 18:06:25 -0500 (Tue, 14 Dec 2010) | 4 lines

  #4236: avoid possible Fatal Error when import is called from __del__

  Patch by Simon Cross, crasher test code by Martin von Löwis.
........
2010-12-14 23:30:42 +00:00
R. David Murray ce4b170c5a #4236: avoid possible Fatal Error when import is called from __del__
Patch by Simon Cross, crasher test code by Martin von Löwis.
2010-12-14 23:06:25 +00:00
Benjamin Peterson 28a4dce6a8 remove (un)transform methods 2010-12-12 01:33:04 +00:00
Alexander Belopolsky 532d091d05 Reverted accidental commit (from r87159) 2010-12-10 18:14:16 +00:00
Alexander Belopolsky fc55789cae Updated UCD version and unicode.org links to Unicode 6.0.0 2010-12-10 18:11:24 +00:00
Benjamin Peterson 9b955de76f use the more direct API 2010-12-07 04:04:02 +00:00
Benjamin Peterson 0eb7f86320 return views from dict proxy items/values/keys #10630 2010-12-07 03:46:27 +00:00
Georg Brandl f3fa5685e8 Fix typo. 2010-12-04 17:09:30 +00:00
Eric Smith 70099a1555 Removed static function complex_format, moved it into complex_repr. Modified tests to check both str and repr, which are the same for complex. 2010-12-04 13:27:34 +00:00
Mark Dickinson 7b1bee47ae Use copysign to produce appropriately signed zeros instead of trying to worm around possible compiler optimizations. 2010-12-04 13:14:29 +00:00
Mark Dickinson 0169af1534 Merged revisions 87032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87032 | mark.dickinson | 2010-12-04 12:25:30 +0000 (Sat, 04 Dec 2010) | 3 lines

  Issue #10596: Fix float.__mod__ to have the same behaviour as
  float.__divmod__ with respect to signed zeros.
........
2010-12-04 13:04:18 +00:00
Mark Dickinson 33154388f9 Backout broken backport. (Sorry.) 2010-12-04 12:42:18 +00:00
Mark Dickinson 11e77ffcbc Merged revisions 87032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87032 | mark.dickinson | 2010-12-04 12:25:30 +0000 (Sat, 04 Dec 2010) | 3 lines

  Issue #10596: Fix float.__mod__ to have the same behaviour as
  float.__divmod__ with respect to signed zeros.
........
2010-12-04 12:38:19 +00:00
Mark Dickinson d2a9b20efa Issue #10596: Fix float.__mod__ to have the same behaviour as
float.__divmod__ with respect to signed zeros.
2010-12-04 12:25:30 +00:00
Mark Dickinson 66f2623fb2 Remove some unecessary '#ifdef Py_NAN's from floatobject.c 2010-12-04 11:52:58 +00:00
Mark Dickinson c9fb3c6417 Fix indentation in Objects/longobject.c 2010-12-04 11:06:25 +00:00
Martin v. Löwis da72231c9f Regenerate. 2010-12-04 09:12:14 +00:00
Martin v. Löwis 81c9b45905 Add Revision keyword. 2010-12-04 09:11:41 +00:00
Martin v. Löwis 35f08f0f84 Make script 2-vs-3-agnostic. 2010-12-04 09:08:10 +00:00
Alexander Belopolsky 942af5a9a4 Issue #10557: Fixed error messages from float() and other numeric
types.  Added a new API function, PyUnicode_TransformDecimalToASCII(),
which transforms non-ASCII decimal digits in a Unicode string to their
ASCII equivalents.
2010-12-04 03:38:46 +00:00
Martin v. Löwis 4d0d471a80 Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
Victor Stinner f961377e99 #6780: fix complex() constructor TypeError message 2010-12-03 16:51:33 +00:00
Nick Coghlan 37ee850b10 Issue 2690: Add support for slicing and negative indices to range objects (includes precalculation and storage of the range length).
Refer to the tracker issue for the language moratorium implications of this change
2010-12-03 14:26:13 +00:00
Georg Brandl 3b9406b08a Remove redundant check for PyBytes in unicode_encode. 2010-12-03 07:54:09 +00:00
Benjamin Peterson 9efdccae25 code style 2010-12-03 01:44:10 +00:00
Daniel Stutzbach 98338227a7 Issue9915: speeding up sorting with a key 2010-12-02 21:55:33 +00:00
Georg Brandl 02524629f3 #7475: add (un)transform method to bytes/bytearray and str, add back codecs that can be used with them from Python 2. 2010-12-02 18:06:51 +00:00
Antoine Pitrou 715f3cd10d Issue #8685: Speed up set difference `a - b` when source set `a` is
much larger than operand `b`.  Patch by Andrew Bennetts.
2010-11-30 22:23:20 +00:00
Georg Brandl e5b99f0fb3 Remove redundant includes of headers that are already included by Python.h. 2010-11-30 09:41:01 +00:00
Georg Brandl 71c23d4473 Include structseq.h in Python.h, and remove now-redundant includes in individual sources. 2010-11-30 09:30:54 +00:00
Stefan Krah 5d744a8855 Merged revisions 86791 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86791 | stefan.krah | 2010-11-26 11:54:09 +0100 (Fri, 26 Nov 2010) | 1 line

  Indentation cleanup.
........
2010-11-26 11:07:04 +00:00
Stefan Krah 735bb12b01 Indentation cleanup. 2010-11-26 10:54:09 +00:00
Eric Smith 984bb58000 Issue #7094: Add alternate ('#') flag to __format__ methods for float, complex and Decimal. Allows greater control over when decimal points appear. Added to make transitioning from %-formatting easier. '#g' still has a problem with Decimal which I'll fix soon. 2010-11-25 16:08:06 +00:00
Benjamin Peterson a1864f3717 pep 7 actually wants the brace on a new line 2010-11-20 23:05:39 +00:00
Benjamin Peterson 155614b104 code style and simplification 2010-11-20 22:44:32 +00:00
Georg Brandl 7e5343b882 Add error handling in range_count. 2010-11-20 22:40:10 +00:00
Benjamin Peterson 0b458d52f9 count() should return integers #10474 2010-11-20 22:35:41 +00:00
Benjamin Peterson 72288d4f3c code style 2010-11-20 17:21:08 +00:00
R. David Murray 6bb9989ae3 #1574217: only swallow AttributeErrors in isinstance, not everything.
Patch and tests by Brian Harring, with improvements by Ralf Schmitt.
2010-11-20 16:33:30 +00:00
Benjamin Peterson f609654b0e handle dict subclasses gracefully in PyArg_ValidateKeywordArguments 2010-11-17 22:33:12 +00:00
Victor Stinner 3e2b7171bf Issue #10359: Remove ";" after function definition, invalid in ISO C 2010-11-09 09:32:19 +00:00
Victor Stinner d5af0a5df0 PyUnicode_DecodeFSDefaultAndSize() raises MemoryError if _Py_char2wchar() fails 2010-11-08 23:34:29 +00:00
Victor Stinner 2f02a51135 PyUnicode_EncodeFS() raises an exception if _Py_wchar2char() fails
* Add error_pos optional argument to _Py_wchar2char()
 * PyUnicode_EncodeFS() raises a UnicodeEncodeError or MemoryError if
   _Py_wchar2char() fails
2010-11-08 22:43:46 +00:00
Victor Stinner c911bbfd5d str, bytes, bytearray docstring: remove unnecessary [...] 2010-11-07 19:04:46 +00:00
Victor Stinner e14e212221 Fix encode/decode method doc of str, bytes, bytearray types
* Specify the default encoding: write 'utf-8' instead of
   sys.getdefaultencoding(), because the default encoding is now constant
 * Specify the default errors value
2010-11-07 18:41:46 +00:00
Eric Smith 16562f41b0 Merged revisions 86277 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86277 | eric.smith | 2010-11-06 15:27:37 -0400 (Sat, 06 Nov 2010) | 1 line

  Added more to docstrings for str.format, format_map, and __format__.
........
2010-11-06 19:29:45 +00:00
Eric Smith 51d2fd983b Added more to docstrings for str.format, format_map, and __format__. 2010-11-06 19:27:37 +00:00
David Malcolm 9696088b6d Issue #10288: The deprecated family of "char"-handling macros
(ISLOWER()/ISUPPER()/etc) have now been removed: use Py_ISLOWER() etc
instead.
2010-11-05 17:23:41 +00:00
Antoine Pitrou a277ec4ad9 Followup to r86170: fix reference leak in str.format 2010-11-05 12:23:55 +00:00
Antoine Pitrou aeb6ceead7 Issue #10293: Remove obsolete field in the PyMemoryView structure,
unused undocumented value PyBUF_SHADOW, and strangely-looking code in
PyMemoryView_GetContiguous.
2010-11-04 20:30:33 +00:00
Eric Smith 27bbca6f79 Issue #6081: Add str.format_map. str.format_map(mapping) is similar to str.format(**mapping), except mapping does not get converted to a dict. 2010-11-04 17:06:58 +00:00
Benjamin Peterson 83473288a8 deuglify 2010-11-03 23:11:10 +00:00
Raymond Hettinger 7529afce3c Issue 10221: Improve error message for dict.pop(). 2010-10-30 08:14:53 +00:00
Raymond Hettinger dd4215483f Issue 10221: Improve error message for dict.pop(). 2010-10-30 08:10:29 +00:00
Antoine Pitrou 98e2b45297 Merged revisions 85896 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85896 | antoine.pitrou | 2010-10-29 00:56:58 +0200 (ven., 29 oct. 2010) | 4 lines

  Issue #5437: A preallocated MemoryError instance should not hold traceback
  data (including local variables caught in the stack trace) alive infinitely.
........
2010-10-28 23:06:57 +00:00
Antoine Pitrou 07e20ef50b Issue #5437: A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
2010-10-28 22:56:58 +00:00
Victor Stinner ad15872854 Simplify PyUnicode_Encode/DecodeFSDefault on Windows/Mac OS X
* Windows always uses mbcs
 * Mac OS X always uses utf-8
2010-10-27 00:25:46 +00:00
Georg Brandl 08be72d0aa Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,
except when configured --with-pydebug.

Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
2010-10-24 15:11:22 +00:00
Antoine Pitrou fbb1c6191c Follow up to #9778: fix regressions on 64-bit Windows builds 2010-10-23 17:37:54 +00:00
Benjamin Peterson 8035bc5c04 follow up to #9778: define and use an unsigned hash type 2010-10-23 16:20:50 +00:00
Antoine Pitrou ff150f2921 Revert r85797 (and r85798): it broke the Windows buildbots because of
test_multiprocessing's misbehaviour.
2010-10-22 21:41:05 +00:00
Antoine Pitrou 7eecffd05d Issue #9935: Speed up pickling of instances of user-defined classes. 2010-10-22 19:43:59 +00:00
Victor Stinner f933e1ab6f Issue #4388: On Mac OS X, decode command line arguments from UTF-8, instead of
the locale encoding. If the LANG (and LC_ALL and LC_CTYPE) environment variable
is not set, the locale encoding is ISO-8859-1, whereas most programs (including
Python) expect UTF-8. Python already uses UTF-8 for the filesystem encoding and
to encode command line arguments on this OS.
2010-10-20 22:58:25 +00:00
Victor Stinner 9a90900da5 PyUnicode_FromFormatV(): Fix %A format
It was not completly implemented. Add a test.
2010-10-18 20:59:24 +00:00
Georg Brandl 00da4e0b5a Remove unneeded casts to hashfunc. 2010-10-18 07:32:48 +00:00
Benjamin Peterson e7dfeeb889 -1 is reserved for errors 2010-10-17 21:27:01 +00:00
Benjamin Peterson e6baa46aab fix prototype 2010-10-17 21:20:58 +00:00
Benjamin Peterson 8f67d0893f make hashes always the size of pointers; introduce Py_hash_t #9778 2010-10-17 20:54:53 +00:00
Benjamin Peterson 23d05c1d98 use helper hash unimplemented function 2010-10-17 20:13:05 +00:00
Georg Brandl ded5acf34a Merged revisions 81936 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r81936 | mark.dickinson | 2010-06-12 11:10:14 +0200 (Sa, 12 Jun 2010) | 2 lines

  Silence 'unused variable' gcc warning.  Patch by Éric Araujo.
........
2010-10-17 11:48:07 +00:00
Victor Stinner 168e117e0a Add an optional size argument to _Py_char2wchar()
_Py_char2wchar() callers usually need the result size in characters. Since it's
trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add
an option to get it.
2010-10-16 23:16:16 +00:00
Georg Brandl 6c6a4d0249 Remove unused label. 2010-10-15 16:23:54 +00:00
Victor Stinner f3170ccef8 Use locale encoding if Py_FileSystemDefaultEncoding is not set
* PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and
   PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if
   Py_FileSystemDefaultEncoding is NULL
 * redecode_filenames() functions and _Py_code_object_list (issue #9630)
   are no more needed: remove them
2010-10-15 12:04:23 +00:00
Georg Brandl 66c221e993 #9418: first step of moving private string methods to _string module. 2010-10-14 07:04:07 +00:00
Benjamin Peterson 582162e42b Merged revisions 85392 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85392 | benjamin.peterson | 2010-10-12 17:57:59 -0500 (Tue, 12 Oct 2010) | 1 line

  prefer clearing global objects to obscure module.__dict__ bugs #10068
........
2010-10-12 23:06:22 +00:00
Benjamin Peterson 5c4bfc4af0 prefer clearing global objects to obscure module.__dict__ bugs #10068 2010-10-12 22:57:59 +00:00
Martin v. Löwis baecd7243a Upgrade to Unicode 6.0.0.
makeunicodedata.py: download all data files from unicode.org,
  switch to extracting Unihan data from zip file.
  Read linebreakprops and derivednormalizationprops even for
  old versions, even though they are not used in delta records.
test:unicode.py: U+11000 is now assigned, use U+14000 instead.
2010-10-11 22:42:28 +00:00
Victor Stinner beb4135b8c PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the
prototype for the new function PyUnicode_AsWideCharString().
2010-10-07 01:02:42 +00:00
Benjamin Peterson 866c74e3d6 Merged revisions 85193 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85193 | benjamin.peterson | 2010-10-02 21:13:39 -0500 (Sat, 02 Oct 2010) | 1 line

  typo
........
2010-10-03 02:19:18 +00:00
Benjamin Peterson 84060b81e3 typo 2010-10-03 02:13:39 +00:00
Benjamin Peterson 0ad44fa3f7 Merged revisions 85154,85182 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85154 | benjamin.peterson | 2010-10-01 19:03:31 -0500 (Fri, 01 Oct 2010) | 1 line

  type.__abstractmethods__ should raise an AttributeError #10006
........
  r85182 | benjamin.peterson | 2010-10-02 12:55:47 -0500 (Sat, 02 Oct 2010) | 1 line

  add a test and a note about metaclasses now being abcs
........
2010-10-02 18:04:55 +00:00
Victor Stinner 5593d8aeb4 Issue #8670: PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() replace
UTF-16 surrogate pairs by single non-BMP characters for 16 bits Py_UNICODE
and 32 bits wchar_t (eg. Linux in narrow build).
2010-10-02 11:11:27 +00:00
Victor Stinner 1c24bd0252 Issue #8870: PyUnicode_AsWideCharString() doesn't count the trailing nul character
And write unit tests for PyUnicode_AsWideChar() and PyUnicode_AsWideCharString().
2010-10-02 11:03:13 +00:00
Benjamin Peterson aec5fd1397 type.__abstractmethods__ should raise an AttributeError #10006 2010-10-02 00:03:31 +00:00
Victor Stinner 71e91a358b Fix PyUnicode_AsWideCharString(): set *size if size is not NULL 2010-09-29 17:55:12 +00:00
Victor Stinner c39211f51e Issue #9630: Redecode filenames when setting the filesystem encoding
Redecode the filenames of:

 - all modules: __file__ and __path__ attributes
 - all code objects: co_filename attribute
 - sys.path
 - sys.meta_path
 - sys.executable
 - sys.path_importer_cache (keys)

Keep weak references to all code objects until initfsencoding() is called, to
be able to redecode co_filename attribute of all code objects.
2010-09-29 16:35:47 +00:00
Victor Stinner 137c34c027 Issue #9979: Create function PyUnicode_AsWideCharString(). 2010-09-29 10:25:54 +00:00
Mark Dickinson a67c70d4a9 Merged revisions 84984 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84984 | mark.dickinson | 2010-09-23 21:11:19 +0100 (Thu, 23 Sep 2010) | 5 lines

  Issue #9930: Remove an unnecessary type check in wrap_binaryfunc_r;
  this was causing reversed method calls like float.__radd__(3.0, 1) to
  return NotImplemented instead of the expected numeric value.
........
2010-09-23 20:16:03 +00:00
Mark Dickinson b09a3d69a6 Issue #9930: Remove an unnecessary type check in wrap_binaryfunc_r;
this was causing reversed method calls like float.__radd__(3.0, 1) to
return NotImplemented instead of the expected numeric value.
2010-09-23 20:11:19 +00:00
Daniel Stutzbach 9f0cbf1c72 Issue #9213: Add index and count methods to range objects, needed to
meet the API of the collections.Sequence ABC.
2010-09-13 21:16:29 +00:00
Eric Smith e4d6317c87 Issue 7994: Make object.__format__() raise a PendingDeprecationWarning
if the format string is not empty. Manually merge r79596 and r84772
from 2.x.

Also, apparently test_format() from test_builtin never made it into
3.x. I've added it as well. It tests the basic format()
infrastructure.
2010-09-13 20:48:43 +00:00
Amaury Forgeot d'Arc feb7307db4 #9210: remove --with-wctype-functions configure option.
The internal unicode database is now always used.

(after 5 years: see
  http://mail.python.org/pipermail/python-dev/2004-December/050193.html
)
2010-09-12 22:42:57 +00:00
Benjamin Peterson d4ac96a336 use return NULL; it's just as correct 2010-09-12 16:40:53 +00:00
Victor Stinner 4c7db315df Issue #9738, #9836: Fix refleak introduced by r84704 2010-09-12 07:51:18 +00:00
Benjamin Peterson 9be0b2e312 detect non-ascii characters much earlier (plugs ref leak) 2010-09-12 03:40:54 +00:00
Benjamin Peterson 42bc69154f Merged revisions 84717 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84717 | benjamin.peterson | 2010-09-11 11:39:57 -0500 (Sat, 11 Sep 2010) | 1 line

  fix formatting
........
2010-09-11 16:40:47 +00:00
Benjamin Peterson 41ece39c21 fix formatting 2010-09-11 16:39:57 +00:00
Benjamin Peterson 8042f4af29 Merged revisions 84714 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84714 | benjamin.peterson | 2010-09-11 11:02:03 -0500 (Sat, 11 Sep 2010) | 1 line

  check for NULL tp_as_mapping in PySequence_(Get/Set/Del)Slice #9834
........
2010-09-11 16:03:33 +00:00
Benjamin Peterson 568867a6f2 check for NULL tp_as_mapping in PySequence_(Get/Set/Del)Slice #9834 2010-09-11 16:02:03 +00:00
Victor Stinner 1205f2774e Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
a non-ASCII byte in the format string.

Document also the encoding.
2010-09-11 00:54:47 +00:00
Antoine Pitrou 6e6cc830c4 Issue #9757: memoryview objects get a release() method to release the
underlying buffer (previously this was only done when deallocating the
memoryview), and gain support for the context management protocol.
2010-09-09 12:59:39 +00:00
Senthil Kumaran f77342076e Merged revisions 84629 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84629 | senthil.kumaran | 2010-09-08 18:20:29 +0530 (Wed, 08 Sep 2010) | 3 lines

  Revert the doc change done in r83880. str.replace with negative count value is not a feature.
........
2010-09-08 13:00:07 +00:00
Senthil Kumaran 9a9dd1c140 Revert the doc change done in r83880. str.replace with negative count value is not a feature. 2010-09-08 12:50:29 +00:00
Victor Stinner 46408606d8 Rename PyUnicode_strdup() to PyUnicode_AsUnicodeCopy() 2010-09-03 16:18:00 +00:00
Georg Brandl 2d444496b3 Reindent. 2010-09-03 10:52:55 +00:00
Raymond Hettinger faf7b7f4ec Issue 8420: Fix obscure set crashers. 2010-09-03 10:00:50 +00:00
Daniel Stutzbach 045b3ba184 Issue #9212: Added the missing isdisjoint method to the dict_keys and
dict_items views.  The method is required by the collections.Set ABC,
which the views register as supporting.
2010-09-02 15:06:06 +00:00
Daniel Stutzbach 928d4eeee8 Removed an extraneous semicolon 2010-09-02 15:06:03 +00:00
Victor Stinner 71133ff368 Create PyUnicode_strdup() function 2010-09-01 23:43:53 +00:00
Victor Stinner c4eb765fc1 Create Py_UNICODE_strcat() function 2010-09-01 23:43:50 +00:00
Antoine Pitrou f43f65b69f Merged revisions 84408-84409 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84408 | antoine.pitrou | 2010-09-01 23:14:16 +0200 (mer., 01 sept. 2010) | 4 lines

  Issue #9737: Fix a crash when trying to delete a slice or an item from
  a memoryview object.
........
  r84409 | antoine.pitrou | 2010-09-01 23:14:46 +0200 (mer., 01 sept. 2010) | 3 lines

  Fix a compilation warning
........
2010-09-01 21:16:10 +00:00
Antoine Pitrou c73b909a2b Fix a compilation warning 2010-09-01 21:14:46 +00:00
Antoine Pitrou e0793ba992 Issue #9737: Fix a crash when trying to delete a slice or an item from
a memoryview object.
2010-09-01 21:14:16 +00:00
Victor Stinner 42cb462682 Remove unicode_default_encoding constant
Inline its value in PyUnicode_GetDefaultEncoding(). The comment is now outdated
(we will not change its value anymore).
2010-09-01 19:39:01 +00:00
Antoine Pitrou fce7fd6426 Issue #9549: sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()
are now removed, since their effect was inexistent in 3.x (the default
encoding is hardcoded to utf-8 and cannot be changed).
2010-09-01 18:54:56 +00:00
Antoine Pitrou a2983c6734 Merged revisions 84394 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84394 | antoine.pitrou | 2010-09-01 17:10:12 +0200 (mer., 01 sept. 2010) | 4 lines

  Issue #7415: PyUnicode_FromEncodedObject() now uses the new buffer API
  properly.  Patch by Stefan Behnel.
........
2010-09-01 15:16:41 +00:00
Antoine Pitrou b0fa831d1e Issue #7415: PyUnicode_FromEncodedObject() now uses the new buffer API
properly.  Patch by Stefan Behnel.
2010-09-01 15:10:12 +00:00
Antoine Pitrou b83df8f1b7 Merged revisions 84391 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84391 | antoine.pitrou | 2010-09-01 14:58:21 +0200 (mer., 01 sept. 2010) | 5 lines

  Issue #3101: Helper functions _add_one_to_C() and _add_one_to_F() become
  _Py_add_one_to_C() and _Py_add_one_to_F(), respectively.
........
2010-09-01 13:01:35 +00:00
Antoine Pitrou f68c2a701b Issue #3101: Helper functions _add_one_to_C() and _add_one_to_F() become
_Py_add_one_to_C() and _Py_add_one_to_F(), respectively.
2010-09-01 12:58:21 +00:00
Antoine Pitrou fcd2a7960c Merged revisions 84344 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84344 | antoine.pitrou | 2010-08-28 20:17:03 +0200 (sam., 28 août 2010) | 4 lines

  Issue #1868: Eliminate subtle timing issues in thread-local objects by
  getting rid of the cached copy of thread-local attribute dictionary.
........
2010-08-28 18:27:09 +00:00
Antoine Pitrou 1a9a9d5433 Issue #1868: Eliminate subtle timing issues in thread-local objects by
getting rid of the cached copy of thread-local attribute dictionary.
2010-08-28 18:17:03 +00:00
Benjamin Peterson 039d0a00c8 Merged revisions 84320 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84320 | benjamin.peterson | 2010-08-25 18:13:17 -0500 (Wed, 25 Aug 2010) | 1 line

  basicsize and itemsize are Py_ssize_t #9688
........
2010-08-25 23:19:30 +00:00
Benjamin Peterson 0e10206f2c basicsize and itemsize are Py_ssize_t #9688 2010-08-25 23:13:17 +00:00
Daniel Stutzbach 8515eaefda Issue 8781: On systems a signed 4-byte wchar_t and a 4-byte Py_UNICODE, use memcpy to convert between the two (as already done when wchar_t is unsigned) 2010-08-24 21:57:33 +00:00
Benjamin Peterson 0538064554 reorder and save a comparison 2010-08-23 19:35:39 +00:00
Victor Stinner 3119ed73aa Fix PyUnicode_EncodeFSDefault() indentation 2010-08-18 22:26:50 +00:00
Amaury Forgeot d'Arc 324ac65ceb #5127: Even on narrow unicode builds, the C functions that access the Unicode
Database (Py_UNICODE_TOLOWER, Py_UNICODE_ISDECIMAL, and others) now accept
and return characters from the full Unicode range (Py_UCS4).

The differences from Python code are few:
- unicodedata.numeric(), unicodedata.decimal() and unicodedata.digit()
  now return the correct value for large code points
- repr() may consider more characters as printable.
2010-08-18 20:44:58 +00:00
Victor Stinner 6c00c1464f Issue #9425: Create PyModule_GetFilenameObject() function
... to get the filename as a unicode object, instead of a byte string. Function
needed to support unencodable filenames. Deprecate PyModule_GetFilename() in
favor on the new function.
2010-08-17 23:37:11 +00:00
Antoine Pitrou f72006f442 Merged revisions 84146-84147,84150 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84146 | antoine.pitrou | 2010-08-17 19:55:07 +0200 (mar., 17 août 2010) | 4 lines

  Issue #9612: The set object is now 64-bit clean under Windows.
........
  r84147 | antoine.pitrou | 2010-08-17 20:30:06 +0200 (mar., 17 août 2010) | 3 lines

  Fix <deque iterator>.__length_hint__() under 64-bit Windows.
........
  r84150 | antoine.pitrou | 2010-08-17 21:33:30 +0200 (mar., 17 août 2010) | 3 lines

  Clean some 64-bit issues. Also, always spell "ssize_t" "Py_ssize_t".
........
2010-08-17 19:39:39 +00:00
Antoine Pitrou 671b4d948e Issue #9612: The set object is now 64-bit clean under Windows. 2010-08-17 17:55:07 +00:00
Victor Stinner ef8d95c498 Issue #9425: Create Py_UNICODE_strncmp() function
The code is based on strncmp() of the libiberty library,
function in the public domain.
2010-08-16 22:03:11 +00:00
Alexander Belopolsky 102594f7ff Merged revisions 84106 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84106 | alexander.belopolsky | 2010-08-16 16:17:07 -0400 (Mon, 16 Aug 2010) | 1 line

  Issue #8983: Corrected docstrings.
........
2010-08-16 20:26:04 +00:00
Alexander Belopolsky 977a684c94 Issue #8983: Corrected docstrings. 2010-08-16 20:17:07 +00:00