Skip to content

[REFACTOR] Drop checking of sys.maxunicode in parsing of entities #3611

@harshil21

Description

@harshil21

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

We currently check for sys.maxunicode whenever we parse entities:

# Is it a narrow build, if so we don't need to convert
if sys.maxunicode == 0xFFFF:
return self.text[entity.offset : entity.offset + entity.length]

However, sys.maxunicode is guaranteed to be 0x10FFFF since Python 3.3.

We needed a check for this back when we still supported older python versions (git blame tells that this line was last touched in 2016).

So, we do not need to check for this anymore, and it can thus be dropped.

Describe the solution you'd like

Remove logic checking for sys.maxunicode.

Describe alternatives you've considered

No response

Additional context

Originally discovered in #3594 (comment).

Added benefit of improving coverage, since this wasn't covered in our tests anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions