Commit Graph

2753 Commits

Author SHA1 Message Date
Georg Brandl 7a6de8b0f4 Some style nits. Also clarify in the docstrings what __sizeof__ does. 2008-06-01 16:42:16 +00:00
Robert Schuppenies 51df064767 Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. 2008-06-01 16:16:17 +00:00
Martin v. Löwis 6495c8da8f Typo: encoding -> codeset. 2008-06-01 08:19:02 +00:00
Martin v. Löwis b12d8579e3 Move sys_stream and sys_isatty out of the have-langinfo block. 2008-06-01 08:06:17 +00:00
Martin v. Löwis 99815892f6 New environment variable PYTHONIOENCODING. 2008-06-01 07:20:46 +00:00
Eric Smith dc13b79a38 Refactor and clean up str.format() code (and helpers) in advance of optimizations. 2008-05-30 18:10:04 +00:00
Raymond Hettinger 65856600ed Issue 2784: fix leaks in exception exit. 2008-05-30 06:37:27 +00:00
Gregory P. Smith 933d3731de Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
passed in.  (The assert won't prevent this in non-debug builds).
2008-05-26 22:07:28 +00:00
Gregory P. Smith 23921f00e8 Fix issue2589: there was a potential integer overflow leading to
memory corruption on esoteric platforms and incorrect behavior on
normal platforms.
2008-05-26 21:16:34 +00:00
Benjamin Peterson dacde0d6ae turn PyErr_WarnPy3k into a macro 2008-05-26 17:43:53 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Christian Heimes 3497f94476 First step of the C API rename:
renamed Include/bytesobject.h to Include/bytearrayobject.h
renamed Include/stringobject.h to Include/bytesobject.h
added Include/stringobject.h with aliases
2008-05-26 12:29:14 +00:00
Martin v. Löwis 4dd019fde3 Patch #2488: Add sys.maxsize. 2008-05-20 08:11:19 +00:00
Benjamin Peterson c6d64ec83f revert 63425 over Guido's Febuary message about this, that I missed 2008-05-17 20:09:42 +00:00
Benjamin Peterson d7943cb71d fix spelling 2008-05-17 19:51:10 +00:00
Benjamin Peterson 79a922d6df add Py3k warnings to oct and hex. backport hex behavior (because it's not different) 2008-05-17 19:21:20 +00:00
Georg Brandl 9c5b51541c Fix a refleak in the _warnings module. 2008-05-13 21:32:03 +00:00
Benjamin Peterson b9030f4f0d #2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate 2008-05-12 00:41:23 +00:00
Eric Smith cf537ff39e Addresses issue 2802: 'n' formatting for integers.
Adds 'n' as a format specifier for integers, to mirror the same
specifier which is already available for floats.  'n' is the same as
'd', but inserts the current locale-specific thousands grouping.

I added this as a stringlib function, but it's only used by str type,
not unicode.  This is because of an implementation detail in
unicode.format(), which does its own str->unicode conversion.  But the
unicode version will be needed in 3.0, and it may be needed by other
code eventually in 2.6 (maybe decimal?), so I left it as a stringlib
implementation.  As long as the unicode version isn't instantiated,
there's no overhead for this.
2008-05-11 19:52:48 +00:00
Georg Brandl b52a74b517 #2816: clarify error messages for EOF while scanning strings. 2008-05-11 15:07:39 +00:00
Andrew M. Kuchling 6c02916dfb #1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
2008-05-11 13:33:56 +00:00
Brett Cannon be1501b976 Fix sys.flags to properly expose bytes_warning.
Closes issue #2790.
2008-05-08 20:23:06 +00:00
Christian Heimes af748c3ab8 Implemented PEP 370 2008-05-06 22:41:46 +00:00
Benjamin Peterson d295032910 Fix logic error in Python/_warnings.c and add a test to verify 2008-05-06 22:18:11 +00:00
Brett Cannon e3dcb01bfc Fix a bug in the handling of the stacklevel argument in warnings.warn() where
the stack was being unwound by two levels instead of one each time.
2008-05-06 04:37:31 +00:00
Brett Cannon 8a232cc385 Add a DeprecationWarning for when warnings.showwarning() is set to a function
that lacks support for the new 'line' argument.
2008-05-05 05:32:07 +00:00
Benjamin Peterson 2b30ea068f The compiling struct is now passed around to all AST helpers (see issue 2720) 2008-05-03 15:56:42 +00:00
Brett Cannon 64a4bbeb25 Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.

Closes issue2743.
2008-05-03 03:19:39 +00:00
Brett Cannon ab9cc1b7ad Fix some indentation errors. 2008-05-03 01:02:41 +00:00
Brett Cannon b457ddaff2 Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.

Closes issue 2705.
2008-05-02 02:25:09 +00:00
Georg Brandl 28e0873f1f #2719: backport next() from 3k. 2008-04-30 19:47:09 +00:00
Eric Smith 0a95063d73 Issue 2526, float.__format__ 'n' specifier does not support thousands grouping.
Implemented grouping, with tests.
Cleaned up PyOS_ascii_formatd by breaking reformatting into smaller functions.
2008-04-30 01:09:30 +00:00
Brett Cannon 141534e56f Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.

Closes issue #2699.
2008-04-28 03:23:50 +00:00
Benjamin Peterson f19a7b90bd A little reformating of Py3k warnings 2008-04-27 18:40:21 +00:00
Benjamin Peterson 9f4f48114f Use PyErr_WarnPy3k throughout 2008-04-27 03:01:45 +00:00
Benjamin Peterson a692c4df63 Added PyErr_WarnPy3k function. (issue 2671) I will be converting current Py3k warnings to the use of this function soon. 2008-04-27 02:28:02 +00:00
Christian Heimes 6f34109384 I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math.
The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
2008-04-18 23:13:07 +00:00
Benjamin Peterson 858a77099e Fix indentation in sysmodule.c 2008-04-18 20:45:33 +00:00
Amaury Forgeot d'Arc f9e7ebe165 Correct a refleak found by "regrtest.py -R:: test_structmembers"
Some other minor updates in _warnings.c:
- make a function static
- rename a shadowing local variable
2008-04-14 20:07:48 +00:00
Georg Brandl 41a0a37c08 Improve -X error message. 2008-04-13 20:50:29 +00:00
Benjamin Peterson 820b51c170 #2627 Let it be known what pgen generates 2008-04-13 20:35:56 +00:00
Christian Heimes 6715352848 Use PyString_InternFromString instead of PyString_FromString for static vars 2008-04-13 09:33:24 +00:00
Brett Cannon 40f0a87666 Fix a bug in PySys_HasWarnOption() where it was not properly checking the
length of the list storing the warning options.
2008-04-13 00:18:44 +00:00
Brett Cannon e974689038 Re-implement the 'warnings' module in C. This allows for usage of the
'warnings' code in places where it was previously not possible (e.g., the
parser). It could also potentially lead to a speed-up in interpreter start-up
if the C version of the code (_warnings) is imported over the use of the
Python version in key places.

Closes issue #1631171.
2008-04-12 23:44:07 +00:00
Christian Heimes 7a98d2730c Applied patch #2617 from Frank Wierzbicki wit some extras from me
-J and -X are now reserved for Jython and non-standard arguments (e.g. IronPython). I've added some extra comments to make sure the reservation don't get missed in the future.
2008-04-12 13:03:03 +00:00
Georg Brandl e34c21c2a0 Make AST nodes pickleable. 2008-03-30 20:20:39 +00:00
Georg Brandl 1721e75749 Fix error message -- "expects either 0 or 0 arguments" 2008-03-30 19:43:27 +00:00
Georg Brandl 2c55c597fa Make _fields attr for no fields consistent with _attributes attr. 2008-03-30 19:00:49 +00:00
Georg Brandl c52ed59473 #2505: allow easier creation of AST nodes. 2008-03-30 07:01:47 +00:00
Georg Brandl a48f3ab895 Patch #2511: Give the "excepthandler" AST item proper attributes by making it a Sum. 2008-03-30 06:40:17 +00:00