Commit Graph

2718 Commits

Author SHA1 Message Date
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
Georg Brandl f2bfd54d6f Properly check for consistency with the third argument of
compile() when compiling an AST node.
2008-03-29 13:24:23 +00:00
Amaury Forgeot d'Arc 69b747b735 Fix a reference leak found by Georg, when compiling a class nested in another class.
Now "regrtest.py -R:: test_compile" is satisfied.

Will backport.
2008-03-28 20:30:50 +00:00
Amaury Forgeot d'Arc 473445c964 Silence a compilation warning 2008-03-28 20:17:51 +00:00
Georg Brandl fc8eef3c78 Patch #1810 by Thomas Lee, reviewed by myself:
allow compiling Python AST objects into code objects
in compile().
2008-03-28 12:11:56 +00:00
Neal Norwitz d183bdd6fb Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings.
Rather than sprinkle casts throughout the code, change Py_CHARMASK to
always cast it's result to an unsigned char.  This should ensure we
do the right thing when accessing an array with the result.
2008-03-28 04:58:51 +00:00
Christian Heimes 61e4590ec9 Build bots are working again - removing the hack 2008-03-27 10:35:52 +00:00
Christian Heimes 81caa790b6 Quick 'n dirty hack: Increase the magic by 2 to force a rebuild of pyc/pyo files on the build bots 2008-03-27 09:02:33 +00:00
Neal Norwitz 231346e23f Fix warnings about using char as an array subscript. This is not portable
since char is signed on some platforms and unsigned on others.
2008-03-27 04:40:50 +00:00
Amaury Forgeot d'Arc df70e05d22 C89 compliance: Microsoft compilers want variable declarations at the top 2008-03-26 23:07:43 +00:00
Christian Heimes 7f23d86107 Initialize PyCompilerFlags cf_flags with 0 2008-03-26 22:51:58 +00:00
Christian Heimes 3c60833e1e Patch #2477: Added from __future__ import unicode_literals
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
2008-03-26 22:01:37 +00:00
Christian Heimes 1a6387e683 Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray

........
  r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line

  Copied files from py3k w/o modifications
........
  r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines

  Take One
  * Added initialization code, warnings, flags etc. to the appropriate places
  * Added new buffer interface to string type
  * Modified tests
  * Modified Makefile.pre.in to compile the new files
  * Added bytesobject.c to Python.h
........
  r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines

  Disabled bytearray.extend for now since it causes an infinite recursion
  Fixed serveral unit tests
........
  r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines

  Added PyBytes support to several places:
  str + bytearray
  ord(bytearray)
  bytearray(str, encoding)
........
  r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line

  Fixed more unit tests related to type('') is not unicode
........
  r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fixed more unit tests
  Fixed bytearray.extend
........
  r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line

  Implemented old buffer interface for bytearray
........
  r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line

  Added backport of the io module
........
  r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line

  Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
  r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines

  Fixed more tests
  Fixed bytearray() comparsion with unicode()
  Fixed iterator assignment of bytearray
........
  r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines

  str(bytesarray()) now returns the bytes and not the representation of the bytearray object
  Enabled and fixed more unit tests
........
  r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines

  Clear error PyNumber_AsSsize_t() fails
  Use CHARMASK for ob_svall access
  disabled a test with memoryview again
........
  r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line

  Untested updates to the PCBuild directory
........
  r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line

  The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
  r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines

  Disabled last failing test
  I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
  r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytes warning code
........
  r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line

  Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
  r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 12:49:49 +00:00
