try:
global _already_compiling
if _already_compiling:
- # re-entrance to compile() occurs rarely, when a class-mapped construct is
- # used within a ForeignKey, something that is possible
- # when using the declarative layer
- self._post_configure_properties()
return
_already_compiling = True
try:
@testing.resolve_artifact_names
def test_reentrant_compile(self):
- # this trips the _already_compiling
- # flag in mapper.compile(). but if the m2.compile is
- # changed to m1.compile, you still get a stack overflow.
- # not sure why the previous use case did it that way (i.e.
- # it was declarative compiling a mapper within ForeignKey()).
class MyFakeProperty(sa.orm.properties.ColumnProperty):
def post_instrument_class(self, mapper):
super(MyFakeProperty, self).post_instrument_class(mapper)
})
m2 = mapper(Address, addresses)
compile_mappers()
+
+ sa.orm.clear_mappers()
+ class MyFakeProperty(sa.orm.properties.ColumnProperty):
+ def post_instrument_class(self, mapper):
+ super(MyFakeProperty, self).post_instrument_class(mapper)
+ m1.compile()
+
+ m1 = mapper(User, users, properties={
+ 'name':MyFakeProperty(users.c.name)
+ })
+ m2 = mapper(Address, addresses)
+ compile_mappers()
@testing.resolve_artifact_names
def test_reconstructor(self):