How do MATLAB and/or Python treat $2^n$ samples rule in FFT
Matlab doesn’t require the number of samples to be a power of 2. You can read more about it in Matlab FFT help page.
It will handle any length of signal and will not truncate or pad the length unless you specifically say so.
BTW in the help page it says that Matlab FFT is based on FFTW. In the FFTW documentation it says:


  FFTW is best at handling sizes of the form 2^a 3^b 5^c 7^d 11^e 13^f, where e+f is either 0 or 1, and the other exponents are arbitrary. Other sizes are computed by means of a slow, general-purpose algorithm (which nevertheless retains O(n log n) performance even for prime sizes).