Commit graph

2866 commits

Author SHA1 Message Date
Brett Cannon
dea1b5653f warnings.warn_explicit() did not have the proper TypeErrors in place to prevent
bus errors or SystemError being raised. As a side effect of fixing this, a bad
DECREF that could be triggered when 'message' and 'category' were both None was
fixed.

Closes issue 3211. Thanks JP Calderone for the bug report.
2008-06-27 00:31:13 +00:00
Raymond Hettinger
9c437af4eb Revert 64424, 64438, and 64439. 2008-06-24 22:46:07 +00:00
Eric Smith
65fe47b931 Modified interface to _Py_[String|Unicode]InsertThousandsGrouping, in anticipation of fixing issue 3140. 2008-06-24 00:42:10 +00:00
Raymond Hettinger
e3ae655edf Make bin() implementation parallel oct() and hex() so that int/long subclasses can override or so that other classes can support. 2008-06-20 04:18:15 +00:00
Raymond Hettinger
305480c9dc Issue 3116: fix quadratic behavior in marshal.dumps(). 2008-06-16 01:42:40 +00:00
Benjamin Peterson
114f7e5fff #1683 prevent forking from interfering in threading storage
This should prevent some test_multiprocessing failures
2008-06-13 00:09:47 +00:00
Gregory P. Smith
9d53457e59 Merge in release25-maint r60793:
Added checks for integer overflows, contributed by Google. Some are
 only available if asserts are left in the code, in cases where they
 can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Gregory P. Smith
dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Benjamin Peterson
f4fcdb6b8c warn about parameter tuple unpacking 2008-06-08 23:00:00 +00:00
Benjamin Peterson
d5efd20406 Warn about assigning to Py3k keywords (True and False) 2008-06-08 22:52:37 +00:00
Benjamin Peterson
cbd78133fa add an ast_warn helper function to make adding those Py3k warnings easier 2008-06-08 15:45:23 +00:00
Benjamin Peterson
2fe3ef8750 change Py3k backquote warning to a SyntaxWarning and add a test 2008-06-08 02:05:33 +00:00
Ronald Oussoren
5640ce2f1e MacOS X: Enable 4-way universal builds
This patch adds a new configure argument on OSX:
        --with-universal-archs=[32-bit|64-bit|all]

When used with the --enable-universalsdk option this controls which
CPU architectures are includes in the framework. The default is 32-bit,
meaning i386 and ppc. The most useful alternative is 'all', which includes
all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64).

This includes limited support for the Carbon bindings in 64-bit mode as well,
limited because (a) I haven't done extensive testing and (b) a large portion
of the Carbon API's aren't available in 64-bit mode anyway.

I've also duplicated a feature of Apple's build of python: setting the
environment variable 'ARCHFLAGS' controls the '-arch' flags used for building
extensions using distutils.
2008-06-05 12:58:24 +00:00
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