diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-11 20:55:39 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-11 20:55:39 +0200 |
commit | 0c7ceb3dbab787b607fec62a02a5d8f12c8689bc (patch) | |
tree | ecc88d70c46c61df380b92113dd80578bbf79ccb | |
parent | 89a68b86ba99291bfce1c70657b869934efec204 (diff) | |
download | cython-0c7ceb3dbab787b607fec62a02a5d8f12c8689bc.tar.gz |
Minor code simplification.
-rw-r--r-- | Cython/Compiler/ExprNodes.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index c39e0b18a..d4e5fe970 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1651,12 +1651,9 @@ class UnicodeNode(ConstNode): if dst_type.is_string and self.bytes_value is not None: # special case: '-3' enforced unicode literal used in a # C char* context - return BytesNode(self.pos, value=self.bytes_value - ).coerce_to(dst_type, env) + return BytesNode(self.pos, value=self.bytes_value).coerce_to(dst_type, env) if dst_type.is_pyunicode_ptr: - node = UnicodeNode(self.pos, value=self.value) - node.type = dst_type - return node + return UnicodeNode(self.pos, value=self.value, type=dst_type) error(self.pos, "Unicode literals do not support coercion to C types other " "than Py_UNICODE/Py_UCS4 (for characters) or Py_UNICODE* " |