Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Type conversion: Remove support for deprecated ByteString #4983

Closed
@pekkaklarck

Description

@pekkaklarck

collections.abc.ByteString that Robot's argument conversion supports has been deprecated in Python 3.12 and will be removed in Python 3.14. This basically makes the current Robot Framework code incompatible with Python 3.14 that's released already in 2025, and also means that there are deprecation warnings with Python 3.12 already now.

ByteString conversion isn't that useful and I believe the best way to handle these problems is to simply not support it. This is how conversion currently works if you use arg: ByteString:

  1. If the given argument is an instance bytes or bytearray (i.e. is already an instance of ByteString), it is passed to the keyword as-is.
  2. Otherwise, it is converted to bytes the same way as if the keyword would have used arg: bytes.

I don't consider these semantics too useful. I don't see how often you'd like to have a keyword that gets either bytes or bytearray, when you could use arg: bytes or arg: bytearray to get one of them. More importantly, if you have such a need, using arg: bytes | bytearray works exactly the same way and makes then intention more clear.

Removing the support for ByteString conversion is obviously a backwards incompatible change, but I doubt there are many users for it, they can easily use bytes | bytearray instead, and they anyway need to do that relatively soon when ByteString will be gone. I wish we would have done this earlier in RF 7.0 development cycle, but believe doing it still now before the release candidate is fine.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions