--- /dev/null
+from Symtab import ModuleScope
+from PyrexTypes import *
+
+shape_func_type = CFuncType(
+ c_ptr_type(c_py_ssize_t_type),
+ [CFuncTypeArg("buffer", py_object_type, None)])
+
+class CythonScope(ModuleScope):
+ def __init__(self, context):
+ ModuleScope.__init__(self, u'cython', None, context)
+ self.pxd_file_loaded = True
+
+ self.shape_entry = self.declare_cfunction('shape',
+ shape_func_type,
+ pos=None,
+ visibility='public',
+ cname='<error>')
+
+def create_cython_scope(context):
+ return CythonScope(context)
from Symtab import BuiltinScope, ModuleScope
from Cython import Utils
from Cython.Utils import open_new_file, replace_suffix
+import CythonScope
module_name_pattern = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$")
def __init__(self, include_directories, pragma_overrides):
#self.modules = {"__builtin__" : BuiltinScope()}
- import Builtin
+ import Builtin, CythonScope
self.modules = {"__builtin__" : Builtin.builtin_scope}
+ self.modules["cython"] = CythonScope.create_cython_scope(self)
self.include_directories = include_directories
self.future_directives = set()
self.pragma_overrides = pragma_overrides
from ParseTreeTransforms import WithTransform, NormalizeTree, PostParse, PxdPostParse
from ParseTreeTransforms import AnalyseDeclarationsTransform, AnalyseExpressionsTransform
from ParseTreeTransforms import CreateClosureClasses, MarkClosureVisitor, DecoratorTransform
- from ParseTreeTransforms import ResolveOptions
+ from ParseTreeTransforms import ResolveOptions, SpecialFunctions
from Optimize import FlattenInListTransform, SwitchTransform, OptimizeRefcounting
from Buffer import IntroduceBufferAuxiliaryVars
from ModuleNode import check_c_classes
AnalyseExpressionsTransform(self),
SwitchTransform(),
OptimizeRefcounting(self),
+ SpecialFunctions(self),
# CreateClosureClasses(context),
]
return module_node
return ([
- create_parse(self)
+ create_parse(self),
] + self.create_pipeline(pxd=False) + [
inject_pxd_code,
generate_pyx_code,
if debug_find_module:
print("Context.find_module: module_name = %s, relative_to = %s, pos = %s, need_pxd = %s" % (
module_name, relative_to, pos, need_pxd))
+
scope = None
pxd_pathname = None
if not module_name_pattern.match(module_name):