Discussion:
Cython 0.21 released
Stefan Behnel
2014-09-10 16:40:37 UTC
Permalink
Hi all,

on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.

I copied the complete changelog of this release below, but here are the
major highlights, in addition to the many bug fixes and general
improvements in this release.

* Legacy code and support for old CPython versions was removed, baselines
are now Python 2.6 and 3.2.

* cdef functions finally support inner Python functions with closures.

* C enums can now be declared as "cpdef" to publish them to Python space.

* Python method calls, boolean "and/or" operators and cascaded assignments
were optimised to streamline calls and type coercions.

* The annotated HTML code output is syntax highlighted and beautified.

Have fun,

Stefan


Downloads:
https://pypi.python.org/pypi/Cython/0.21

http://cython.org/release/Cython-0.21.tar.gz

http://cython.org/release/Cython-0.21.zip

Signatures:
http://cython.org/release/Cython-0.21.tar.gz.asc
http://cython.org/release/Cython-0.21.zip.asc

Changelog:
https://github.com/cython/cython/blob/c67e895414aac90dfe9f789530143cff5b2ec7ad/CHANGES.rst

Documentation:
http://docs.cython.org/


0.21 (2014-09-10)
=================

Features added
--------------

* C (cdef) functions allow inner Python functions.

* Enums can now be declared as cpdef to export their values to
the module's Python namespace. Cpdef enums in pxd files export
their values to their own module, iff it exists.

* Allow @staticmethod decorator to declare static cdef methods.
This is especially useful for declaring "constructors" for
cdef classes that can take non-Python arguments.

* Taking a ``char*`` from a temporary Python string object is safer
in more cases and can be done inside of non-trivial expressions,
including arguments of a function call. A compile time error
is raised only when such a pointer is assigned to a variable and
would thus exceed the lifetime of the string itself.

* Generators have new properties ``__name__`` and ``__qualname__``
that provide the plain/qualified name of the generator function
(following CPython 3.5). See http://bugs.python.org/issue21205

* The ``inline`` function modifier is available as a decorator
``@cython.inline`` in pure mode.

* When cygdb is run in a virtualenv, it enables the same virtualenv
inside of the debugger. Patch by Marc Abramowitz.

* PEP 465: dedicated infix operator for matrix multiplication (A @ B).

* HTML output of annotated code uses Pygments for code highlighting
and generally received a major overhaul by Matthias Bussonier.

* IPython magic support is now available directly from Cython with
the command "%load_ext cython". Cython code can directly be
executed in a cell when marked with "%%cython". Code analysis
is available with "%%cython -a". Patch by Martín Gaitán.

* Simple support for declaring Python object types in Python signature
annotations. Currently requires setting the compiler directive
``annotation_typing=True``.

* New directive ``use_switch`` (defaults to True) to optionally disable
the optimization of chained if statement to C switch statements.

* Defines dynamic_cast et al. in ``libcpp.cast`` and C++ heap data
structure operations in ``libcpp.algorithm``.

* Shipped header declarations in ``posix.*`` were extended to cover
more of the POSIX API. Patches by Lars Buitinck and Mark Peek.

Optimizations
-------------

* Simple calls to C implemented Python functions/methods are faster.
This also speeds up many operations on builtins that Cython cannot
otherwise optimise.

* The "and"/"or" operators try to avoid unnecessary coercions of their
arguments. They now evaluate the truth value of each argument
independently and only coerce the final result of the whole expression
to the target type (e.g. the type on the left side of an assignment).
This also avoids reference counting overhead for Python values during
evaluation and generally improves the code flow in the generated C code.

* The Python expression "2 ** N" is optimised into bit shifting.
See http://bugs.python.org/issue21420

* Cascaded assignments (a = b = ...) try to minimise the number of
type coercions.

* Calls to ``slice()`` are translated to a straight C-API call.

Bugs fixed
----------

* Crash when assigning memory views from ternary conditional expressions.

* Nested C++ templates could lead to unseparated ">>" characters being
generated into the C++ declarations, which older C++ compilers could
not parse.

* Sending SIGINT (Ctrl-C) during parallel cythonize() builds could
hang the child processes.

* No longer ignore local setup.cfg files for distutils in pyximport.
Patch by Martin Teichmann.

* Taking a ``char*`` from an indexed Python string generated unsafe
reference counting code.

* Set literals now create all of their items before trying to add them
to the set, following the behaviour in CPython. This makes a
difference in the rare case that the item creation has side effects
and some items are not hashable (or if hashing them has side effects,
too).

* Cython no longer generates the cross product of C functions for code
that uses memory views of fused types in function signatures (e.g.
``cdef func(floating[:] a, floating[:] b)``). This is considered the
expected behaviour by most users and was previously inconsistent with
other structured types like C arrays. Code that really wants all type
combinations can create the same fused memoryview type under different
names and use those in the signature to make it clear which types are
independent.

* Names that were unknown at compile time were looked up as builtins at
runtime but not as global module names. Trying both lookups helps with
globals() manipulation.

* Fixed stl container conversion for typedef element types.

* ``obj.pop(x)`` truncated large C integer values of x to ``Py_ssize_t``.

* ``__init__.pyc`` is recognised as marking a package directory
(in addition to .py, .pyx and .pxd).

* Syntax highlighting in ``cython-mode.el`` for Emacs no longer
incorrectly highlights keywords found as part of longer names.

* Correctly handle ``from cython.submodule cimport name``.

* Fix infinite recursion when using super with cpdef methods.

* No-args ``dir()`` was not guaranteed to return a sorted list.

Other changes
-------------

* The header line in the generated C files no longer contains the
timestamp but only the Cython version that wrote it. This was
changed to make builds more reproducible.

* Removed support for CPython 2.4, 2.5 and 3.1.

* The licensing implications on the generated code were clarified
to avoid legal constraints for users.
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex K
2014-09-11 11:49:35 UTC
Permalink
Hey guys,
tables 3.0.0 (maybe later version too) fails to install with `pip install
tables==3.0.0` due to changes in naming. PyTables's build script expects
Cython.Compiler.Main.Version, and gives an error when it doesn't find it.
Cython 0.21 provides Cython.Compiler.Main.version.
Regards, Alex K
Post by Stefan Behnel
Hi all,
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
I copied the complete changelog of this release below, but here are the
major highlights, in addition to the many bug fixes and general
improvements in this release.
* Legacy code and support for old CPython versions was removed, baselines
are now Python 2.6 and 3.2.
* cdef functions finally support inner Python functions with closures.
* C enums can now be declared as "cpdef" to publish them to Python space.
* Python method calls, boolean "and/or" operators and cascaded assignments
were optimised to streamline calls and type coercions.
* The annotated HTML code output is syntax highlighted and beautified.
Have fun,
Stefan
https://pypi.python.org/pypi/Cython/0.21
http://cython.org/release/Cython-0.21.tar.gz
http://cython.org/release/Cython-0.21.zip
http://cython.org/release/Cython-0.21.tar.gz.asc
http://cython.org/release/Cython-0.21.zip.asc
https://github.com/cython/cython/blob/c67e895414aac90dfe9f789530143cff5b2ec7ad/CHANGES.rst
http://docs.cython.org/
0.21 (2014-09-10)
=================
Features added
--------------
* C (cdef) functions allow inner Python functions.
* Enums can now be declared as cpdef to export their values to
the module's Python namespace. Cpdef enums in pxd files export
their values to their own module, iff it exists.
This is especially useful for declaring "constructors" for
cdef classes that can take non-Python arguments.
* Taking a ``char*`` from a temporary Python string object is safer
in more cases and can be done inside of non-trivial expressions,
including arguments of a function call. A compile time error
is raised only when such a pointer is assigned to a variable and
would thus exceed the lifetime of the string itself.
* Generators have new properties ``__name__`` and ``__qualname__``
that provide the plain/qualified name of the generator function
(following CPython 3.5). See http://bugs.python.org/issue21205
* The ``inline`` function modifier is available as a decorator
* When cygdb is run in a virtualenv, it enables the same virtualenv
inside of the debugger. Patch by Marc Abramowitz.
* HTML output of annotated code uses Pygments for code highlighting
and generally received a major overhaul by Matthias Bussonier.
* IPython magic support is now available directly from Cython with
the command "%load_ext cython". Cython code can directly be
executed in a cell when marked with "%%cython". Code analysis
is available with "%%cython -a". Patch by Martín Gaitán.
* Simple support for declaring Python object types in Python signature
annotations. Currently requires setting the compiler directive
``annotation_typing=True``.
* New directive ``use_switch`` (defaults to True) to optionally disable
the optimization of chained if statement to C switch statements.
* Defines dynamic_cast et al. in ``libcpp.cast`` and C++ heap data
structure operations in ``libcpp.algorithm``.
* Shipped header declarations in ``posix.*`` were extended to cover
more of the POSIX API. Patches by Lars Buitinck and Mark Peek.
Optimizations
-------------
* Simple calls to C implemented Python functions/methods are faster.
This also speeds up many operations on builtins that Cython cannot
otherwise optimise.
* The "and"/"or" operators try to avoid unnecessary coercions of their
arguments. They now evaluate the truth value of each argument
independently and only coerce the final result of the whole expression
to the target type (e.g. the type on the left side of an assignment).
This also avoids reference counting overhead for Python values during
evaluation and generally improves the code flow in the generated C code.
* The Python expression "2 ** N" is optimised into bit shifting.
See http://bugs.python.org/issue21420
* Cascaded assignments (a = b = ...) try to minimise the number of
type coercions.
* Calls to ``slice()`` are translated to a straight C-API call.
Bugs fixed
----------
* Crash when assigning memory views from ternary conditional expressions.
* Nested C++ templates could lead to unseparated ">>" characters being
generated into the C++ declarations, which older C++ compilers could
not parse.
* Sending SIGINT (Ctrl-C) during parallel cythonize() builds could
hang the child processes.
* No longer ignore local setup.cfg files for distutils in pyximport.
Patch by Martin Teichmann.
* Taking a ``char*`` from an indexed Python string generated unsafe
reference counting code.
* Set literals now create all of their items before trying to add them
to the set, following the behaviour in CPython. This makes a
difference in the rare case that the item creation has side effects
and some items are not hashable (or if hashing them has side effects,
too).
* Cython no longer generates the cross product of C functions for code
that uses memory views of fused types in function signatures (e.g.
``cdef func(floating[:] a, floating[:] b)``). This is considered the
expected behaviour by most users and was previously inconsistent with
other structured types like C arrays. Code that really wants all type
combinations can create the same fused memoryview type under different
names and use those in the signature to make it clear which types are
independent.
* Names that were unknown at compile time were looked up as builtins at
runtime but not as global module names. Trying both lookups helps with
globals() manipulation.
* Fixed stl container conversion for typedef element types.
* ``obj.pop(x)`` truncated large C integer values of x to ``Py_ssize_t``.
* ``__init__.pyc`` is recognised as marking a package directory
(in addition to .py, .pyx and .pxd).
* Syntax highlighting in ``cython-mode.el`` for Emacs no longer
incorrectly highlights keywords found as part of longer names.
* Correctly handle ``from cython.submodule cimport name``.
* Fix infinite recursion when using super with cpdef methods.
* No-args ``dir()`` was not guaranteed to return a sorted list.
Other changes
-------------
* The header line in the generated C files no longer contains the
timestamp but only the Cython version that wrote it. This was
changed to make builds more reproducible.
* Removed support for CPython 2.4, 2.5 and 3.1.
* The licensing implications on the generated code were clarified
to avoid legal constraints for users.
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Stefan Behnel
2014-09-11 12:02:49 UTC
Permalink
Post by Alex K
tables 3.0.0 (maybe later version too) fails to install with `pip install
tables==3.0.0` due to changes in naming. PyTables's build script expects
Cython.Compiler.Main.Version, and gives an error when it doesn't find it.
Cython 0.21 provides Cython.Compiler.Main.version.
The right way to check for the Cython version is

Cython.__version__

as with most Python packages. For backwards compatibility with old Cython
versions that didn't have it yet, you can use

Cython.Compiler.Version.version

Relying on a re-exported import like "Cython.Compiler.Main.Version" is like
asking for "os.sys" to work because the "os" module happens to do "import sys".

Stefan
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex K
2014-09-11 12:28:53 UTC
Permalink
Thanks, Stefan, for the reply..
I am a user that can not install tables 3.0.0 with cython 0.21. Tables can
be installed with cython up to 0.20.2. Can you please consider to add
Cython.Compiler.Main.Version back so that users of old tables could still
use latest cython?
Alex
Post by Alex K
Post by Alex K
tables 3.0.0 (maybe later version too) fails to install with `pip
install
Post by Alex K
tables==3.0.0` due to changes in naming. PyTables's build script expects
Cython.Compiler.Main.Version, and gives an error when it doesn't find
it.
Post by Alex K
Cython 0.21 provides Cython.Compiler.Main.version.
The right way to check for the Cython version is
Cython.__version__
as with most Python packages. For backwards compatibility with old Cython
versions that didn't have it yet, you can use
Cython.Compiler.Version.version
Relying on a re-exported import like "Cython.Compiler.Main.Version" is like
asking for "os.sys" to work because the "os" module happens to do "import sys".
Stefan
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Stefan Behnel
2014-09-11 17:49:44 UTC
Permalink
Post by Alex K
I am a user that can not install tables 3.0.0 with cython 0.21. Tables can
be installed with cython up to 0.20.2. Can you please consider to add
Cython.Compiler.Main.Version back so that users of old tables could still
use latest cython?
Normally, users should not have to use (or have) Cython themselves when
they want to install a Cython implemented package. Instead, the package
should ship the generated C sources and do a normal extension module build
by default, without running Cython at all. That avoids a build dependency
and makes sure that users really get exactly what the code maintainers
wanted to release and what they have properly tested before doing so.

That being said, we try to keep things working for users, unless there's an
actual reason to break something. I've definitely seen way worse
compatibility hacks than an unused import.

https://github.com/cython/cython/commit/43342ab90704f5f850733544288485048160003d

Stefan
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex K
2014-09-11 18:10:59 UTC
Permalink
Cool! Many thanks!
Alex
Post by Stefan Behnel
Post by Alex K
I am a user that can not install tables 3.0.0 with cython 0.21. Tables
can
Post by Alex K
be installed with cython up to 0.20.2. Can you please consider to add
Cython.Compiler.Main.Version back so that users of old tables could
still
Post by Alex K
use latest cython?
Normally, users should not have to use (or have) Cython themselves when
they want to install a Cython implemented package. Instead, the package
should ship the generated C sources and do a normal extension module build
by default, without running Cython at all. That avoids a build dependency
and makes sure that users really get exactly what the code maintainers
wanted to release and what they have properly tested before doing so.
That being said, we try to keep things working for users, unless there's an
actual reason to break something. I've definitely seen way worse
compatibility hacks than an unused import.
https://github.com/cython/cython/commit/43342ab90704f5f850733544288485048160003d
Stefan
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chris Barker
2014-09-15 15:51:34 UTC
Permalink
Shouldn't that be:

cython.__version__

to be PEP8 compliant?

I'm still not sure why there is both a "Cython" and "cython" package that
are not quite the same -- but there really shouldn't be!

-Chris
--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

***@noaa.gov
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yury V. Zaytsev
2014-09-11 13:41:35 UTC
Permalink
Post by Stefan Behnel
The right way to check for the Cython version is
Cython.__version__
as with most Python packages.
Hi Stefan,

I've just send a pull request to PyTables to fix this:

https://github.com/PyTables/PyTables/pull/387

I would appreciate if you could chime in and vet it in the case that it
looks sane to you.

