Jump to content

pyscripter

Members
  • Content Count

    1019
  • Joined

  • Last visited

  • Days Won

    66

Posts posted by pyscripter


  1. On 11/8/2023 at 7:28 PM, Uwe Raabe said:

    Indeed, for me the biggest enhancement is the handling of font sizes regarding dpi changes.

    Like most new features and bug fixes, this introduces new bugs:

    https://quality.embarcadero.com/browse/RSP-43261

    https://quality.embarcadero.com/browse/RSP-43263

     

    Update  I found a third even more serious issue related to the changes introduced for font scaling:

    https://quality.embarcadero.com/browse/RSP-43270

    • Like 1

  2. 2 hours ago, Uwe Raabe said:

    Indeed, for me the biggest enhancement is the handling of font sizes regarding dpi changes. This eliminates a plethora of workarounds

    The problem is that if you maintain open source components that support many versions of Delphi, this does not eliminate anything.  It just adds another IFDEF in the code.  Having said that, it is good to see it fixed.

    • Like 2

  3. 1 hour ago, Uwe Raabe said:

    Besides that, there are currently 15 issues I reported in Quality Portal marked fixed in this release.

    @Uwe RaabeUnfortunately though, your [RSP-35301] Option to design in Screen PPI but save in 96 PPI - Embarcadero Technologies is not, despite the many votes it got.  And by the way thanks for your article.  Highly recommended.

     

    Three of my reported issues were fixed and one more is wrongly marked as fixed (https://quality.embarcadero.com/browse/RSP-31137).  But I have to agree with @David Heffernan that the list of new features is rather underwhelming, if you are  not using C++ Builder.  David what do you think of the change related to floating point exceptions? 


  4. 2 hours ago, mbaghb said:

    The point that I noticed is the large size of the DLL file,

    I have no idea why and how you are building a DLL, but from the size I can  tell that you are pulling in a large chank of the Delphi RTL.

     

    2 hours ago, mbaghb said:

    And another point, is there a complete document of all functions, methods, etc. for P4D that I can download?

    Not except the source code.

    • Like 1

  5. In case you have not heard, Python 12 made a breakthrough towards running threads in parallel.  For now, the feature is only available through the C-API and there are limitations.   But still, the performance boost that comes from the exploitation of multiple cores makes this feature very desirable.  P4D makes this feature very easily accessible by adding a new execution mode to TPythonThread.  There is also a new demo (Demo 36) that shows how to run threads in parallel.  If you are wondering about the performance boost, see the results below:

     

    Classic Subinterpreters:
    prime count 78498
    prime count 78498
    prime count 78498
    prime count 78498
    prime count 78498
    Elapsed ms: 13695
    
    Subinterpreters with own GIL:
    prime count 78498
    prime count 78498
    prime count 78498
    prime count 78498
    prime count 78498
    Elapsed ms: 3482

    You can find more details in this P4D announcement.


  6. 3 hours ago, pyscripter said:

    Any idea why the compiler does not free TerminateProc on its own Is this a compiler bug?

    Answer myself.   I remember having seen these some time ago, when I have been bitten by this again:

     

    delphi - Memory leaks happens in nested anonymous method - Stack Overflow

    TURBU Tech » Blog Archive » How to leak a class you never defined (turbu-rpg.com)  (see Barry Kelly's comment).

     

    • Like 1

  7. This is a simplified version of what I had in my app.

    procedure Test();
    var
      TerminateProc: TThreadProcedure;
      S: string;
    begin
      S := 'Terminated';
    
      TerminateProc :=
        procedure
        begin
          ShowMessage(S);
        end;
    
      TThread.CreateAnonymousThread(
      procedure
      begin
        // Do stuff
    
        TThread.Queue(nil, TerminateProc);
        TerminateProc := nil; //  Memory leak without this
      end).Start;
    end;

    I had to insert the statement with the comment "Memory leak without this"  to avoid memory leaks.   Any idea why the compiler does not free TerminateProc on its own?  Is this a compiler bug?


  8. 51 minutes ago, dnbif72 said:

    Well somewhere along the line I must of thought I was getting an address to the pointer to the memory block that held the data, and that it would magically cast to what I wanted!  I can see now, that should be a Py_buffer object, which does have the void* buffer at the beginning of the structure so that's why I was seeing and able to copy the data, but I guess it (and or the associated PyObject) needs to be released.  I can copy the structure and likely get that to work, but I would still need to replicate the Py_Buffer_Release() routine.  Unless your seeing something else I am missing here?

    Your code leads to memory corruption.    PyArg_ParseTuple(args,"y*",&data);   will copy the Py_Buffer structure to the address of data overwriting whatever was after that.

    If you wait for a few days, I will add the Py_Buffer stuff to P4D and provide an example of getting raw access to nympy.ndarray data.

     

    Looking forward to receiving C++ Builder installation instructions!


  9. @dnbif72By the way, since I am not using C++ Builder, I am looking for someone to provide detailed instructions for installing P4D in C++ Builder.    The instructions provide David Intersimone are outdated.   See for example: No Python_D.dproj project file inside python4delphi-master\Packages\Delphi\Delphi 10.4+. · Issue #416 · pyscripter/python4delphi (github.com) 

     

    Could you please help?


  10. 8 hours ago, dnbif72 said:

    double * data;

     

      int ret = eng->PyArg_ParseTuple(args,"y*",&data);

    What do you expect to be passed to data?

    Please see the docs: Parsing arguments and building values — Python 3.12.0 documentation

     

    "y*" is one of the most esoteric formats.  This is the correct way of using it by Victor Stinner one of the python gurus (from this web page).

    static PyObject * 
    getargs_y_star(PyObject *self, PyObject *args) 
    { 
    	Py_buffer buffer; 
    	PyObject *bytes; 
    	if (!PyArg_ParseTuple(args, "y*", &buffer)) return NULL; 
    	bytes = PyBytes_FromStringAndSize(buffer.buf, buffer.len); 
    	PyBuffer_Release(&buffer); 
    	return bytes; 
    }

    Note that the Py_buffer structure and related functions are not yet defined in P4D, so you will have to get it from the python headers.


  11. As per title.

     

    For instance:

     

    A)  Second method hides the first

     

    ClassA = class
      procedure Test(I: Integer);
    end;
    
    ClassB = class(classA)
      procedure Test(S: string);
    end;

     

    B)  Second method overloads the first
     

    ClassA = class
      procedure Test(I: Integer); overload;
    end;
    
    ClassB = class(classA)
      procedure Test(S: string); overload;
    end;

     

    How can you tell the difference with Rtti.  GetMethods would show both methods in a similar way.

×