borg icon indicating copy to clipboard operation
borg copied to clipboard

use more py39 features

Open ThomasWaldmann opened this issue 3 years ago • 4 comments

master and 1.4-maint branch only, 1.2-maint is still on py38, 1.1-maint even older.

https://docs.python.org/3/whatsnew/3.9.html

especially:

  • [ ] https://docs.python.org/3/whatsnew/3.9.html#dictionary-merge-update-operators
  • [ ] https://docs.python.org/3/whatsnew/3.9.html#new-string-methods-to-remove-prefixes-and-suffixes

ThomasWaldmann avatar Feb 27 '22 20:02 ThomasWaldmann

https://docs.python.org/3/whatsnew/3.9.html#random new randbytes function

Note: random.randbytes is not intended for secure random:

random.randbytes(n)

This method should not be used for generating security tokens. Use secrets.token_bytes() instead.

In my humble opinion we should always use secure random even if it is not always necessary. Deciding which numbers are safe to generate insecurely and which ones are not is error prone. It is much simpler to generate all random securely unless we are experiencing a measurable performance degradation.

hexagonrecursion avatar Mar 06 '22 08:03 hexagonrecursion

#7487 < ran pyupgrade (master). #7996 < ran pyupgrade (1.4-maint).

ThomasWaldmann avatar Apr 02 '23 00:04 ThomasWaldmann

Considering dropping py38 and requiring >=py39 for borg 1.4. Any issues with that?

Note: py38 will run out of upstream support by 2024-10 anyway.

Update:

  • dropped py38 for 1.4-maint - dists adopting borg 1.4 will have python >= 3.9, thus no problem.
  • master (borg2) already dropped py38 in the past

ThomasWaldmann avatar Dec 23 '23 19:12 ThomasWaldmann

TODO: do manual changes for better using py39 features where needed.

ThomasWaldmann avatar Dec 25 '23 01:12 ThomasWaldmann