diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-02 20:47:08 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-02 20:51:07 +0200 |
commit | ef423d1e9c9e67a24db0e61b7b334983858fa581 (patch) | |
tree | be32d5eef0ee762d5800f1fa884c8c604f43b866 | |
parent | 0f1c1cbd490b6e49e3de0e250e6be0dee60c032f (diff) | |
download | cython-ef423d1e9c9e67a24db0e61b7b334983858fa581.tar.gz |
Use a constant sentinel value in Plex instead of making it depend on the (32/64 bit) architecture.
Closes #3659.
-rw-r--r-- | Cython/Plex/Machines.pxd | 2 | ||||
-rw-r--r-- | Cython/Plex/Machines.py | 5 | ||||
-rw-r--r-- | Cython/Plex/Regexps.py | 6 | ||||
-rw-r--r-- | Cython/Plex/Transitions.py | 6 |
4 files changed, 6 insertions, 13 deletions
diff --git a/Cython/Plex/Machines.pxd b/Cython/Plex/Machines.pxd index 786f6c030..8f785a07c 100644 --- a/Cython/Plex/Machines.pxd +++ b/Cython/Plex/Machines.pxd @@ -3,6 +3,8 @@ cimport cython from .Actions cimport Action from .Transitions cimport TransitionMap +cdef long maxint + @cython.final cdef class Machine: diff --git a/Cython/Plex/Machines.py b/Cython/Plex/Machines.py index 6971bb3fb..a56aff87d 100644 --- a/Cython/Plex/Machines.py +++ b/Cython/Plex/Machines.py @@ -9,10 +9,7 @@ from __future__ import absolute_import import cython from .Transitions import TransitionMap -try: - from sys import maxsize as maxint -except ImportError: - from sys import maxint +maxint = 2**31-1 # sentinel value if not cython.compiled: try: diff --git a/Cython/Plex/Regexps.py b/Cython/Plex/Regexps.py index 450de09ab..99d8c994a 100644 --- a/Cython/Plex/Regexps.py +++ b/Cython/Plex/Regexps.py @@ -6,13 +6,11 @@ Regular Expressions from __future__ import absolute_import import types -try: - from sys import maxsize as maxint -except ImportError: - from sys import maxint from . import Errors +maxint = 2**31-1 # sentinel value + # # Constants # diff --git a/Cython/Plex/Transitions.py b/Cython/Plex/Transitions.py index 9fce766c1..f58dd538e 100644 --- a/Cython/Plex/Transitions.py +++ b/Cython/Plex/Transitions.py @@ -4,12 +4,8 @@ Plex - Transition Maps This version represents state sets directly as dicts for speed. """ -from __future__ import absolute_import -try: - from sys import maxsize as maxint -except ImportError: - from sys import maxint +maxint = 2**31-1 # sentinel value class TransitionMap(object): |