Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
41a4e653
Commit
41a4e653
authored
9 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent leaking IntEnum import into module namespace when using cpdef enums
parent
bbbbd03f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Cython/Utility/CpdefEnums.pyx
Cython/Utility/CpdefEnums.pyx
+6
-3
No files found.
Cython/Utility/CpdefEnums.pyx
View file @
41a4e653
...
...
@@ -22,7 +22,7 @@ cdef class __Pyx_EnumMeta(type):
return
cls
.
__members__
[
name
]
# @cython.internal
cdef
type
__Pyx_EnumBase
cdef
object
__Pyx_EnumBase
class
__Pyx_EnumBase
(
int
):
__metaclass__
=
__Pyx_EnumMeta
def
__new__
(
cls
,
value
,
name
=
None
):
...
...
@@ -41,13 +41,16 @@ class __Pyx_EnumBase(int):
def
__str__
(
self
):
return
"%s.%s"
%
(
self
.
__class__
.
__name__
,
self
.
name
)
if
PY_VERSION_HEX
>=
0x03040000
:
from
enum
import
IntEnum
as
__Pyx_EnumBase
#################### EnumType ####################
#@requires: EnumBase
cdef
dict
__Pyx_globals
=
globals
()
if
PY_VERSION_HEX
>=
0x03040000
:
from
enum
import
IntEnum
{{
name
}}
=
IntEnum
(
'{{name}}'
,
__Pyx_OrderedDict
([
# create new IntEnum()
{{
name
}}
=
__Pyx_EnumBase
(
'{{name}}'
,
__Pyx_OrderedDict
([
{{
for
item
in
items
}}
(
'{{item}}'
,
{{
item
}}),
{{
endfor
}}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment