Commit Graph

2951 Commits

Author SHA1 Message Date
Mark Dickinson bce783757f round(0, "ermintrude") succeeded instead of producing a TypeError. Fix this. 2009-11-24 10:54:58 +00:00
Benjamin Peterson cef9782810 turn goto into do while loop 2009-11-20 02:15:50 +00:00
Benjamin Peterson 009b89d22a genexps have linenos 2009-11-20 01:16:58 +00:00
Benjamin Peterson d16d0abf0b provide line number for lambdas 2009-11-20 01:15:53 +00:00
Benjamin Peterson 99a5023c80 improve several corner cases related with argument names in parenthesis
- Fix #7362: give a good error message for parenthesized arguments with
  defaults.

- Add a py3k warning for any parenthesized arguments since those are not allowed
  in Py3.  This warning is not given in tuple unpacking, since that incurs the
  tuple unpacking warning.
2009-11-19 22:54:57 +00:00
Mark Dickinson bd15a06fd3 Issue #7117, continued: Change round implementation to use the correctly-rounded
string <-> float conversions;  this makes sure that the result of the round
operation is correctly rounded, and hence displays nicely using the new float
repr.
2009-11-18 19:33:35 +00:00
Benjamin Peterson 90ed611f6d a better callable replacement 2009-11-17 21:24:54 +00:00
Mark Dickinson 51ae4921b3 Set retval on PyOS_string_to_double failure. 2009-10-31 12:47:47 +00:00
Mark Dickinson 504a151c82 Issue #6603: Fix --with-tsc build failures on x86-64 that resulted
from a gcc inline assembler peculiarity. (gcc's "A" constraint
apparently means 'rax or rdx' in 64-bit mode, not edx:eax
or rdx:rax as one might expect.)
2009-10-31 10:11:28 +00:00
Mark Dickinson 09823a2e21 Deprecate PyOS_ascii_strtod and PyOS_ascii_atof, and document the replacement function PyOS_string_to_double. 2009-10-31 09:42:39 +00:00
Benjamin Peterson ea0e3b0d60 do a backport of r75928
The added test does not fail without the patch, but we still fix the issue of
surrogates being used in wide builds where they should not be.
2009-10-29 01:49:07 +00:00
Eric Smith b218d289e6 Removed PyOS_ascii_atof from marshal.c, as mentioned in issue 7117. Also brings it more in line with py3k. 2009-10-27 19:42:57 +00:00
Eric Smith abc9f70381 Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117. 2009-10-27 18:33:14 +00:00
Eric Smith c1bdf89145 Finished removing _PyOS_double_to_string, as mentioned in issue 7117. 2009-10-26 17:46:17 +00:00
Mark Dickinson 975d7576ca Issue #7117 (backport py3k float repr) continued:
Backport pystrtod.c from py3k.
2009-10-26 15:39:50 +00:00
Mark Dickinson 0e0e215308 Warn against replacing PyNumber_Add with PyNumber_InPlaceAdd in sum 2009-10-26 14:18:44 +00:00
Mark Dickinson da8652d920 Issue #7117 (backport py3k float repr) continued:
Add sys.float_repr_style attribute ('short' if short float
repr is in used;  'legacy' otherwise).
2009-10-24 14:01:08 +00:00
Mark Dickinson 52462c3185 Remove temporary define from r75653 2009-10-24 13:31:41 +00:00
Mark Dickinson 1d6e2e1833 Issue #7117 (backport py3k float repr) continued:
- add double endianness detection to configure script
 - add configure-time check to see whether we can use inline
   assembly to get and set x87 control word in configure script
 - add functions to get and set x87 control word in Python/pymath.c
 - add pyport.h logic to determine whether it's safe to use the
   short float repr or not
2009-10-24 13:28:38 +00:00
Mark Dickinson fd42f30991 Temporary define to avoid build failure 2009-10-24 12:17:24 +00:00
Mark Dickinson bb28285ea2 Issue #7117: Prepare for backport of py3k float repr.
Add the Python/dtoa.c file containing the main algorithms;
add corresponding include file and include in Python.h;
include license information for Python/dtoa.c;
add dtoa.c and dtoa.h to Makefile.
2009-10-24 12:13:30 +00:00
Georg Brandl f4ffae2b2a #7035: improve docs of the various <method>_errors() functions, and give them docstrings. 2009-10-22 15:42:32 +00:00
Antoine Pitrou efb60c0ceb Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which
fixes the problem of some exceptions being thrown at shutdown when the
interpreter is killed. Patch by Adam Olsen.
2009-10-20 21:29:37 +00:00
Eric Smith 156692752d Removed calls to PyFloat_AsReprString.
This is in anticipation of possibly implementing issue 7117 (short float repr).
This removes the last calls to PyFloat_AsString, PyFloat_AsReprString, and
PyFloat_AsStringEx, which are unsafe.

