Commit Graph

2806 Commits

Author SHA1 Message Date
Benjamin Peterson 2c98faada6 check for assignment to __debug__ during AST generation
Also, give assignment to None a better error message
2008-11-08 18:38:54 +00:00
Benjamin Peterson dcee09d920 make sure the parser flags and passed onto the compiler
This fixes "from __future__ import unicode_literals" in an exec statment
See #4225
2008-10-31 02:16:05 +00:00
Benjamin Peterson 44a90c95ce move unprefixed error into .c file 2008-10-30 23:59:18 +00:00
Benjamin Peterson 399b1fe8df give a py3k warning when 'nonlocal' is used as a variable name 2008-10-25 02:53:28 +00:00
Benjamin Peterson aff36f1295 fix compiler warning 2008-10-19 13:59:01 +00:00
Armin Ronacher 35e01fbeaa Fixed #4067 by implementing _attributes and _fields for the AST root node. 2008-10-19 08:27:43 +00:00
Christian Heimes 32a66a0410 Fixed a couple more C99 comments and one occurence of inline. 2008-10-02 19:47:50 +00:00
Andrew MacIntyre f8db82242b any platform without HAVE_LOG1P should have DBL_EPSILON in <float.h>
Part of source_os2emx.patch in issue 3868
Reviewed by Amaury Forgeot d'Arc
2008-09-22 14:11:41 +00:00
Amaury Forgeot d'Arc 05e344954d #3743: PY_FORMAT_SIZE_T is designed for the OS "printf" functions, not for
PyString_FromFormat which has an independent implementation, and uses "%zd".

This makes a difference on win64, where printf needs "%Id" to display
64bit values. For example, queue.__repr__ was incorrect.

Reviewed by Martin von Loewis.
2008-09-10 22:04:45 +00:00
Brett Cannon 1eaf0742d8 Move test.test_support.catch_warning() to the warnings module, rename it
catch_warnings(), and clean up the API.

While expanding the test suite, a bug was found where a warning about the
'line' argument to showwarning() was not letting functions with '*args' go
without a warning.

Closes issue 3602.
Code review by Benjamin Peterson.
2008-09-02 01:25:16 +00:00
Benjamin Peterson 17f03ca962 Fix compilation when --without-threads is given #3683
Reviewer: Georg Brandl, Benjamin Peterson
2008-09-01 14:18:30 +00:00
Antoine Pitrou d4ae97bc38 #3668: When PyArg_ParseTuple correctly parses a s* format, but raises an
exception afterwards (for a subsequent parameter), the user code will
not call PyBuffer_Release() and memory will leak.

Reviewed by Amaury Forgeot d'Arc.
2008-08-29 18:39:48 +00:00
Antoine Pitrou 0668c62677 Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
mechanism. In the process, fix a bug where isinstance() and issubclass(),
when given a tuple of classes as second argument, were looking up
__instancecheck__ / __subclasscheck__ on the tuple rather than on each
type object.

Reviewed by Benjamin Peterson and Raymond Hettinger.
2008-08-26 22:42:08 +00:00
Neal Norwitz 18aa388ca0 Fix:
* crashes on memory allocation failure found with failmalloc
 * memory leaks found with valgrind
 * compiler warnings in opt mode which would lead to invalid memory reads
 * problem using wrong name in decimal module reported by pychecker

Update the valgrind suppressions file with new leaks that are small/one-time
leaks we don't care about (ie, they are too hard to fix).

TBR=barry
TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes)
  in opt mode:
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \
                        -x test_logging test_ssl test_multiprocessing
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
  for i in `seq 1 4000` ; do
    LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \
        ./python -c pass
  done

At least some of these fixes should probably be backported to 2.5.
2008-08-24 05:04:52 +00:00
Benjamin Peterson 80f0ed5bb1 allow keyword args to be passed in after *args #3473 2008-08-19 19:52:46 +00:00
Benjamin Peterson 08336e30ad follup to #3473: don't duplicate the reduce code 2008-08-18 02:01:21 +00:00
Benjamin Peterson 25f2d89f32 uhh PySTEntry->ste_unoptimized has to be exposed too 2008-08-17 02:23:43 +00:00
Benjamin Peterson e0d4c7b5bd expose PySTEntry.nested so the symtable module will work 2008-08-17 01:09:17 +00:00
Benjamin Peterson e0d12eb85c PySTEntry's constructor is static; there's no point in a fancy API name 2008-08-16 23:29:40 +00:00
Benjamin Peterson 0847332716 include filename and line number in SyntaxError 2008-08-16 22:11:33 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Brett Cannon 3aa2a49ec9 Add imp.reload(). This to help with transitioning to 3.0 the reload() built-in
has been removed there.
2008-08-06 22:28:09 +00:00
Gregory P. Smith d868be8805 Adds a sanity check to avoid a *very rare* infinite loop due to a corrupt tls
key list data structure in the thread startup path.

This change is a companion to r60148 which already successfully dealt with a
similar issue on thread shutdown.

In particular this loop has been observed happening from this call path:
 #0  in find_key ()
 #1  in PyThread_set_key_value ()
 #2  in _PyGILState_NoteThreadState ()
 #3  in PyThreadState_New ()
 #4  in t_bootstrap ()
 #5  in pthread_start_thread ()

I don't know how this happens but it does, *very* rarely.  On more than
one hardware platform.  I have not been able to reproduce it manually.
(A flaky mutex implementation on the system in question is one hypothesis).

As with r60148, the spinning we managed to observe in the wild was due to a
single list element pointing back upon itself.
2008-08-04 07:33:37 +00:00
Amaury Forgeot d'Arc 39fd672dfe #3479: unichr(2**32) used to return u'\x00'.
The argument was fetched in a long, but PyUnicode_FromOrdinal takes an int.

(why doesn't gcc issue a truncation warning in this case?)
2008-07-31 21:28:03 +00:00
Amaury Forgeot d'Arc 246daedd11 #2542: now that issubclass() may call arbitrary code,
make sure that PyErr_ExceptionMatches returns 0 when an exception occurs there.
2008-07-31 00:42:16 +00:00
Antoine Pitrou c2cc80c64e Raymond's patch for #1819: speedup function calls with named parameters
(35% faster according to pybench)
2008-07-25 22:13:52 +00:00
Georg Brandl 1ad108db05 #3378: in case of no memory, don't leak even more memory. :) 2008-07-19 10:08:55 +00:00
Eric Smith f032a00271 Fix issue 3411: default float format spec fails on negative numbers. 2008-07-19 00:24:05 +00:00
Jesse Noller 5e62ca4fea Apply patch for 874900: threading module can deadlock after fork 2008-07-16 20:03:47 +00:00
Mark Dickinson 64b7e501f4 Issue #3360: Fix incorrect parsing of "020000000000.0". 2008-07-16 09:40:03 +00:00
Nick Coghlan b028f50911 Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError when the parent module can't be found during an absolute import (likely due to non-PEP 361 aware code which sets a module level __package__ attribute) 2008-07-13 14:52:36 +00:00
Amaury Forgeot d'Arc 2252d11c08 #3342: In tracebacks, printed source lines were not indented since r62555.
#3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine.
2008-07-11 21:45:06 +00:00
Robert Schuppenies 4762902998 Added garbage collector overhead and optional default return value to
sys.getsizeof.
2008-07-10 17:13:55 +00:00
Robert Schuppenies d2cd86ddd5 Fixed Issue3122 and extended sys.getsizeof tests for built-in types. 2008-07-10 13:43:26 +00:00
Gregory P. Smith 2fe77060eb - Issue #2862: Make int and float freelist management consistent with other
freelists.  Changes their CompactFreeList apis into ClearFreeList apis and
  calls them via gc.collect().
2008-07-06 03:35:58 +00:00
Georg Brandl 3c0fd5616f Fix tabs. 2008-07-05 10:07:18 +00:00
Raymond Hettinger afae11ea88 Update comment on prediction macros. 2008-07-05 02:11:55 +00:00
Georg Brandl aa76d77e2b Add a comment about incref'ing w. 2008-07-01 20:56:03 +00:00
Amaury Forgeot d'Arc bdd941fac3 #3242: fix a crash in "print", if sys.stdout is set to a custom object,
whose write() method installs another sys.stdout.

Will backport.
2008-07-01 20:38:04 +00:00
Benjamin Peterson 175e4d9663 #3219 repeated keyword arguments aren't allowed in function calls anymore 2008-07-01 19:34:52 +00:00
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