diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2013-03-09 11:08:36 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2013-03-09 11:08:36 +0100 |
commit | 9f1600bc9286b74ea1f7be42c0b50b16ba0962e3 (patch) | |
tree | 08b01b34b35ab5c55b0f90c93988cdf4cf72d4e0 /Cython/Compiler/ModuleNode.py | |
parent | a5403b1bfa9bd81ab08d136dfceb14907cb25d16 (diff) | |
download | cython-9f1600bc9286b74ea1f7be42c0b50b16ba0962e3.tar.gz |
reduce default decoding overhead in Py3
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index b433e9a24..aeb2cad94 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -562,8 +562,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if c_string_type != 'bytes' and not c_string_encoding: error(self.pos, "a default encoding must be provided if c_string_type != bytes") code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII %s' % int(c_string_encoding == 'ascii')) - code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT %s' % int(c_string_encoding == 'default')) - code.putln('#define __PYX_DEFAULT_STRING_ENCODING "%s"' % c_string_encoding) + if c_string_encoding == 'default': + code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 1') + else: + code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0') + code.putln('#define __PYX_DEFAULT_STRING_ENCODING "%s"' % c_string_encoding) code.putln('#define __Pyx_PyObject_FromString __Pyx_Py%s_FromString' % c_string_type.title()) code.putln('#define __Pyx_PyObject_FromStringAndSize __Pyx_Py%s_FromStringAndSize' % c_string_type.title()) code.put(UtilityCode.load_as_string("TypeConversions", "TypeConversion.c")[0]) |