来源:Cython
浏览 389
扫码
分享
2020-04-04 08:24:18
0.24 (2016-04-04)
Features added
- PEP 498:Literal String Formatting (f-strings).Original patch by Jelle Zijlstra.
- PEP 515:Underscores as visual separators in number literals.
- Parser was adapted to some minor syntax changes in Py3.6, e.g.https://bugs.python.org/issue9232
- The embedded C code comments that show the original source codecan be discarded with the new directive
emit_code_comments=False
. - Cpdef enums are now first-class iterable, callable types in Python.
- Ctuples can now be declared in pure Python code.
- Posix declarations for DLL loading and stdio extensions were added.Patch by Lars Buitinck.
- The Py2-only builtins
unicode()
, xrange()
, reduce()
andlong
are now also available in compile time DEF
expressionswhen compiling with Py3. - Exception type tests have slightly lower overhead.This fixes ticket 868.
- @property syntax fully supported in cdef classes, old syntax deprecated.
- C++ classes can now be declared with default template parameters.
Bugs fixed
- C++ exceptions raised by overloaded C++ operators were not alwayshandled. Patch by Ian Henriksen.
- C string literals were previously always stored as non-const globalvariables in the module. They are now stored as global constantswhen possible, and otherwise as non-const C string literals in thegenerated code that uses them. This improves compatibility withstrict C compiler options and prevents non-const strings literalswith the same content from being incorrectly merged.
- Compile time evaluated
str
expressions (DEF
) now behave in amore useful way by turning into Unicode strings when compiling underPython 3. This allows using them as intermediate values in expressions.Previously, they always evaluated to bytes objects. isinf()
declarations in libc/math.pxd
and numpy/math.pxd
nowreflect the actual tristate int
return value instead of using bint
.- Literal assignments to ctuples avoid Python tuple round-trips in somemore corner cases.
- Iteration over
dict(…).items()
failed to get optimised when dictarguments included keyword arguments. - cProfile now correctly profiles cpdef functions and methods.