Commit graph

4145 commits

Author SHA1 Message Date
Victor Stinner
d74782b0ac Close #14199: _PyType_Lookup() and super_getattro() keep a strong reference to
the type MRO to avoid a crash if the MRO is changed during the lookup.
2012-03-09 00:39:08 +01:00
Benjamin Peterson
9a6338651e merge 3.2 (#3787e896dbe9) 2012-03-07 18:52:52 -06:00
Benjamin Peterson
52c424343d allow cycles throught the __dict__ slot to be cleared (closes #1469629)
Patch from Armin, test from me.
2012-03-07 18:41:11 -06:00
Benjamin Peterson
657e9ebef5 make gi_running a boolean 2012-03-07 18:17:03 -06:00
Benjamin Peterson
9fc309083a indicate we're not running as we leave this block 2012-03-07 18:11:31 -06:00
Benjamin Peterson
099a78fe6d make delegating generators say they running (closes #14220) 2012-03-07 17:57:04 -06:00
Stefan Krah
4e14174e24 Whitespace. 2012-03-06 15:27:31 +01:00
Victor Stinner
0d03478b88 Remove an unused variable 2012-03-06 02:06:01 +01:00
Victor Stinner
198b291df7 Close #14205: dict lookup raises a RuntimeError if the dict is modified during
a lookup.

"if you want to make a sandbox on top of CPython, you have to fix segfaults"
so let's fix segfaults!
2012-03-06 01:03:13 +01:00
Stefan Krah
1e88f3faa6 Merge. 2012-03-05 17:48:21 +01:00
Stefan Krah
1649c1b33a Issue #14181: Preserve backwards compatibility for getbufferprocs that a) do
not adhere to the new documentation and b) manage to clobber view->obj before
returning failure.
2012-03-05 17:45:17 +01:00
Benjamin Peterson
400a968dfc remove f_yieldfrom access from Python (closes #13970) 2012-03-05 09:03:51 -06:00
Stefan Krah
4e99a315b7 Issue #14181: Allow memoryview construction from an object that uses the
getbuffer redirection scheme.
2012-03-05 09:30:47 +01:00
Victor Stinner
c9590ad745 Close #14085: remove assertions from PyUnicode_WRITE macro
Add checks in PyUnicode_WriteChar() and convert PyUnicode_New() assertion to a
test raising a Python exception.
2012-03-04 01:34:37 +01:00
Antoine Pitrou
70d2717f2e Issue #13521: dict.setdefault() now does only one lookup for the given key, making it "atomic" for many purposes.
Patch by Filip Gruszczyński.
2012-02-27 00:59:34 +01:00
Antoine Pitrou
e965d97ed1 Issue #13521: dict.setdefault() now does only one lookup for the given key, making it "atomic" for many purposes.
Patch by Filip Gruszczyński.
2012-02-27 00:45:12 +01:00
Nick Coghlan
ab7bf2143e Close issue #6210: Implement PEP 409 2012-02-26 17:49:52 +10:00
Ezio Melotti
cda6b6d60d #14081: The sep and maxsplit parameter to str.split, bytes.split, and bytearray.split may now be passed as keyword arguments. 2012-02-26 09:39:55 +02:00
Stefan Krah
9a2d99e28a - Issue #10181: New memoryview implementation fixes multiple ownership
and lifetime issues of dynamically allocated Py_buffer members (#9990)
  as well as crashes (#8305, #7433). Many new features have been added
  (See whatsnew/3.3), and the documentation has been updated extensively.
  The ndarray test object from _testbuffer.c implements all aspects of
  PEP-3118, so further development towards the complete implementation
  of the PEP can proceed in a test-driven manner.

  Thanks to Nick Coghlan, Antoine Pitrou and Pauli Virtanen for review
  and many ideas.

- Issue #12834: Fix incorrect results of memoryview.tobytes() for
  non-contiguous arrays.

- Issue #5231: Introduce memoryview.cast() method that allows changing
  format and shape without making a copy of the underlying memory.
2012-02-25 12:24:21 +01:00
Victor Stinner
6f73874edd Close #14095: type.__new__() doesn't remove __qualname__ key from the class
dict anymore if the key is present. Reject also non-string qualified names.
And fix reference leaks in type.__new__().
2012-02-25 01:22:36 +01:00
Victor Stinner
b0800dc53b Oops, revert unwanted changes 2012-02-25 00:47:08 +01:00
Victor Stinner
abc649ddbe Issue #14107: fix bigmem tests on str.capitalize(), str.swapcase() and
str.title(). Compute correctly how much memory is required for the test
(memuse).
2012-02-25 00:43:27 +01:00
Antoine Pitrou
842c0f17eb Fix compilation error under Windows (and warnings too). 2012-02-24 13:30:46 +01:00
Victor Stinner
90f50d4df9 Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF) 2012-02-24 01:44:47 +01:00
Victor Stinner
41a863cb81 Issue #13706: Fix format(int, "n") for locale with non-ASCII thousands separator
* Decode thousands separator and decimal point using PyUnicode_DecodeLocale()
   (from the locale encoding), instead of decoding them implicitly from latin1
 * Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used
 * Change _PyUnicode_InsertThousandsGrouping() API to return the maximum
   character if unicode is NULL
 * Replace MIN/MAX macros by Py_MIN/Py_MAX
 * stringlib/undef.h undefines STRINGLIB_IS_UNICODE
 * stringlib/localeutil.h only supports Unicode
2012-02-24 00:37:51 +01:00
Victor Stinner
b429d3b09c Fix doc of an internal function: unicode_write_cstr() 2012-02-22 21:22:20 +01:00
Antoine Pitrou
ba6bafcfbe Fix compile failure under Windows 2012-02-22 16:41:50 +01:00
Victor Stinner
c516610f0b Optimize str%arg for number formats: %i, %d, %u, %x, %p
Write a specialized function to write an ASCII/latin1 C char* string into a
Python Unicode string.
2012-02-22 13:55:02 +01:00
Victor Stinner
99d7ad0bb0 Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII() 2012-02-22 13:37:39 +01:00
Victor Stinner
da79e632c4 Micro-optimize unicode_expandtabs(): use FILL() macro to write N spaces 2012-02-22 13:37:04 +01:00
Victor Stinner
15e9ed299c PyUnicode_New() and unicode_putchar() check for MAX_UNICODE maximum (U+10FFFF) 2012-02-22 13:36:20 +01:00
Benjamin Peterson
d9a3591ed1 merge 3.2 2012-02-21 11:12:14 -05:00
Benjamin Peterson
e249dcab7a merge 3.2 2012-02-21 11:09:13 -05:00
Benjamin Peterson
69e9727657 ensure no one tries to hash things before the random seed is found 2012-02-21 11:08:50 -05:00
Benjamin Peterson
71f660e00f update to Unicode 6.1 2012-02-20 22:24:29 -05:00
Georg Brandl
16fa2a1097 Forgot the "empty string -> hash == 0" special case for strings. 2012-02-21 00:50:13 +01:00
Georg Brandl
2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl
09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl
2daf6ae249 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Benjamin Peterson
006c5a2235 check for NULL to fix segfault 2012-02-19 20:36:12 -05:00
Benjamin Peterson
23d7f12ffb use new generic __dict__ descriptor implementations 2012-02-19 20:02:57 -05:00
Benjamin Peterson
8eb1269c34 add generic implementation of a __dict__ descriptor for C types 2012-02-19 19:59:10 -05:00
Benjamin Peterson
b900d6a78c initialize __dict__ if needed 2012-02-19 10:17:30 -05:00
Benjamin Peterson
2cf936fe7a use defaults 2012-02-19 01:16:13 -05:00
Benjamin Peterson
84e821e961 merge 3.2 2012-02-19 01:14:21 -05:00
Benjamin Peterson
496c53d83e use Py_CLEAR 2012-02-19 01:11:56 -05:00
Benjamin Peterson
01d7eba316 allow arbitrary attributes on classmethod and staticmethod (closes #14051) 2012-02-19 01:10:25 -05:00
Antoine Pitrou
552be9b214 Issue #13020: Fix a reference leak when allocating a structsequence object fails.
Patch by Suman Saha.
2012-02-15 02:54:33 +01:00
Antoine Pitrou
4b3c7846c9 Fix indentation 2012-02-15 02:52:58 +01:00
Antoine Pitrou
37784ba5c0 Issue #13020: Fix a reference leak when allocating a structsequence object fails.
Patch by Suman Saha.
2012-02-15 02:51:43 +01:00