Also, switch to defines for error values to bring this code more in line
with the py3k branch.
2009-10-19 00:34:12 +00:00
Mark Dickinson 026ac7cf69 Allow core Python build to succeed under WITHOUT_COMPLEX. The module build stage still fails. 2009-10-15 17:45:39 +00:00
Neil Schemenauer 7fdd1cb583 Issue #1754094: Improve the stack depth calculation in the compiler.
There should be no other effect than a small decrease in memory use.
Patch by Christopher Tur Lesniewski-Laas.
2009-10-14 17:17:14 +00:00
Benjamin Peterson 7adbb5a35d #7050 fix a SystemError when using tuple unpacking and augmented assignment 2009-10-03 20:23:24 +00:00
Mark Dickinson 7e7a3ec901 Issue #7019: Unmarshalling of bad long data could produce unnormalized
PyLongs.  Raise ValueError instead.
2009-09-29 19:01:06 +00:00
Thomas Wouters c4dcb3801e Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.

This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.

This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.

Will backport to 2.6, minus the tiny AIX behaviour change.
2009-09-16 19:55:54 +00:00
Benjamin Peterson 93ed82048f revert unintended changes 2009-09-09 11:42:57 +00:00
Benjamin Peterson 8246968b12 tabbify 2009-09-09 11:40:54 +00:00
Benjamin Peterson d692a71fdd revert r74699 since it loses useful error information 2009-09-07 13:02:15 +00:00
Benjamin Peterson 5515990ee1 PyObject_GetIter can set an error for its self just fine 2009-09-06 22:43:39 +00:00
Benjamin Peterson c0ba828857 better col_offsets for "for" statements with tuple unpacking #6704
Patch from Frank Wierzbicki.
2009-08-15 22:59:21 +00:00
Sean Reifscheider 9279e7d177 - Issue #6624: yArg_ParseTuple with "s" format when parsing argument with
NUL: Bogus TypeError detail string.
2009-08-01 23:54:55 +00:00
Amaury Forgeot d'Arc 982b2fa32d Better name a variable: 'buf' seems to imply a mutable buffer. 2009-07-25 16:22:06 +00:00
Benjamin Peterson 4879c907ce the Slice in x[::] has to have step as None to help the interpreter 2009-07-20 20:28:08 +00:00
Hirokazu Yamamoto e78e5d2e51 Issue #6415: Fixed warnings.warn sagfault on bad formatted string. 2009-07-17 06:20:46 +00:00
R. David Murray 3310a10a68 Update issue 6070 patch to match the patch that was actually tested
on Windows.
2009-07-07 09:54:16 +00:00
R. David Murray 23a736a4f0 Issue 6070: when creating a compiled file, after copying the mode bits, on
posix zap the execute bit in case it was set on the .py file, since the
compiled files are not directly executable on posix.  Patch by Marco N.
2009-07-07 01:06:13 +00:00
Benjamin Peterson 753d16234f when print() gets unicode arguments, sep and end should be unicode by default #4618 2009-07-02 18:16:45 +00:00
Benjamin Peterson 4a3cf191f4 small optimization: avoid popping the current block until we have to 2009-07-01 23:45:19 +00:00
Georg Brandl e323e0e91a Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint. 2009-06-29 14:44:49 +00:00
Alexandre Vassalotti 7274cffa9e Update docstrings for sys.getdlopenflags() and sys.setdlopenflags(). 2009-06-29 01:01:51 +00:00
Benjamin Peterson 8f7b94eae9 use stack macros 2009-06-28 16:14:07 +00:00
Benjamin Peterson b8338ab92c add two generic macros for peeking and setting in the stack 2009-06-28 16:08:02 +00:00
Benjamin Peterson 1a4ceb2f4b fix grammar 2009-06-23 01:18:57 +00:00
Benjamin Peterson d9920c255d remove tmpname support since it's no longer used 2009-06-21 23:03:36 +00:00
Benjamin Peterson f67caf8523 don't need to add the name 'lambda' as assigned 2009-06-21 23:01:07 +00:00
Benjamin Peterson 5ecf57adcf remove unused 'encoding' member from the compiler struct 2009-06-17 03:23:04 +00:00