cython.git
17 years agoremoved callable() again
Stefan Behnel [Sat, 15 Sep 2007 13:29:25 +0000 (15:29 +0200)]
removed callable() again

17 years agoremoved getattr() optimisation as it disables the usage of a default value
Stefan Behnel [Sat, 15 Sep 2007 11:44:57 +0000 (13:44 +0200)]
removed getattr() optimisation as it disables the usage of a default value

17 years agoanother signature fix, support for issubclass() and callable()
Stefan Behnel [Sat, 15 Sep 2007 10:56:40 +0000 (12:56 +0200)]
another signature fix, support for issubclass() and callable()

17 years ago[has|get|set]attr() optimisation (fix for setattr)
Stefan Behnel [Sat, 15 Sep 2007 10:43:21 +0000 (12:43 +0200)]
[has|get|set]attr() optimisation (fix for setattr)

17 years ago[has|get|set]attr() optimisation
Stefan Behnel [Sat, 15 Sep 2007 10:39:56 +0000 (12:39 +0200)]
[has|get|set]attr() optimisation

17 years agosupport method slots specific to a Python version
Stefan Behnel [Thu, 13 Sep 2007 14:37:05 +0000 (16:37 +0200)]
support method slots specific to a Python version

17 years agomerge from 0.9.6.6
Stefan Behnel [Wed, 12 Sep 2007 08:15:04 +0000 (10:15 +0200)]
merge from 0.9.6.6

17 years agouse 'with GIL' instead of 'withGIL' to avoid introducing a non-Python keyword and...
Stefan Behnel [Tue, 11 Sep 2007 19:12:49 +0000 (21:12 +0200)]
use 'with GIL' instead of 'withGIL' to avoid introducing a non-Python keyword and to support later extension for other contexts

17 years agouse 'with GIL' instead of 'withGIL' to avoid introducing a non-Python keyword and...
Stefan Behnel [Tue, 11 Sep 2007 19:12:49 +0000 (21:12 +0200)]
use 'with GIL' instead of 'withGIL' to avoid introducing a non-Python keyword and to support later extension for other contexts

17 years agosupport automatic GIL grabbing inside a function by addign 'withGIL' to its signature
Stefan Behnel [Mon, 10 Sep 2007 21:00:48 +0000 (23:00 +0200)]
support automatic GIL grabbing inside a function by addign 'withGIL' to its signature

17 years agosupport automatic GIL grabbing inside a function by addign 'withGIL' to its signature
Stefan Behnel [Mon, 10 Sep 2007 21:00:48 +0000 (23:00 +0200)]
support automatic GIL grabbing inside a function by addign 'withGIL' to its signature

17 years agoType check after (not before) operation on inplace assignment.
Robert Bradshaw [Tue, 11 Sep 2007 23:39:51 +0000 (16:39 -0700)]
Type check after (not before) operation on inplace assignment.

17 years agoenable attribute access of cdef functions
Robert Bradshaw [Mon, 10 Sep 2007 17:35:20 +0000 (10:35 -0700)]
enable attribute access of cdef functions

17 years agoCheck return values before PyErr_Occurred() for coercion nodes.
Robert Bradshaw [Fri, 7 Sep 2007 09:49:43 +0000 (02:49 -0700)]
Check return values before PyErr_Occurred() for coercion nodes.

17 years agoincref_local_binop option for SAGE
Robert Bradshaw [Wed, 5 Sep 2007 23:43:04 +0000 (16:43 -0700)]
incref_local_binop option for SAGE

This is so mutating inplace operations can be detected safely.

17 years agoBetter error for ** on integer types.
Robert Bradshaw [Wed, 5 Sep 2007 18:39:47 +0000 (11:39 -0700)]
Better error for ** on integer types.

17 years agofixed typo
Stefan Behnel [Mon, 3 Sep 2007 18:07:01 +0000 (20:07 +0200)]
fixed typo

17 years agodo not use __builtin_expect with GCC < 2.96
Stefan Behnel [Mon, 3 Sep 2007 14:17:12 +0000 (16:17 +0200)]
do not use __builtin_expect with GCC < 2.96

17 years agodo not use __builtin_expect with GCC < 2.96
Stefan Behnel [Mon, 3 Sep 2007 14:17:12 +0000 (16:17 +0200)]
do not use __builtin_expect with GCC < 2.96

17 years agorewrote Python 2.5-ism
Stefan Behnel [Mon, 3 Sep 2007 14:13:26 +0000 (16:13 +0200)]
rewrote Python 2.5-ism

17 years agofixed typo
Stefan Behnel [Mon, 3 Sep 2007 18:07:01 +0000 (20:07 +0200)]
fixed typo

17 years agorewrote Python 2.5-ism
Stefan Behnel [Mon, 3 Sep 2007 14:13:26 +0000 (16:13 +0200)]
rewrote Python 2.5-ism

17 years agoversion update
Stefan Behnel [Fri, 31 Aug 2007 09:58:13 +0000 (11:58 +0200)]
version update

17 years agofix for property functions
Stefan Behnel [Sat, 25 Aug 2007 17:01:14 +0000 (19:01 +0200)]
fix for property functions

17 years agofix for property functions
Stefan Behnel [Sat, 25 Aug 2007 17:01:14 +0000 (19:01 +0200)]
fix for property functions

17 years agomerge of 0.9.6.4
Stefan Behnel [Sat, 25 Aug 2007 17:00:31 +0000 (19:00 +0200)]
merge of 0.9.6.4

17 years agoavoid argument parsing (via meth_o, meth_noargs) for non-python-object arguments...
Robert Bradshaw [Sun, 19 Aug 2007 11:14:41 +0000 (04:14 -0700)]
avoid argument parsing (via meth_o, meth_noargs) for non-python-object arguments, upgrade version number to 0.9.6.4

compiles and runs SAGE fine

17 years agoremove pointer warning for generic arguments
Robert Bradshaw [Sun, 19 Aug 2007 10:56:31 +0000 (03:56 -0700)]
remove pointer warning for generic arguments

17 years agometh_o and meth_noargs for module-level functions
Robert Bradshaw [Sun, 19 Aug 2007 07:44:50 +0000 (00:44 -0700)]
meth_o and meth_noargs for module-level functions

previous patch was just for classes

17 years agoAvoid call to PyArg_ParseTupleAndKeywords for zero- and single-argument functions.
Robert Bradshaw [Sun, 19 Aug 2007 02:44:28 +0000 (19:44 -0700)]
Avoid call to PyArg_ParseTupleAndKeywords for zero- and single-argument functions.

17 years agoPyObject -> Py_ssize_t now uses __index__ rather than __int__ (even in function signa...
Robert Bradshaw [Sun, 19 Aug 2007 00:40:39 +0000 (17:40 -0700)]
PyObject -> Py_ssize_t now uses __index__ rather than __int__ (even in function signatures)

17 years agoCorrect flags on special methods so one can call their python functions directly.
Robert Bradshaw [Fri, 17 Aug 2007 23:11:06 +0000 (16:11 -0700)]
Correct flags on special methods so one can call their python functions directly.

17 years agoDocstrings for special methods
Robert Bradshaw [Fri, 17 Aug 2007 22:46:16 +0000 (15:46 -0700)]
Docstrings for special methods

17 years agoversion number
Robert Bradshaw [Fri, 17 Aug 2007 22:06:54 +0000 (15:06 -0700)]
version number

17 years agoRaise error when declaring reserved names.
Robert Bradshaw [Fri, 17 Aug 2007 08:47:56 +0000 (01:47 -0700)]
Raise error when declaring reserved names.

17 years agohonour Extension.include_dirs
Stefan Behnel [Mon, 6 Aug 2007 06:45:11 +0000 (08:45 +0200)]
honour Extension.include_dirs

17 years agoextract Cython 'cplus' option from Extension 'language' option
Stefan Behnel [Mon, 6 Aug 2007 06:36:52 +0000 (08:36 +0200)]
extract Cython 'cplus' option from Extension 'language' option

17 years agosupport 'language' option in distutils Extension
Stefan Behnel [Mon, 6 Aug 2007 06:19:48 +0000 (08:19 +0200)]
support 'language' option in distutils Extension

17 years agodebug code left over
Stefan Behnel [Fri, 3 Aug 2007 13:35:52 +0000 (15:35 +0200)]
debug code left over

17 years agoinitial support for unicode literals in UTF-8
Stefan Behnel [Wed, 1 Aug 2007 23:43:48 +0000 (01:43 +0200)]
initial support for unicode literals in UTF-8

17 years agoextract FQ module name from distutils
Stefan Behnel [Mon, 30 Jul 2007 20:18:23 +0000 (22:18 +0200)]
extract FQ module name from distutils

17 years agoversion number 0.9.6.5
Robert Bradshaw [Wed, 29 Aug 2007 21:54:29 +0000 (14:54 -0700)]
version number 0.9.6.5

17 years agoextract FQ module name from distutils
Stefan Behnel [Mon, 30 Jul 2007 20:18:23 +0000 (22:18 +0200)]
extract FQ module name from distutils

17 years agoFixed some typos reported by Helmut Jarausch
William Stein [Sun, 29 Jul 2007 16:38:20 +0000 (09:38 -0700)]
Fixed some typos reported by Helmut Jarausch

17 years agoremove gcc dependance for inline, branch prediction
Robert Bradshaw [Sun, 29 Jul 2007 01:30:36 +0000 (18:30 -0700)]
remove gcc dependance for inline, branch prediction

17 years agoMore Pyrex --> Cython conversions.
William Stein [Sat, 28 Jul 2007 20:48:10 +0000 (13:48 -0700)]
More Pyrex --> Cython conversions.

17 years agoA few more Pyrex --> Cython changes.
William Stein [Sat, 28 Jul 2007 20:42:16 +0000 (13:42 -0700)]
A few more Pyrex --> Cython changes.

17 years agoChanging Python. to Cython.
William Stein [Sat, 28 Jul 2007 20:40:10 +0000 (13:40 -0700)]
Changing Python. to Cython.

17 years agoChanging from pyrex/sagex to cython -- snapshot.
William Stein [Sat, 28 Jul 2007 20:39:28 +0000 (13:39 -0700)]
Changing from pyrex/sagex to cython -- snapshot.

17 years agoMerge in lxml-pyrex enum patch.
William Stein [Sat, 28 Jul 2007 20:18:27 +0000 (13:18 -0700)]
Merge in lxml-pyrex enum patch.

17 years agoMerge in C/API patch from lxml-pyrex.
William Stein [Sat, 28 Jul 2007 20:16:04 +0000 (13:16 -0700)]
Merge in C/API patch from lxml-pyrex.

17 years agoAdded pre-import option, which assumes all undeclared names come from the given module.
Robert Bradshaw [Wed, 11 Jul 2007 05:02:54 +0000 (22:02 -0700)]
Added pre-import option, which assumes all undeclared names come from the given module.

Emulates behavior of

from <module> import *

17 years agogcc branch prediction
Robert Bradshaw [Tue, 10 Jul 2007 22:42:24 +0000 (15:42 -0700)]
gcc branch prediction
For some reason, it actually makes it slower in some of the most common cases (now commented out). Why? It does help in others.

17 years agofix incompatable tmp release between 0.9.5.1a and fast tuple unpacking
Robert Bradshaw [Tue, 10 Jul 2007 09:55:12 +0000 (02:55 -0700)]
fix incompatable tmp release between 0.9.5.1a and fast tuple unpacking

17 years agolatest 0.9.4 changes into 0.9.5 branch
Robert Bradshaw [Tue, 10 Jul 2007 09:15:10 +0000 (02:15 -0700)]
latest 0.9.4 changes into 0.9.5 branch

17 years agofinish merging, fix weakref segfault, all SAGE doctests pass
Robert Bradshaw [Tue, 10 Jul 2007 09:08:20 +0000 (02:08 -0700)]
finish merging, fix weakref segfault, all SAGE doctests pass

17 years agoJim Kleckner patch to allow trailing commas in function argument lists
Robert Bradshaw [Sat, 7 Jul 2007 09:01:00 +0000 (02:01 -0700)]
Jim Kleckner patch to allow trailing commas in function argument lists

17 years agosagex_multi_file.patch from Joel Mohler (sane cross-file type cmp)
Robert Bradshaw [Sat, 7 Jul 2007 08:56:57 +0000 (01:56 -0700)]
sagex_multi_file.patch from Joel Mohler (sane cross-file type cmp)

17 years agoFast tuple unpacking
Robert Bradshaw [Sat, 7 Jul 2007 07:58:33 +0000 (00:58 -0700)]
Fast tuple unpacking

17 years agofix inplace operators for 0.9.5.1a
Robert Bradshaw [Thu, 7 Jun 2007 04:26:36 +0000 (21:26 -0700)]
fix inplace operators for 0.9.5.1a

17 years agocopy ModuleNode changes to new file
Robert Bradshaw [Thu, 7 Jun 2007 04:16:25 +0000 (21:16 -0700)]
copy ModuleNode changes to new file

17 years agoinitial merge
Robert Bradshaw [Thu, 7 Jun 2007 04:01:58 +0000 (21:01 -0700)]
initial merge

17 years agoPyrex Official version 0.9.5.1a
Robert Bradshaw [Thu, 7 Jun 2007 02:22:57 +0000 (19:22 -0700)]
Pyrex Official version 0.9.5.1a

17 years agotype narrowing for pxd files
Robert Bradshaw [Thu, 7 Jun 2007 02:02:58 +0000 (19:02 -0700)]
type narrowing for pxd files

17 years agotype narrowing for cdef methods
Robert Bradshaw [Fri, 1 Jun 2007 00:47:16 +0000 (17:47 -0700)]
type narrowing for cdef methods

Now if you inherit cdef methods from another class, you may re-declare the
arguments and return variables to be sub-types of the original declared type.
This will be especially convenient for the SAGE arithmetic architecture.
Type-checking is performed if necessary.

17 years agofix semantics of cmp() -- should not be a bint
Robert Bradshaw [Wed, 9 May 2007 07:31:34 +0000 (00:31 -0700)]
fix semantics of cmp() -- should not be a bint

17 years agoAdded warning about infinite loops in for-from-by statement.
Robert Bradshaw [Fri, 4 May 2007 20:05:53 +0000 (13:05 -0700)]
Added warning about infinite loops in for-from-by statement.

One rarely, if ever, wants the [step] argument to be negative.

17 years agoCompile-time checking for builtin names, cast TypeObjects to PyObject* so c compiler...
Robert Bradshaw [Fri, 4 May 2007 19:44:30 +0000 (12:44 -0700)]
Compile-time checking for builtin names, cast TypeObjects to PyObject* so c compiler won't complain.

17 years agocomments, builtin objects
Robert Bradshaw [Thu, 26 Apr 2007 05:04:07 +0000 (22:04 -0700)]
comments, builtin objects

17 years agoAdded for i from ... ['by' step] syntax.
Robert Bradshaw [Thu, 26 Apr 2007 03:42:45 +0000 (20:42 -0700)]
Added for i from ... ['by' step] syntax.

E.g.

for i from 0 <= i < 10 by 2:
    print i

0
2
4
6
8

Old for-from loops remain exactly the same (using the ++ or --). If step is specified, the increment operator will be += step or -= step, depending on the orientation of the inequalities (as before).

NOTE: 'by' is now a keyword

17 years agoAdded a bint c type, which is a c int that coerces to and from python objects via...
Robert Bradshaw [Thu, 26 Apr 2007 02:54:15 +0000 (19:54 -0700)]
Added a bint c type, which is a c int that coerces to and from python objects via the boolean routines.

The purpose of this type is to free the coder from having to use
bool() when retrieving and returning semantically "boolean" values
(e.g. the result of a compare).

The bint type is a subclass of the int type, and the only difference
is that it uses PyBool_FromLong and PyObject_IsTrue rather than
PyInt_FromLong and PyInt_AsLong. Arithmatic on bints will return ints.

Where it makes sense, several builtin functions have been re-declared
to return bints, as well as comparisons and the boolean operations
or, and, and not.

17 years agoCache __builtin__ name lookups so they are performed on module load rather than at...
Robert Bradshaw [Sat, 14 Apr 2007 11:13:05 +0000 (04:13 -0700)]
Cache __builtin__ name lookups so they are performed on module load rather than at every use.

The code "__Pyx_GetName(__pyx_b, __pyx_n_[string])" is performed in several
thousand places throughout the sage library, and can be quite expensive
(a dictionary lookup, possibly raising an error, etc.) This is redundant
as the result will always be the same. I perform the lookup once
(on loading the module), then have a pointer to the result for all subsequent use.

The most common examples are bool/str/int (both as function calls and
in isinstance), True/False, and raisign errors.

A side feature is that on loading a module with an illegal __builtin__ name,
it will complain at load time rather than at run time.

17 years agoInline keyword for cdef functions, variable assignment on declaration (+optimization)
Robert Bradshaw [Tue, 27 Feb 2007 11:46:35 +0000 (03:46 -0800)]
Inline keyword for cdef functions, variable assignment on declaration (+optimization)

"cdef inline foo()" now valid, and will place inline in the resulting c code

"cdef o = expr" and "cdef type x = expr" now valid.
This may not seem like a huge change, but it ended up requiring
quite a bit of work. The variables are still all declared at the
top, but the assignment takes place at the specified line in the
code.

If an assignment is made at declaration, the variable is initalized to
0 rather than None (also skipping an INCREF) and Py_XDECREF is used on
exiting the function (in case an error occured before the actual value
was calculated). Hence these variables MUST NOT be used before they are
defined or it will probably segfault.

17 years agodisable builtin functions that conflict with type names
Robert Bradshaw [Sat, 24 Feb 2007 12:44:11 +0000 (04:44 -0800)]
disable builtin functions that conflict with type names
add dummy py_index for cdef arrays so subexprs valid

17 years agoFix sizeof for dotted (cimported) types
Robert Bradshaw [Sat, 24 Feb 2007 11:23:45 +0000 (03:23 -0800)]
Fix sizeof for dotted (cimported) types

17 years agomodify sizeof() operator to return size of extension type struct
Robert Bradshaw [Fri, 23 Feb 2007 21:46:02 +0000 (13:46 -0800)]
modify sizeof() operator to return size of extension type struct

17 years agoFigured out how to use the Python/C API for some builtin functions (such as len)...
Robert Bradshaw [Fri, 23 Feb 2007 08:18:05 +0000 (00:18 -0800)]
Figured out how to use the Python/C API for some builtin functions (such as len) to avoid python calling conventions.

17 years agoConditional expressions
Robert Bradshaw [Fri, 23 Feb 2007 04:52:31 +0000 (20:52 -0800)]
Conditional expressions

Changes in grammar required change for this, see http://www.python.org/dev/peps/pep-0308/
Most noteably for list comprehensions (dissambiguate the if)

17 years agofast cdef type indexing into lists/tuples via runtime type checking
Robert Bradshaw [Thu, 22 Feb 2007 21:17:25 +0000 (13:17 -0800)]
fast cdef type indexing into lists/tuples via runtime type checking

- 5 times as fast for L[i], list/tuple L, cdef integer type i, 0 <= i < len(L)
- no change for L[a], python object a
- 1-1.5% slowdown for L[i], i negative or out of range

17 years agoDisable a**b for cdef int's. (Return result was a double.)
Robert Bradshaw [Wed, 21 Feb 2007 06:17:26 +0000 (22:17 -0800)]
Disable a**b for cdef int's. (Return result was a double.)

17 years agoDe-allocate function temp variables _after_ computing return value, in case an except...
Robert Bradshaw [Sat, 27 Jan 2007 07:06:06 +0000 (23:06 -0800)]
De-allocate function temp variables _after_ computing return value, in case an exception is thrown, caught, and said temp variables still need to be accessed.

17 years agofix temp allocation order, remove straggling comment output
Robert Bradshaw [Wed, 17 Jan 2007 04:24:21 +0000 (20:24 -0800)]
fix temp allocation order, remove straggling comment output

17 years agoFloorDiv operation
Robert Bradshaw [Tue, 16 Jan 2007 02:21:26 +0000 (18:21 -0800)]
FloorDiv operation

17 years agoImplemented inplace arithmetic
Robert Bradshaw [Tue, 16 Jan 2007 01:39:47 +0000 (17:39 -0800)]
Implemented inplace arithmetic

17 years agoGet rid of this sort of error: "Cannot assign type 'gsl_complex' to 'gsl_complex'"
William Stein [Thu, 11 Jan 2007 06:25:21 +0000 (22:25 -0800)]
Get rid of this sort of error: "Cannot assign type 'gsl_complex' to 'gsl_complex'"

The solution in this patch is somewhat hackish, but should be OK.

17 years agoList comprehension
Robert Bradshaw [Wed, 10 Jan 2007 09:06:30 +0000 (01:06 -0800)]
List comprehension

18 years agoPeter Johnson (peter@tortall.net) weakref patch
William Stein [Mon, 18 Dec 2006 02:59:29 +0000 (18:59 -0800)]
Peter Johnson (peter@tortall.net) weakref patch

I recently ran into this problem myself (as the current code causes
Python to crash), so I whipped up a quick patch that fixes it for me.
I think it follows all of the weakref guidelines now.

The patch is against the LXML svn pyrex
(http://codespeak.net/svn/lxml/pyrex/).  Is there a different SVN I
should be pointing to?  It patches functions generate_new_function,
generate_dealloc_function, generate_traverse_function, and
generate_clear_function.

The patch just compares the entry.name against "__weakref__"; this
could probably be centralized in the Entry object if so desired.

18 years agoApply Nick Alexander's patch so that Sagex that embeds positions in module, cdef...
William Stein [Mon, 18 Dec 2006 02:05:12 +0000 (18:05 -0800)]
Apply Nick Alexander's patch so that Sagex that embeds positions in module, cdef class, and def class docstrings.

18 years agoEric Huss's readonly variable patch:
William Stein [Thu, 30 Nov 2006 19:57:57 +0000 (11:57 -0800)]
Eric Huss's readonly variable patch:

There's a minor bug, if you try to cdef a readonly variable at the module
scope, the compiler raises an UnboundLocalError exception.  The attached
patch seems to clear up the problem and gets the compiler to report the
correct error.

18 years agoModified usage banner.
William Stein [Sat, 25 Nov 2006 09:26:53 +0000 (01:26 -0800)]
Modified usage banner.

18 years agoHad to also put the type code in for the signed case.
William Stein [Fri, 3 Nov 2006 23:41:38 +0000 (15:41 -0800)]
Had to also put the type code in for the signed case.

18 years agoMade some error output more verbose.
William Stein [Fri, 3 Nov 2006 23:34:50 +0000 (15:34 -0800)]
Made some error output more verbose.

18 years agoAdded support for automatic conversion of input types to Py_ssize_t.
William Stein [Fri, 3 Nov 2006 23:34:39 +0000 (15:34 -0800)]
Added support for automatic conversion of input types to Py_ssize_t.

18 years agoMade annoted C files easier to read.
William Stein [Fri, 3 Nov 2006 17:33:27 +0000 (09:33 -0800)]
Made annoted C files easier to read.

18 years agoFix one warning was too high a level
William Stein [Fri, 3 Nov 2006 04:29:29 +0000 (20:29 -0800)]
Fix one warning was too high a level

18 years agoMade the output generated by Pyrex much more verbose with better context information.
William Stein [Thu, 2 Nov 2006 15:46:17 +0000 (07:46 -0800)]
Made the output generated by Pyrex much more verbose with better context information.

For example:

  /* "/Volumes/HOME/s/devel/sage-1/sage/matrix/matrix_generic_sparse.pyx":581
    x = set(v.keys()).intersection(set(w.keys()))
    a = 0
    for k in x:             # <<<<<<<<<<<<<<
        a = a + v[k]*w[k]
    return a
 */
  __pyx_3 = PyObject_GetIter(__pyx_v_x); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; goto __pyx_L1;}
  for (;;) {

18 years agoChanged that error to a warning.
William Stein [Sun, 29 Oct 2006 01:21:12 +0000 (18:21 -0700)]
Changed that error to a warning.

18 years agoFixed an error in a call to the error function.
William Stein [Sun, 29 Oct 2006 01:19:51 +0000 (18:19 -0700)]
Fixed an error in a call to the error function.

18 years agoFix a Py_ssize_t build problem.
William Stein [Fri, 27 Oct 2006 11:22:40 +0000 (06:22 -0500)]
Fix a Py_ssize_t build problem.

18 years agoAdd a new option "-e" or "--embed-positions" to Pyrex.
William Stein [Wed, 25 Oct 2006 07:05:47 +0000 (02:05 -0500)]
Add a new option "-e" or "--embed-positions" to Pyrex.

  -p, --embed-positions          If specified, the positions in Pyrex files of each
                                 function definition is embedded in its docstring.

This is very useful to support interactive viewing of *Pyrex* source
code in, e.g, IPython.