File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ object Form1: TForm1
1010  Font.Height = -11 
1111  Font.Name  = ' MS Sans Serif' 
1212  Font.Style = []
13-   OldCreateOrder = True
14-   PixelsPerInch = 96 
1513  TextHeight = 13 
1614  object  Splitter1: TSplitter
1715    Left = 0 
@@ -20,7 +18,6 @@ object Form1: TForm1
2018    Height = 3 
2119    Cursor = crVSplit
2220    Align = alTop
23-     ExplicitWidth = 536 
2421  end 
2522  object  Memo1: TMemo
2623    Left = 0 
Original file line number Diff line number Diff line change @@ -151,6 +151,8 @@ procedure PyPoint_dealloc(obj : PPyObject); cdecl;
151151//  object.value
152152//  object.method(args)
153153function   PyPoint_getattr (obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
154+ var 
155+   Py_Key: PPyObject;
154156begin 
155157  with  GetPythonEngine, PPyPoint(obj)^ do 
156158    begin 
@@ -163,9 +165,14 @@ function  PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
163165      else 
164166        begin 
165167          //  Else check for a method
166-           Result := PyObject_GenericGetAttr(obj, PyUnicodeFromString(key));
167-           if  not  Assigned(Result) then 
168-             PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format(' Unknown attribute "%s"' 
168+           Py_Key := PyUnicodeFromString(key);
169+           try 
170+             Result := PyObject_GenericGetAttr(obj, Py_key);
171+             if  not  Assigned(Result) then 
172+               PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format(' Unknown attribute "%s"' 
173+           finally 
174+             Py_DECREF(Py_Key);
175+           end ;
169176        end ;
170177    end ;
171178end ;
Original file line number Diff line number Diff line change @@ -191,6 +191,8 @@ procedure PyPoint_dealloc(obj : PPyObject); cdecl;
191191//  object.value
192192//  object.method(args)
193193function   PyPoint_getattr (obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
194+ var 
195+   Py_Key: PPyObject;
194196begin 
195197  with  GetPythonEngine, PPyPoint(obj)^ do 
196198    begin 
@@ -203,9 +205,14 @@ function  PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
203205      else 
204206        begin 
205207          //  Else check for a method
206-           Result := PyObject_GenericGetAttr(obj, PyUnicodeFromString(key));
207-           if  not  Assigned(Result) then 
208-             PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format(' Unknown attribute "%s"' 
208+           Py_Key := PyUnicodeFromString(key);
209+           try 
210+             Result := PyObject_GenericGetAttr(obj, Py_Key);
211+             if  not  Assigned(Result) then 
212+               PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format(' Unknown attribute "%s"' 
213+           finally 
214+             Py_DECREF(Py_Key);
215+           end ;
209216        end ;
210217    end ;
211218end ;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments