Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if Cython enum is used outside a typed context #5642

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cython/Compiler/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,7 @@ def check_identifier_kind(self):
entry = self.entry
if entry.is_type and entry.type.is_extension_type:
self.type_entry = entry
if entry.is_type and (entry.type.is_enum or entry.type.is_cpp_enum):
if entry.is_type and (entry.type.is_enum or entry.type.is_cpp_enum) and entry.create_wrapper:
py_entry = Symtab.Entry(self.name, None, py_object_type)
py_entry.is_pyglobal = True
py_entry.scope = self.entry.scope
Expand Down
10 changes: 10 additions & 0 deletions tests/errors/e_cenum_expr.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# mode: error

cdef enum Foo:
d

Foo

_ERRORS = u"""
6:0: 'Foo' is not a constant, variable or function identifier
"""