Skip to content

Instantly share code, notes, and snippets.

@robertwb
Created August 16, 2016 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertwb/ddce00931e24540b64db27b9464a162d to your computer and use it in GitHub Desktop.
Save robertwb/ddce00931e24540b64db27b9464a162d to your computer and use it in GitHub Desktop.
Attachment declare_const.patch for http://trac.cython.org/ticket/185
# HG changeset patch
# User Jason Evans <jasone@canonware.com>
# Date 1232168582 28800
# Node ID 18643350b1c548c9ec5cdd0721446ddd5c877b9d
# Parent 682a2248596fd367913d0c67d2fbd762d5226606
Do not mangle enum constant names if the enum is public.
diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py
--- a/Cython/Compiler/Symtab.py
+++ b/Cython/Compiler/Symtab.py
@@ -303,7 +303,7 @@
def declare_const(self, name, type, value, pos, cname = None, visibility = 'private'):
# Add an entry for a named constant.
if not cname:
- if self.in_cinclude:
+ if self.in_cinclude or visibility == 'public':
cname = name
else:
cname = self.mangle(Naming.enum_prefix, name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment