Commit Graph

3440 Commits

Author SHA1 Message Date
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
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
dd4215483f Issue 10221: Improve error message for dict.pop(). 2010-10-30 08:10:29 +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
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
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
84060b81e3 typo 2010-10-03 02:13:39 +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
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