Georg Brandl d5b635f196 Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
2008-03-25 08:29:14 +00:00
Neal Norwitz 4677fbf7de Try to fix a bunch of compiler warnings on Win64. 2008-03-25 04:18:18 +00:00
Christian Heimes a113bd9f69 Added quick hack for bzr 2008-03-24 19:58:17 +00:00
Christian Heimes 6a453c3750 Added quick hack for bzr 2008-03-24 19:57:42 +00:00
Neal Norwitz ade57d0485 Remove compiler warnings (on Alpha at least) about using chars as
array subscripts.  Using chars are dangerous b/c they are signed
on some platforms and unsigned on others.
2008-03-23 06:19:57 +00:00
Georg Brandl 5a44424c5e #2358: add py3k warning to sys.exc_clear(). 2008-03-21 20:11:46 +00:00
Raymond Hettinger 10dca6e282 The filter() function does support a None argument in Py3.0. 2008-03-19 17:58:59 +00:00
Martin v. Löwis a4d77898db Issue #2400: Allow relative imports to "import *". 2008-03-19 04:39:13 +00:00
Eric Smith 7c47894a2a Backport of the print function, using a __future__ import.
This work is substantially Anthony Baxter's, from issue
1633807.  I just freshened it, made a few minor tweaks,
and added the test cases.  I also created issue 2412,
which is to check for 2to3's behavior with the print
function.  I also added myself to ACKS.
2008-03-18 23:45:49 +00:00
David Wolever 8e6ec2ff02 Added a warning when -3 is enabled and None is passed to filter as the first argument. 2008-03-18 21:20:25 +00:00
Travis E. Oliphant 3781aef8f8 Finish backporting new buffer API to Python 2.6. Left to do: memoryview object and structmodule. But, these need to be finished in Python 3.0 first. No objects support the new buffer API in Python 2.6 as of yet, and except for the memoryview object, I don't think they will. 2008-03-18 04:44:57 +00:00
Guido van Rossum 504153d55b Issue #2341: Add a Py3k warning when raising an exception that doesn't
derive from BaseException.
2008-03-18 04:26:48 +00:00
Brett Cannon aa5778d1b8 Remove our implementation of memmove() and strerror(); both are in the C89
standard library.
2008-03-18 04:09:00 +00:00
Guido van Rossum 20bda581e3 Clean up the Py3k warnings for non-BaseException-subclasses a bit. We
now don't warn for some corner cases that deserve a warning, rather
than warning double or incorrectly for some other corner cases.
2008-03-18 03:15:05 +00:00
Guido van Rossum 04edb528ca - Issue #2371: Add a Py3k warning when catching an exception that
doesn't derive from BaseException.
2008-03-18 02:49:46 +00:00
Eric Smith 9ff19b5434 Finished backporting PEP 3127, Integer Literal Support and Syntax.
Added 0b and 0o literals to tokenizer.
Modified PyOS_strtoul to support 0b and 0o inputs.
Modified PyLong_FromString to support guessing 0b and 0o inputs.
Renamed test_hexoct.py to test_int_literal.py and added binary tests.
Added upper and lower case 0b, 0O, and 0X tests to test_int_literal.py
2008-03-17 17:32:20 +00:00
Eric Smith 5c35a9da65 Reformated lines > 79 chars.
Deleted unused macro ISXDIGIT.
2008-03-17 12:14:29 +00:00
Eric Smith 8113ca63b9 Issue 2264: empty float presentation type needs to have at least one digit past the decimal point.
Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type.
Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning.
Modified format.__float__ to use the new "Z" format as the default.
Added test cases.
2008-03-17 11:01:01 +00:00
Neal Norwitz 5becac576c Handle memory allocation failure. Found by Adam Olsen 2008-03-15 22:36:01 +00:00
Neal Norwitz 400aedacc0 Add a warning for code like:
assert (0, 'message')

An empty tuple does not create a warning.  While questionable usage:
  assert (), 'message'

should not display a warning.  Tested manually.
The warning message could be improved.  Feel free to update it.
2008-03-15 22:03:18 +00:00
Nick Coghlan 7af53be66f Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files) 2008-03-07 14:13:28 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Jeffrey Yasskin 9063a99042 compile.c always emits END_FINALLY after WITH_CLEANUP, so predict that in
ceval.c. This is worth about a .03-.04us speedup on a simple with block.
2008-03-03 01:27:03 +00:00