aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Compiler/Nodes.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/cython/Cython/Compiler/Nodes.py
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/Nodes.py')
-rw-r--r--contrib/tools/cython/Cython/Compiler/Nodes.py122
1 files changed, 61 insertions, 61 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Nodes.py b/contrib/tools/cython/Cython/Compiler/Nodes.py
index 6436c5002d..8c7952e804 100644
--- a/contrib/tools/cython/Cython/Compiler/Nodes.py
+++ b/contrib/tools/cython/Cython/Compiler/Nodes.py
@@ -1048,8 +1048,8 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
type = PyrexTypes.TemplatePlaceholderType(self.name)
else:
error(self.pos, "'%s' is not a type identifier" % self.name)
- if type and type.is_fused and env.fused_to_specific:
- type = type.specialize(env.fused_to_specific)
+ if type and type.is_fused and env.fused_to_specific:
+ type = type.specialize(env.fused_to_specific)
if self.complex:
if not type.is_numeric or type.is_complex:
error(self.pos, "can only complexify c numeric types")
@@ -1382,9 +1382,9 @@ class CVarDefNode(StatNode):
self.entry.type.create_to_py_utility_code(env)
self.entry.create_wrapper = True
else:
- if self.overridable:
- warning(self.pos, "cpdef variables will not be supported in Cython 3; "
- "currently they are no different from cdef variables", 2)
+ if self.overridable:
+ warning(self.pos, "cpdef variables will not be supported in Cython 3; "
+ "currently they are no different from cdef variables", 2)
if self.directive_locals:
error(self.pos, "Decorators can only be followed by functions")
self.entry = dest_scope.declare_var(
@@ -3235,14 +3235,14 @@ class DefNode(FuncDefNode):
def put_into_closure(entry):
if entry.in_closure:
code.putln('%s = %s;' % (entry.cname, entry.original_cname))
- if entry.xdecref_cleanup:
- # mostly applies to the starstar arg - this can sometimes be NULL
- # so must be xincrefed instead
- code.put_var_xincref(entry)
- code.put_var_xgiveref(entry)
- else:
- code.put_var_incref(entry)
- code.put_var_giveref(entry)
+ if entry.xdecref_cleanup:
+ # mostly applies to the starstar arg - this can sometimes be NULL
+ # so must be xincrefed instead
+ code.put_var_xincref(entry)
+ code.put_var_xgiveref(entry)
+ else:
+ code.put_var_incref(entry)
+ code.put_var_giveref(entry)
for arg in self.args:
put_into_closure(arg.entry)
for arg in self.star_arg, self.starstar_arg:
@@ -4156,10 +4156,10 @@ class GeneratorBodyDefNode(DefNode):
cname=cname, visibility='private')
entry.func_cname = cname
entry.qualified_name = EncodedString(self.name)
- # Work-around for https://github.com/cython/cython/issues/1699
- # We don't currently determine whether the generator entry is used or not,
- # so mark it as used to avoid false warnings.
- entry.used = True
+ # Work-around for https://github.com/cython/cython/issues/1699
+ # We don't currently determine whether the generator entry is used or not,
+ # so mark it as used to avoid false warnings.
+ entry.used = True
self.entry = entry
def analyse_declarations(self, env):
@@ -4511,22 +4511,22 @@ class PyClassDefNode(ClassDefNode):
pass # no base classes => no inherited metaclass
else:
self.metaclass = ExprNodes.PyClassMetaclassNode(
- pos, class_def_node=self)
+ pos, class_def_node=self)
needs_metaclass_calculation = False
else:
needs_metaclass_calculation = True
self.dict = ExprNodes.PyClassNamespaceNode(
- pos, name=name, doc=doc_node, class_def_node=self)
+ pos, name=name, doc=doc_node, class_def_node=self)
self.classobj = ExprNodes.Py3ClassNode(
- pos, name=name, class_def_node=self, doc=doc_node,
+ pos, name=name, class_def_node=self, doc=doc_node,
calculate_metaclass=needs_metaclass_calculation,
allow_py2_metaclass=allow_py2_metaclass)
else:
# no bases, no metaclass => old style class creation
self.dict = ExprNodes.DictNode(pos, key_value_pairs=[])
self.classobj = ExprNodes.ClassNode(
- pos, name=name, class_def_node=self, doc=doc_node)
+ pos, name=name, class_def_node=self, doc=doc_node)
self.target = ExprNodes.NameNode(pos, name=name)
self.class_cell = ExprNodes.ClassCellInjectorNode(self.pos)
@@ -4544,7 +4544,7 @@ class PyClassDefNode(ClassDefNode):
visibility='private',
module_name=None,
class_name=self.name,
- bases=self.bases or ExprNodes.TupleNode(self.pos, args=[]),
+ bases=self.bases or ExprNodes.TupleNode(self.pos, args=[]),
decorators=self.decorators,
body=self.body,
in_pxd=False,
@@ -4568,10 +4568,10 @@ class PyClassDefNode(ClassDefNode):
args=[class_result])
self.decorators = None
self.class_result = class_result
- if self.bases:
- self.bases.analyse_declarations(env)
- if self.mkw:
- self.mkw.analyse_declarations(env)
+ if self.bases:
+ self.bases.analyse_declarations(env)
+ if self.mkw:
+ self.mkw.analyse_declarations(env)
self.class_result.analyse_declarations(env)
self.target.analyse_target_declaration(env)
cenv = self.create_scope(env)
@@ -4582,8 +4582,8 @@ class PyClassDefNode(ClassDefNode):
def analyse_expressions(self, env):
if self.bases:
self.bases = self.bases.analyse_expressions(env)
- if self.mkw:
- self.mkw = self.mkw.analyse_expressions(env)
+ if self.mkw:
+ self.mkw = self.mkw.analyse_expressions(env)
if self.metaclass:
self.metaclass = self.metaclass.analyse_expressions(env)
self.dict = self.dict.analyse_expressions(env)
@@ -4610,22 +4610,22 @@ class PyClassDefNode(ClassDefNode):
self.metaclass.generate_evaluation_code(code)
self.dict.generate_evaluation_code(code)
cenv.namespace_cname = cenv.class_obj_cname = self.dict.result()
-
- class_cell = self.class_cell
- if class_cell is not None and not class_cell.is_active:
- class_cell = None
-
- if class_cell is not None:
- class_cell.generate_evaluation_code(code)
+
+ class_cell = self.class_cell
+ if class_cell is not None and not class_cell.is_active:
+ class_cell = None
+
+ if class_cell is not None:
+ class_cell.generate_evaluation_code(code)
self.body.generate_execution_code(code)
self.class_result.generate_evaluation_code(code)
- if class_cell is not None:
- class_cell.generate_injection_code(
- code, self.class_result.result())
- if class_cell is not None:
- class_cell.generate_disposal_code(code)
- class_cell.free_temps(code)
-
+ if class_cell is not None:
+ class_cell.generate_injection_code(
+ code, self.class_result.result())
+ if class_cell is not None:
+ class_cell.generate_disposal_code(code)
+ class_cell.free_temps(code)
+
cenv.namespace_cname = cenv.class_obj_cname = self.classobj.result()
self.target.generate_assignment_code(self.class_result, code)
self.dict.generate_disposal_code(code)
@@ -5876,7 +5876,7 @@ class DelStatNode(StatNode):
arg.generate_evaluation_code(code)
code.putln("delete %s;" % arg.result())
arg.generate_disposal_code(code)
- arg.free_temps(code)
+ arg.free_temps(code)
# else error reported earlier
def annotate(self, code):
@@ -6005,7 +6005,7 @@ class ReturnStatNode(StatNode):
rhs=value,
code=code,
have_gil=self.in_nogil_context)
- value.generate_post_assignment_code(code)
+ value.generate_post_assignment_code(code)
elif self.in_generator:
# return value == raise StopIteration(value), but uncatchable
code.globalstate.use_utility_code(
@@ -6019,7 +6019,7 @@ class ReturnStatNode(StatNode):
code.putln("%s = %s;" % (
Naming.retval_cname,
value.result_as(self.return_type)))
- value.generate_post_assignment_code(code)
+ value.generate_post_assignment_code(code)
value.free_temps(code)
else:
if self.return_type.is_pyobject:
@@ -6421,8 +6421,8 @@ class SwitchStatNode(StatNode):
# generate the switch statement, so shouldn't be bothered).
code.putln("default: break;")
code.putln("}")
- self.test.generate_disposal_code(code)
- self.test.free_temps(code)
+ self.test.generate_disposal_code(code)
+ self.test.free_temps(code)
def generate_function_definitions(self, env, code):
self.test.generate_function_definitions(env, code)
@@ -7688,8 +7688,8 @@ class TryFinallyStatNode(StatNode):
code.funcstate.release_temp(ret_temp)
if self.in_generator:
self.put_error_uncatcher(code, exc_vars)
- for cname in exc_vars:
- code.funcstate.release_temp(cname)
+ for cname in exc_vars:
+ code.funcstate.release_temp(cname)
if not self.finally_clause.is_terminator:
code.put_goto(old_label)
@@ -8786,11 +8786,11 @@ class ParallelStatNode(StatNode, ParallelNode):
self.begin_of_parallel_control_block_point = None
self.begin_of_parallel_control_block_point_after_decls = None
- if self.num_threads is not None:
- # FIXME: is it the right place? should not normally produce code.
- self.num_threads.generate_disposal_code(code)
- self.num_threads.free_temps(code)
-
+ if self.num_threads is not None:
+ # FIXME: is it the right place? should not normally produce code.
+ self.num_threads.generate_disposal_code(code)
+ self.num_threads.free_temps(code)
+
# Firstly, always prefer errors over returning, continue or break
if self.error_label_used:
c.putln("const char *%s = NULL; int %s = 0, %s = 0;" % self.parallel_pos_info)
@@ -9132,7 +9132,7 @@ class ParallelRangeNode(ParallelStatNode):
# TODO: check if the step is 0 and if so, raise an exception in a
# 'with gil' block. For now, just abort
- code.putln("if ((%(step)s == 0)) abort();" % fmt_dict)
+ code.putln("if ((%(step)s == 0)) abort();" % fmt_dict)
self.setup_parallel_control_flow_block(code) # parallel control flow block
@@ -9166,7 +9166,7 @@ class ParallelRangeNode(ParallelStatNode):
# And finally, release our privates and write back any closure
# variables
- for temp in start_stop_step + (self.chunksize,):
+ for temp in start_stop_step + (self.chunksize,):
if temp is not None:
temp.generate_disposal_code(code)
temp.free_temps(code)
@@ -9253,15 +9253,15 @@ class ParallelRangeNode(ParallelStatNode):
code.putln("%(target)s = (%(target_type)s)(%(start)s + %(step)s * %(i)s);" % fmt_dict)
self.initialize_privates_to_nan(code, exclude=self.target.entry)
- if self.is_parallel and not self.is_nested_prange:
- # nested pranges are not omp'ified, temps go to outer loops
+ if self.is_parallel and not self.is_nested_prange:
+ # nested pranges are not omp'ified, temps go to outer loops
code.funcstate.start_collecting_temps()
self.body.generate_execution_code(code)
self.trap_parallel_exit(code, should_flush=True)
- if self.is_parallel and not self.is_nested_prange:
- # nested pranges are not omp'ified, temps go to outer loops
- self.privatize_temps(code)
+ if self.is_parallel and not self.is_nested_prange:
+ # nested pranges are not omp'ified, temps go to outer loops
+ self.privatize_temps(code)
if self.breaking_label_used:
# Put a guard around the loop body in case return, break or