[C++-sig] Re: Re: sub module support in V2

Dave Hawkes daveh at cadlink.com
Sat Jun 8 20:29:53 CEST 2002


Here's the new sub-module code

I've put in the support that allows:

BOOST_PYTHON_MODULES(a1)
{
    boost::python::module("PyTest.sm.sm2");
    boost::python::def("Test3", Test3);
}

where a1 is a name unique to each BOOST_PYTHON_MODULES declaration.

Yes, the support does rely in part on static initialisations but as these
are in the same translation unit as the python init##name then they must be
constructed. If init##name is not called, then it doesn't matter if they are
not constructed anyway. The one thing I have avoided is using any memory
allocation functions in global static initialisers as I've run into problems
when that occurs on occasions.


> > In which case there is no need to keep it there
>
> By "it" you mean module_tail.cpp?
> I care what happens in my tests; I want a crash to crash in a way I can
> debug it.
>

No, I mean't the pre-init stuff I put in. This discussion is moot now as I
have changed it so that a module is initially constructed so the user can
add to it directly without initially creating the parent module.

> > , but on the other hand if it
> > is kept there it has no detrimental effect and may be useful if
something
> is
> > changed in the future that may create the potential of exceptions at
this
> > point.
>
> I don't know what you're talking about here.
>

No, that probably wasn't that clear, but is probably not relavent with the
latest code anyhow.

>
> What about _set_se_translator?
>

Doesn't help, it turns SEH exceptions into c++ exceptions at which point
they become non-continuable which is what we are trying to avoid in the
first place. Also I believe the SEH frame is corrupt after the c++ catch so
it would be difficult to rethrow an SEH exception at that point that could
be continued from it point of origin.

A few years ago I spoke to one of the VC developers about this issue and he
acknowledged other developers had complained as well. Apparently it was
going to be addressed in the next version of VC (VC7), but I have not had a
chance to look at VC7 recently to see if that really happened. At some point
I'll take a look and see if anything was done as there may now be a simpler
solution applicable to VC7.

>     module(".sm");
>     def("Test2", Test2);
>     module("PyTest.sm.sm2");
>     def("Test3", Test3);
> }
>
>
> Nice, but let's dispense with add(...) for classes, as long as you have a
> global which denotes the current module.
>

This patch doesn't do this yet.

Dave Hawkes



begin 666 submodule.zip
M4$L#!!0````(`/Q4R"Q?JJ\E5PT``#<W```.````<W5B;6]D=6QE+F1I9F;E
M6WEOVS at 6_[L!_!W8%DCE6#F<JZG39-OMF46/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0M:[8ZRBFM2F4_'_I79V5<V!X+K-4;5^&K+BR79T&8NG14X),:PTU((
M*"_1E^YXAN FWRK;'#^\\O$F((>$KW:KW)Y=M2WKG>2[I1[I&PI&4*"B]_#2
M>&3X+%G5V)>7& EE\HZ*"F4\,8%'D]$TRG A+WVM0A\*ZWBN#L2M+ZU_RS#(
M;P0ZUI%!V>GK9J9W_55WM"BXS=ZFM;&X5NLR2+I&V:U?*L5$)6M-\_QT\E#^
M>4)__XF[OU_]^X2$7WLT27CB^1$`&\X\DW8T`75EHH3?LDNDG:("U'CO$JQY
M?<*L2;)Z;)19U=2S:.NI;[O:V41\?2%U-=3BT'2+%];<1&W)CLMR3&V52D6S
M$L_*#/[V.U#[#O\@8>G_L#@WMX-L\?7UAX8+$<4-)TOV*1L!Y?PFDBS0G*QR
MC6E!%R!0^=L,VS at L$?,+&I9 UV,&9KR >GGEL:CGYBEHURTOCA:+O9"8N9.%
M9.8-AL/R6V!U31<07F!(AB)X2]1L3?!"PXP5Y_G"/Y4PYXF=M?\`4$L!`A0+
M% ````@`_%3(+%^JKR57#0``-S<```X``````````0`@`````````'-U8FUO
?9'5L92YD:69F4$L%!@`````!``$`/ ```(,-````````
`
end








More information about the Cplusplus-sig mailing list