Thanks,
--
Sincerely yours,
Yury V. Zaytsev
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Caleb Hattingh
2014-09-12 01:50:13 UTC
Permalink
Post by Stefan Behnel
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
I would like to express a huge thank-you to everyone who has helped to
develop Cython. I have been using it just about daily for the past year.
Cython is what makes it possible for me to use Python in my work.

Thank you again,

regards
Caleb
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yaroslav Halchenko
2014-10-08 14:23:07 UTC
Permalink
congrats!

while preparing build for Debian I ran into good old (never got feedback
to my analysis done in Jul/Aug, thread "Cython bugfix release")

======================================================================
ERROR: test_all (Cython.Debugger.Tests.TestLibCython.TestAll)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Debugger/Tests/TestLibCython.py", line 280, in test_all
sys.stderr.write(errmsg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23604-23607: ordinal not in range(128)


and few other failures:

======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestJediTyper)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}

======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestTypeInjection)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}

----------------------------------------------------------------------
Ran 8775 tests in 2249.908s

FAILED (failures=2, errors=1)

are they known/fixed?
Post by Stefan Behnel
Hi all,
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
I copied the complete changelog of this release below, but here are the
major highlights, in addition to the many bug fixes and general
improvements in this release.
* Legacy code and support for old CPython versions was removed, baselines
are now Python 2.6 and 3.2.
* cdef functions finally support inner Python functions with closures.
* C enums can now be declared as "cpdef" to publish them to Python space.
* Python method calls, boolean "and/or" operators and cascaded assignments
were optimised to streamline calls and type coercions.
* The annotated HTML code output is syntax highlighted and beautified.
Have fun,
Stefan
https://pypi.python.org/pypi/Cython/0.21
http://cython.org/release/Cython-0.21.tar.gz
http://cython.org/release/Cython-0.21.zip
http://cython.org/release/Cython-0.21.tar.gz.asc
http://cython.org/release/Cython-0.21.zip.asc
https://github.com/cython/cython/blob/c67e895414aac90dfe9f789530143cff5b2ec7ad/CHANGES.rst
http://docs.cython.org/
0.21 (2014-09-10)
=================
Features added
--------------
* C (cdef) functions allow inner Python functions.
* Enums can now be declared as cpdef to export their values to
the module's Python namespace. Cpdef enums in pxd files export
their values to their own module, iff it exists.
This is especially useful for declaring "constructors" for
cdef classes that can take non-Python arguments.
* Taking a ``char*`` from a temporary Python string object is safer
in more cases and can be done inside of non-trivial expressions,
including arguments of a function call. A compile time error
is raised only when such a pointer is assigned to a variable and
would thus exceed the lifetime of the string itself.
* Generators have new properties ``__name__`` and ``__qualname__``
that provide the plain/qualified name of the generator function
(following CPython 3.5). See http://bugs.python.org/issue21205
* The ``inline`` function modifier is available as a decorator
* When cygdb is run in a virtualenv, it enables the same virtualenv
inside of the debugger. Patch by Marc Abramowitz.
* HTML output of annotated code uses Pygments for code highlighting
and generally received a major overhaul by Matthias Bussonier.
* IPython magic support is now available directly from Cython with
the command "%load_ext cython". Cython code can directly be
executed in a cell when marked with "%%cython". Code analysis
is available with "%%cython -a". Patch by Martín Gaitán.
* Simple support for declaring Python object types in Python signature
annotations. Currently requires setting the compiler directive
``annotation_typing=True``.
* New directive ``use_switch`` (defaults to True) to optionally disable
the optimization of chained if statement to C switch statements.
* Defines dynamic_cast et al. in ``libcpp.cast`` and C++ heap data
structure operations in ``libcpp.algorithm``.
* Shipped header declarations in ``posix.*`` were extended to cover
more of the POSIX API. Patches by Lars Buitinck and Mark Peek.
Optimizations
-------------
* Simple calls to C implemented Python functions/methods are faster.
This also speeds up many operations on builtins that Cython cannot
otherwise optimise.
* The "and"/"or" operators try to avoid unnecessary coercions of their
arguments. They now evaluate the truth value of each argument
independently and only coerce the final result of the whole expression
to the target type (e.g. the type on the left side of an assignment).
This also avoids reference counting overhead for Python values during
evaluation and generally improves the code flow in the generated C code.
* The Python expression "2 ** N" is optimised into bit shifting.
See http://bugs.python.org/issue21420
* Cascaded assignments (a = b = ...) try to minimise the number of
type coercions.
* Calls to ``slice()`` are translated to a straight C-API call.
Bugs fixed
----------
* Crash when assigning memory views from ternary conditional expressions.
* Nested C++ templates could lead to unseparated ">>" characters being
generated into the C++ declarations, which older C++ compilers could
not parse.
* Sending SIGINT (Ctrl-C) during parallel cythonize() builds could
hang the child processes.
* No longer ignore local setup.cfg files for distutils in pyximport.
Patch by Martin Teichmann.
* Taking a ``char*`` from an indexed Python string generated unsafe
reference counting code.
* Set literals now create all of their items before trying to add them
to the set, following the behaviour in CPython. This makes a
difference in the rare case that the item creation has side effects
and some items are not hashable (or if hashing them has side effects,
too).
* Cython no longer generates the cross product of C functions for code
that uses memory views of fused types in function signatures (e.g.
``cdef func(floating[:] a, floating[:] b)``). This is considered the
expected behaviour by most users and was previously inconsistent with
other structured types like C arrays. Code that really wants all type
combinations can create the same fused memoryview type under different
names and use those in the signature to make it clear which types are
independent.
* Names that were unknown at compile time were looked up as builtins at
runtime but not as global module names. Trying both lookups helps with
globals() manipulation.
* Fixed stl container conversion for typedef element types.
* ``obj.pop(x)`` truncated large C integer values of x to ``Py_ssize_t``.
* ``__init__.pyc`` is recognised as marking a package directory
(in addition to .py, .pyx and .pxd).
* Syntax highlighting in ``cython-mode.el`` for Emacs no longer
incorrectly highlights keywords found as part of longer names.
* Correctly handle ``from cython.submodule cimport name``.
* Fix infinite recursion when using super with cpdef methods.
* No-args ``dir()`` was not guaranteed to return a sorted list.
Other changes
-------------
* The header line in the generated C files no longer contains the
timestamp but only the Cython version that wrote it. This was
changed to make builds more reproducible.
* Removed support for CPython 2.4, 2.5 and 3.1.
* The licensing implications on the generated code were clarified
to avoid legal constraints for users.
_______________________________________________
cython-devel mailing list
https://mail.python.org/mailman/listinfo/cython-devel
--
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist, Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Stefan Behnel
2014-10-10 06:03:20 UTC
Permalink
Hi,

thanks for the feedback.
Post by Yaroslav Halchenko
while preparing build for Debian I ran into good old (never got feedback
to my analysis done in Jul/Aug, thread "Cython bugfix release")
======================================================================
ERROR: test_all (Cython.Debugger.Tests.TestLibCython.TestAll)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Debugger/Tests/TestLibCython.py", line 280, in test_all
sys.stderr.write(errmsg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23604-23607: ordinal not in range(128)
The debugger tests are generally broken at the moment.
Post by Yaroslav Halchenko
======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestJediTyper)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}
======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestTypeInjection)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}
----------------------------------------------------------------------
I faintly recall that there's a version dependency here, so I restricted
the test runs to Jedi 0.8.1 and later.

Stefan
Yaroslav Halchenko
2014-10-10 18:41:27 UTC
Permalink
Post by Stefan Behnel
Hi,
thanks for the feedback.
Post by Yaroslav Halchenko
while preparing build for Debian I ran into good old (never got feedback
to my analysis done in Jul/Aug, thread "Cython bugfix release")
======================================================================
ERROR: test_all (Cython.Debugger.Tests.TestLibCython.TestAll)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Debugger/Tests/TestLibCython.py", line 280, in test_all
sys.stderr.write(errmsg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23604-23607: ordinal not in range(128)
The debugger tests are generally broken at the moment.
thanks! I will try to exclude them then
Post by Stefan Behnel
Post by Yaroslav Halchenko
======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestJediTyper)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}
======================================================================
FAIL: test_typing_function_int_loop (Cython.Tests.TestJediTyper.TestTypeInjection)
----------------------------------------------------------------------
File "/home/yoh/deb/gits/build-area/cython-0.21/Cython/Tests/TestJediTyper.py", line 85, in test_typing_function_int_loop
self.assertIn(('func', (1, 0)), types)
AssertionError: ('func', (1, 0)) not found in {}
----------------------------------------------------------------------
I faintly recall that there's a version dependency here, so I restricted
the test runs to Jedi 0.8.1 and later.
cool -- cherry picked that one for the package -- thanks!
--
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist, Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Niki Spahiev
2014-10-09 15:57:07 UTC
Permalink
Hello,

While testing on windows without setuptools, i found that cythonize.py
is missing from Cython-0.21.tar.gz

Niki
Yaroslav Halchenko
2014-10-11 14:18:41 UTC
Permalink
Post by Stefan Behnel
Hi all,
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
a little change detected while down-stream testing builds in Debian
(previous version was 0.20.2 and it built fine)

------------------------------------------------------------
...
vertex_format.last_shader = self
for i in xrange(vertex_format.vattr_count):
attr = &vertex_format.vattr[i]
if attr.per_vertex == 0:
continue
attr.index = glGetAttribLocation(self.program, <char *><bytes>attr.name)
^
------------------------------------------------------------

kivy/graphics/shader.pyx:448:63: Casting temporary Python object to non-numeric non-Python type

I wondered if that is an intentional restriction now to restrict such casting
only to numeric (and exclude the simplest form -- bytes/chars) or a
regression?

Cheers!
--
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist, Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Stefan Behnel
2014-10-11 14:53:05 UTC
Permalink
Post by Yaroslav Halchenko
Post by Stefan Behnel
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
a little change detected while down-stream testing builds in Debian
(previous version was 0.20.2 and it built fine)
------------------------------------------------------------
...
vertex_format.last_shader = self
attr = &vertex_format.vattr[i]
continue
attr.index = glGetAttribLocation(self.program, <char *><bytes>attr.name)
^
------------------------------------------------------------
kivy/graphics/shader.pyx:448:63: Casting temporary Python object to non-numeric non-Python type
Wow, interesting piece of code. What's that even supposed to do?

Looking up their code, I find that "attr.name" is a char*:

https://github.com/kivy/kivy/blob/master/kivy/graphics/vertex.pxd

So the above code creates a temporary Python bytes object by copying data
from a char*, then gets the char* to the internal object buffer and throws
the object away, thus deleting its buffer. Then it passes that invalidated
char* into a function. I can't see how this makes any sense. And I'm happy
to see that Cython catches this kind of bug now.
Post by Yaroslav Halchenko
I wondered if that is an intentional restriction now to restrict such casting
only to numeric (and exclude the simplest form -- bytes/chars) or a
regression?
It seems they fixed their code already:

https://github.com/kivy/kivy/commit/827bd6c7b7d04ec72cb3bdbf0ffcd90630d90008

Stefan
Yaroslav Halchenko
2014-10-11 15:13:23 UTC
Permalink
Post by Stefan Behnel
Post by Yaroslav Halchenko
Post by Stefan Behnel
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
a little change detected while down-stream testing builds in Debian
(previous version was 0.20.2 and it built fine)
------------------------------------------------------------
...
vertex_format.last_shader = self
attr = &vertex_format.vattr[i]
continue
attr.index = glGetAttribLocation(self.program, <char *><bytes>attr.name)
^
------------------------------------------------------------
kivy/graphics/shader.pyx:448:63: Casting temporary Python object to non-numeric non-Python type
Wow, interesting piece of code. What's that even supposed to do?
https://github.com/kivy/kivy/blob/master/kivy/graphics/vertex.pxd
So the above code creates a temporary Python bytes object by copying data
from a char*, then gets the char* to the internal object buffer and throws
the object away, thus deleting its buffer. Then it passes that invalidated
char* into a function. I can't see how this makes any sense. And I'm happy
to see that Cython catches this kind of bug now.
Post by Yaroslav Halchenko
I wondered if that is an intentional restriction now to restrict such casting
only to numeric (and exclude the simplest form -- bytes/chars) or a
regression?
https://github.com/kivy/kivy/commit/827bd6c7b7d04ec72cb3bdbf0ffcd90630d90008
Gotcha -- THANKS a bunch for a detailed response!

