From da38498e6fda4d53c1ef3454a5bc05d731ab5010 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 19 Feb 2010 20:47:58 -0800 Subject: [PATCH] Use string literals for namespace (rather than dotted names). --- Cython/Compiler/Parsing.py | 2 +- tests/run/cpp_classes.pyx | 2 +- tests/run/cpp_stl.pyx | 2 +- tests/run/cpp_stl_vector.pyx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 20ed8eb0..8ca741ba 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -2278,7 +2278,7 @@ def p_cdef_extern_block(s, pos, ctx): _, include_file = p_string_literal(s) if s.systring == "namespace": s.next() - ctx.namespace = p_dotted_name(s, as_allowed=False)[2].replace('.', '::') + ctx.namespace = p_string_literal(s)[1] ctx = ctx(cdef_flag = 1, visibility = 'extern') if p_nogil(s): ctx.nogil = 1 diff --git a/tests/run/cpp_classes.pyx b/tests/run/cpp_classes.pyx index 438e3ffa..8ddcba1a 100644 --- a/tests/run/cpp_classes.pyx +++ b/tests/run/cpp_classes.pyx @@ -7,7 +7,7 @@ __doc__ = u""" (225.0, 225.0) """ -cdef extern from "shapes.h" namespace shapes: +cdef extern from "shapes.h" namespace "shapes": cdef cppclass Shape: float area() diff --git a/tests/run/cpp_stl.pyx b/tests/run/cpp_stl.pyx index 4b8af28a..93a442af 100644 --- a/tests/run/cpp_stl.pyx +++ b/tests/run/cpp_stl.pyx @@ -5,7 +5,7 @@ __doc__ = u""" 100 """ -cdef extern from "vector" namespace std: +cdef extern from "vector" namespace "std": cdef cppclass iterator[T]: pass diff --git a/tests/run/cpp_stl_vector.pyx b/tests/run/cpp_stl_vector.pyx index f6a81b57..159d2bd0 100644 --- a/tests/run/cpp_stl_vector.pyx +++ b/tests/run/cpp_stl_vector.pyx @@ -1,4 +1,4 @@ -cdef extern from "" namespace std: +cdef extern from "" namespace "std": cdef cppclass vector[T]: void push_back(T) -- 2.26.2