2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Fixed bug where the code for wrappers of member functions were defined outside

the pyste namespace. Reported by Dan Haffey.


[SVN r28479]
This commit is contained in:
Bruno da Silva de Oliveira
2005-04-25 23:49:21 +00:00
parent 2bbff71109
commit e5ed3a1c6c
8 changed files with 36 additions and 18 deletions

View File

@@ -1,3 +1,7 @@
25 April 2005
- Fixed bug where the code for wrappers of member functions were defined outside
the pyste namespace. Reported by Dan Haffey.
9 October 2004
- Applied a patch by Christian Hudon that fixed an issue with files
that had a tail and relative includes.

View File

@@ -253,8 +253,11 @@ class ClassExporter(Exporter):
return init
constructors = [x for x in self.public_members if isinstance(x, Constructor)]
# don't export copy constructors if the class is abstract
# we could remove all constructors, but this will have the effect of
# inserting no_init in the declaration, which would not allow
# even subclasses to be instantiated.
self.constructors = constructors[:]
# don't export constructors if the class is abstract
if self.class_.abstract:
for cons in constructors:
if cons.IsCopy():
@@ -277,6 +280,7 @@ class ClassExporter(Exporter):
for cons in constructors:
code = '.def(%s)' % init_code(cons)
self.Add('inside', code)
# check if the class is copyable
if not self.class_.HasCopyConstructor() or self.class_.abstract:
self.Add('template', namespaces.boost + 'noncopyable')
@@ -392,7 +396,7 @@ class ClassExporter(Exporter):
# add wrapper code if this method has one
wrapper = method_info.wrapper
if wrapper and wrapper.code:
self.Add('declaration-outside', wrapper.code)
self.Add('declaration', wrapper.code)
# export staticmethod statements
for name in staticmethods:

View File

@@ -4,7 +4,12 @@
# http:#www.boost.org/LICENSE_1_0.txt)
from declarations import *
from elementtree.ElementTree import ElementTree
# try to use cElementTree if avaiable
try:
from cElementTree import ElementTree
except ImportError:
# fall back to the normal elementtree
from elementtree.ElementTree import ElementTree
from xml.parsers.expat import ExpatError
from copy import deepcopy
from utils import enumerate
@@ -403,12 +408,8 @@ class GCCXMLParser(object):
classname = self.GetDecl(element.get('context')).FullName()
location = self.GetLocation(element.get('location'))
params = self.GetArguments(element)
artificial = element.get('artificial', False)
if not artificial:
ctor = Constructor(name, classname, params, visib)
else:
# we don't want artificial constructors
ctor = Unknown('__Unknown_Element_%s' % id)
artificial = element.get('artificial', False)
ctor = Constructor(name, classname, params, visib)
ctor.location = location
self.Update(id, ctor)

View File

@@ -5,3 +5,6 @@
*.arg
*.dll
.sconsign
cache
*.cpp
*.pch

View File

@@ -8,8 +8,8 @@ sys.path.append('../src')
import unittest
import tempfile
import os.path
import GCCXMLParser
from declarations import *
from Pyste import GCCXMLParser
from Pyste.declarations import *
class Tester(unittest.TestCase):

View File

@@ -3,13 +3,14 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http:#www.boost.org/LICENSE_1_0.txt)
import sys
sys.path.append('../src')
from infos import *
from policies import *
from exporterutils import *
from Pyste.infos import *
from Pyste.policies import *
from Pyste.exporterutils import *
import unittest
#================================================================================
# InfosTest
#================================================================================
class InfosTest(unittest.TestCase):
def testFunctionInfo(self):

View File

@@ -8,6 +8,7 @@ namespace inherit3 {
struct A
{
A() { x = 0; }
struct X { int y; };
int x;
virtual int foo() { return 0; }
@@ -24,6 +25,7 @@ struct A
struct B: A
{
B() { x = 0; }
struct X { int y; };
int x;
int foo() { return 1; }

View File

@@ -3,10 +3,13 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http:#www.boost.org/LICENSE_1_0.txt)
import sys
sys.path.append('../src')
import unittest
from policies import *
from Pyste.policies import *
#================================================================================
# PolicicesTest
#================================================================================
class PoliciesTest(unittest.TestCase):
def testReturnInternal(self):