mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 12:31:04 -05:00
Add support for Python 3.14.0-alpha1
This commit is contained in:
parent
ab25c3e039
commit
e57f7ebc2a
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -15,6 +15,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- python-version: "3.14.0-alpha.1"
|
||||||
|
with-opt-deps: true
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
- python-version: "3.13.0"
|
- python-version: "3.13.0"
|
||||||
with-opt-deps: true
|
with-opt-deps: true
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -1355,12 +1355,8 @@ class CommandProcess(world.SupyProcess):
|
|||||||
pn,
|
pn,
|
||||||
cn)
|
cn)
|
||||||
log.debug('Spawning process %s (args: %r)', procName, args)
|
log.debug('Spawning process %s (args: %r)', procName, args)
|
||||||
self.__parent = super(CommandProcess, self)
|
super().__init__(target=target, name=procName,
|
||||||
self.__parent.__init__(target=target, name=procName,
|
args=args, kwargs=kwargs)
|
||||||
args=args, kwargs=kwargs)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.__parent.run()
|
|
||||||
|
|
||||||
class CanonicalString(registry.NormalizedString):
|
class CanonicalString(registry.NormalizedString):
|
||||||
def normalize(self, s):
|
def normalize(self, s):
|
||||||
|
@ -88,6 +88,20 @@ def _rlimit_min(a, b):
|
|||||||
else:
|
else:
|
||||||
return min(soft, heap_size)
|
return min(soft, heap_size)
|
||||||
|
|
||||||
|
def _process_target(f, q, heap_size, *args, **kwargs):
|
||||||
|
"""Called by :func:`process`"""
|
||||||
|
if resource:
|
||||||
|
rsrc = resource.RLIMIT_DATA
|
||||||
|
(soft, hard) = resource.getrlimit(rsrc)
|
||||||
|
soft = _rlimit_min(soft, heap_size)
|
||||||
|
hard = _rlimit_min(hard, heap_size)
|
||||||
|
resource.setrlimit(rsrc, (soft, hard))
|
||||||
|
try:
|
||||||
|
r = f(*args, **kwargs)
|
||||||
|
q.put([False, r])
|
||||||
|
except Exception as e:
|
||||||
|
q.put([True, e])
|
||||||
|
|
||||||
def process(f, *args, **kwargs):
|
def process(f, *args, **kwargs):
|
||||||
"""Runs a function <f> in a subprocess.
|
"""Runs a function <f> in a subprocess.
|
||||||
|
|
||||||
@ -122,21 +136,9 @@ def process(f, *args, **kwargs):
|
|||||||
'(See https://github.com/travis-ci/travis-core/issues/187\n'
|
'(See https://github.com/travis-ci/travis-core/issues/187\n'
|
||||||
'for more information about this bug.)\n')
|
'for more information about this bug.)\n')
|
||||||
raise
|
raise
|
||||||
def newf(f, q, *args, **kwargs):
|
targetArgs = (f, q, heap_size) + args
|
||||||
if resource:
|
p = callbacks.CommandProcess(target=_process_target,
|
||||||
rsrc = resource.RLIMIT_DATA
|
args=targetArgs, kwargs=kwargs)
|
||||||
(soft, hard) = resource.getrlimit(rsrc)
|
|
||||||
soft = _rlimit_min(soft, heap_size)
|
|
||||||
hard = _rlimit_min(hard, heap_size)
|
|
||||||
resource.setrlimit(rsrc, (soft, hard))
|
|
||||||
try:
|
|
||||||
r = f(*args, **kwargs)
|
|
||||||
q.put([False, r])
|
|
||||||
except Exception as e:
|
|
||||||
q.put([True, e])
|
|
||||||
targetArgs = (f, q,) + args
|
|
||||||
p = callbacks.CommandProcess(target=newf,
|
|
||||||
args=targetArgs, kwargs=kwargs)
|
|
||||||
try:
|
try:
|
||||||
p.start()
|
p.start()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
@ -154,8 +154,16 @@ class SafeEvalVisitor(ast.NodeVisitor):
|
|||||||
return self.visit(node.body)
|
return self.visit(node.body)
|
||||||
|
|
||||||
def visit_Num(self, node):
|
def visit_Num(self, node):
|
||||||
|
"""Python < 3.14 only"""
|
||||||
return self._convert_num(node.n)
|
return self._convert_num(node.n)
|
||||||
|
|
||||||
|
def visit_Constant(self, node):
|
||||||
|
"""Python >= 3.14 only"""
|
||||||
|
if type(node.value) in (float, complex, int):
|
||||||
|
return self._convert_num(node.value)
|
||||||
|
else:
|
||||||
|
raise InvalidNode('illegal constant %s' % node.value)
|
||||||
|
|
||||||
def visit_Name(self, node):
|
def visit_Name(self, node):
|
||||||
id_ = node.id.lower()
|
id_ = node.id.lower()
|
||||||
if id_ in self._env:
|
if id_ in self._env:
|
||||||
|
@ -307,9 +307,9 @@ def perlReToReplacer(s):
|
|||||||
flags = ''.join(flags)
|
flags = ''.join(flags)
|
||||||
r = perlReToPythonRe(sep.join(('', regexp, flags)))
|
r = perlReToPythonRe(sep.join(('', regexp, flags)))
|
||||||
if g:
|
if g:
|
||||||
return lambda s: r.sub(replace, s)
|
return functools.partial(r.sub, replace)
|
||||||
else:
|
else:
|
||||||
return lambda s: r.sub(replace, s, 1)
|
return functools.partial(r.sub, replace, count=1)
|
||||||
|
|
||||||
_perlVarSubstituteRe = re.compile(r'\$\{([^}]+)\}|\$([a-zA-Z][a-zA-Z0-9]*)')
|
_perlVarSubstituteRe = re.compile(r'\$\{([^}]+)\}|\$([a-zA-Z][a-zA-Z0-9]*)')
|
||||||
def perlVariableSubstitute(vars, text):
|
def perlVariableSubstitute(vars, text):
|
||||||
|
@ -65,7 +65,7 @@ class SupyThread(threading.Thread, object):
|
|||||||
log.debug('Spawning thread %q.', self.getName())
|
log.debug('Spawning thread %q.', self.getName())
|
||||||
|
|
||||||
processesSpawned = 1 # Starts at one for the initial process.
|
processesSpawned = 1 # Starts at one for the initial process.
|
||||||
class SupyProcess(multiprocessing.Process):
|
class SupyProcess(multiprocessing.get_context('fork').Process):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
global processesSpawned
|
global processesSpawned
|
||||||
processesSpawned += 1
|
processesSpawned += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user