Commit Graph

4167 Commits

Author SHA1 Message Date
Kristján Valur Jónsson daa06544c8 Issue #14435: Remove special block allocation code from floatobject.c
PyFloatObjects are now allocated using PyObject_MALLOC like all other
internal types, but maintain a limited freelist of objects at hand for
performance.  This will result in more consistent memory usage by Python.
2012-03-30 09:18:15 +00:00
Victor Stinner 3c1e48176e Issue #14383: Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
2012-03-26 22:10:51 +02:00
Benjamin Peterson 0df542985a grammar 2012-03-26 14:50:32 -04:00
Benjamin Peterson c067d6661f merge 3.2 2012-03-25 22:41:16 -04:00
Benjamin Peterson a8755c586e kill this terribly outdated comment 2012-03-25 22:40:54 -04:00
Antoine Pitrou d0acb411ef Issue #14387: Do not include accu.h from Python.h. 2012-03-22 14:42:18 +01:00
Antoine Pitrou 0197ff97d0 Issue #14387: Do not include accu.h from Python.h. 2012-03-22 14:38:16 +01:00
Victor Stinner 59af08f545 Micro-optimize PyObject_GetAttrString()
w cannot be NULL so use Py_DECREF() instead of Py_XDECREF().
2012-03-22 02:09:08 +01:00
Benjamin Peterson 520e8508a0 long() -> int() 2012-03-21 14:51:14 -04:00
Benjamin Peterson b7f1da5a3c make _PyNumber_ConvertIntegralToInt static, since it's only used in abstract.c 2012-03-21 14:44:43 -04:00
Benjamin Peterson d614e707ca rewrite this function, which was still accounting for classic classes 2012-03-21 14:38:11 -04:00
Benjamin Peterson 1b1a8e7cb5 correctly lookup __trunc__ in int() constructor 2012-03-20 23:48:11 -04:00
Benjamin Peterson 9fc9bf465a some more identifier goodness 2012-03-20 23:26:41 -04:00
Benjamin Peterson 96384b93aa make extra arguments to object.__init__/__new__ to errors in most cases (finishes #1683368) 2012-03-17 00:05:44 -05:00
Benjamin Peterson 9a03ecfa50 simply this slightly 2012-03-16 20:15:54 -05:00
Benjamin Peterson de394543b4 merge 3.2 (#14334) 2012-03-16 09:35:38 -05:00
Benjamin Peterson 16d84ac355 check to make sure the attribute is a string (#14334) 2012-03-16 09:32:59 -05:00
Benjamin Peterson f50af113ab space 2012-03-15 15:37:54 -05:00
Benjamin Peterson 2afe6aeae8 perform yield from delegation by repeating YIELD_FROM opcode (closes #14230)
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.

Patch mostly from Mark Shannon with a few tweaks by me.
2012-03-15 15:37:39 -05:00
Victor Stinner ba108823b6 Close #14232: catch mmap() failure in new_arena() of obmalloc 2012-03-10 00:21:44 +01:00
Benjamin Peterson 74529ad3f4 refactor and avoid warnings 2012-03-09 07:25:32 -08:00
Victor Stinner 2d01dc00bc Issue #14211: _PyObject_GenericSetAttrWithDict() keeps a strong reference to
the descriptor because it may be destroyed before being used, destroyed during
the update of the dict for example.
2012-03-09 00:44:13 +01:00
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