[C++-sig] Pyste patch to generate default policy for virtual methods

paul.bridger paul.bridger at paradise.net.nz
Wed Jun 2 02:24:13 CEST 2004


Nicodemus,

For virtual methods, Pyste doesn't
a) complain when they aren't given a policy, and
b) give them the default return_value_policy(copy_const_reference)
Here's a patch for that.
I also made Pyste insert comments in generated code to show where various 
elements are exported. I have found this useful in editing my pyste files, 
but I don't care if you don't want that for mainstream Pyste.

Paul Bridger

ClassExporter.py
275a276,277
 >             if constructors:
 >                 self.Add('inside', '// Additional constructors')
286a289,290
 >         if vars:
 >             self.Add('inside', '// Class Variables')
288c292
<             if self.info[var.name].exclude:
---
 >             if self.info[var.name].exclude:
355a360,361
 >         if methods:
 >             self.Add('inside', '// Methods')
365c371
<
---
 >
425a432
 >             self.Add('inside', '// Virtual Methods')
505a513,514
 >         if operators:
 >             self.Add('inside', '// Operators')
778,779c787,792
<         # Add policy to overloaded methods also
<         policy = self.info[method.name].policy or ''
---
 >         # warn the user if this method needs a policy and doesn't have one
 >         method_info = self.info[method.name]
 >         method_info.policy = exporterutils.HandlePolicy(method, 
method_info.policy)
 >
 >         # Add policy to overloaded methods also
 >         policy = method_info.policy or ''




More information about the Cplusplus-sig mailing list