CCing kivy maintainers in Debian -- get ready for upcoming cython 0.21
upload - a little patch to pick up! ;)
--
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist, Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Yaroslav Halchenko
2014-10-12 03:04:22 UTC
Permalink
Post by Stefan Behnel
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
in two packages (s3ql, python-llfuse) so far I have ran into

Traceback (most recent call last):
File "setup.py", line 304, in <module>
main()
File "setup.py", line 182, in main
command_options={ 'sdist': { 'formats': ('setup.py', 'bztar') } },
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 228, in run
**options)
File "/usr/lib/python3/dist-packages/Cython/Compiler/Main.py", line 620, in compile
options = CompilationOptions(defaults = options, **kwds)
File "/usr/lib/python3/dist-packages/Cython/Compiler/Main.py", line 501, in __init__
', '.join(unknown_options)))
ValueError: got unexpected compilation options: warning_errors, recursive

looking at s3ql those are provided to cython_compile call and packages built
successfully before.

I see that recursive option was removed in 0.20b1~505 so not sure how it built
before with 0.20.2 (probably providing "bogus" options just didn't trigger this
ValueError). Would you advise on the ideal course of patching? (CCing
maintainers of those packages)

P.S. besides those few of manageable failures I have reported, haven't found
any other new hiccups (there also was a failing unittest in bzr but not even
yet sure if cython related or just a fluke), so will shortly upload 0.21 to
Debian sid and backports to -devel repository of NeuroDebian.

Cheers!
--
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist, Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Stefan Behnel
2014-10-12 04:52:55 UTC
Permalink
Hi,

thanks for bringing this up.
Post by Yaroslav Halchenko
Post by Stefan Behnel
on behalf of the Cython dev team, I'm pleased to announce the release of
Cython 0.21, a major feature release. Thanks everyone who contributed code,
documentation improvements, test feedback, bug reports and/or otherwise
helpful insights for this release.
in two packages (s3ql, python-llfuse) so far I have ran into
File "setup.py", line 304, in <module>
main()
File "setup.py", line 182, in main
command_options={ 'sdist': { 'formats': ('setup.py', 'bztar') } },
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 228, in run
**options)
File "/usr/lib/python3/dist-packages/Cython/Compiler/Main.py", line 620, in compile
options = CompilationOptions(defaults = options, **kwds)
File "/usr/lib/python3/dist-packages/Cython/Compiler/Main.py", line 501, in __init__
', '.join(unknown_options)))
ValueError: got unexpected compilation options: warning_errors, recursive
looking at s3ql those are provided to cython_compile call and packages built
successfully before.
I see that recursive option was removed in 0.20b1~505 so not sure how it built
before with 0.20.2 (probably providing "bogus" options just didn't trigger this
ValueError). Would you advise on the ideal course of patching? (CCing
maintainers of those packages)
Those options were previously ignored, so they can safely be removed.

I actually think it would have been nicer (blaming myself here) to start by
raising a visible warning first rather than a hard error. I wasn't aware of
the impact that silently ignoring these options had in the past.

I'll relax it for 0.21.1, which is close anyway.
Post by Yaroslav Halchenko
P.S. besides those few of manageable failures I have reported, haven't found
any other new hiccups (there also was a failing unittest in bzr but not even
yet sure if cython related or just a fluke), so will shortly upload 0.21 to
Debian sid and backports to -devel repository of NeuroDebian.
Thanks!

Stefan

Loading...