Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Python 2 compatibility wrappers #231

Merged
merged 7 commits into from
Oct 10, 2022

Conversation

DifferentialOrange
Copy link
Member

@DifferentialOrange DifferentialOrange commented Sep 9, 2022

code-health: remove built-in types wrappers

The built-in basestring abstract type was removed in Python 3 [1]. str must be used for strings and bytes for byte objects. long type was unified with int in Python 3 [2].

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=basestring
  2. https://peps.python.org/pep-0237/

Part of #212

code-health: remove utf-8 encoding instruction

Since Python 3 the default encoding of source files is already UTF-8 [1]. Unless instruction says something other than some variation of "utf-8", it has no effect [2].

  1. https://docs.python.org/3/howto/unicode.html#the-string-type
  2. https://stackoverflow.com/questions/4872007/where-does-this-come-from-coding-utf-8

Part of #212

code-health: remove print compatibility wrapper

future .print_function brings Python 3 print to Python 2 [1].

  1. https://docs.python.org/2/reference/simple_stmts.html#future

code-health: remove StandardError

StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2] declares that database modules targeting Python 3 should use Exception as base class instead.

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror
  2. https://peps.python.org/pep-0249/#footnotes

Part of #212

code-health: remove collections wrappers

collections.abc was introduced in Python 3.3 [1].

  1. https://docs.python.org/3/library/collections.abc.html

Part of #212

code-health: remove c_ssize_t type wrapper

ctypes.c_ssize_t was introduced in Python 2.7 [1] and Python 3.2 [2].

  1. https://docs.python.org/2.7/library/ctypes.html#ctypes.c_ssize_t
  2. https://docs.python.org/3.2/library/ctypes.html#ctypes.c_ssize_t

Part of #212

code-health: remove string encoding compatibility

See PR [1].

  1. types: support working with binary for Python 3 #211

Closes #212

@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 2da0f00 to f016dca Compare September 9, 2022 11:56
@DifferentialOrange DifferentialOrange changed the title Cleanup Python 2 compatibility traces Cleanup Python 2 compatibility wrappers Sep 9, 2022
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch 3 times, most recently from 93051e9 to 9b2554c Compare September 9, 2022 15:15
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch from 406b2ef to f5deabe Compare September 9, 2022 15:59
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 9b2554c to fc2052e Compare September 9, 2022 15:59
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch 2 times, most recently from 0eb252d to e8b1be0 Compare September 21, 2022 12:37
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from fc2052e to 1bca525 Compare September 21, 2022 12:47
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch from e8b1be0 to bd9aeba Compare September 21, 2022 13:46
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 1bca525 to 34df802 Compare September 21, 2022 13:46
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch from bd9aeba to c629676 Compare September 22, 2022 15:31
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 34df802 to 4f9b771 Compare September 22, 2022 15:32
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch from c629676 to afa8107 Compare September 26, 2022 07:04
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 4f9b771 to cd475e1 Compare September 26, 2022 07:05
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch from afa8107 to d4c577c Compare September 26, 2022 07:10
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from cd475e1 to 0936426 Compare September 26, 2022 07:10
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-229-interval branch 8 times, most recently from ac7a1e3 to b121ac8 Compare October 4, 2022 09:36
Base automatically changed from DifferentialOrange/gh-229-interval to master October 5, 2022 09:16
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 0936426 to e9a4af6 Compare October 5, 2022 09:25
@DifferentialOrange DifferentialOrange marked this pull request as ready for review October 5, 2022 09:26
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from e9a4af6 to 2199421 Compare October 5, 2022 09:27
The built-in `basestring` abstract type was removed in Python 3 [1].
`str` must be used for strings and `bytes` for byte objects. `long` type
was unified with `int` in Python 3 [2].

1. https://docs.python.org/3/whatsnew/3.0.html?highlight=basestring
2. https://peps.python.org/pep-0237/

Part of #212
Since Python 3 the default encoding of source files is already UTF-8 [1].
Unless instruction says something other than some variation of "utf-8",
it has no effect [2].

1. https://docs.python.org/3/howto/unicode.html#the-string-type
2. https://stackoverflow.com/questions/4872007/where-does-this-come-from-coding-utf-8

Part of #212
StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2]
declares that database modules targeting Python 3 should use Exception
as base class instead.

1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror
2. https://peps.python.org/pep-0249/#footnotes

Part of #212
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 2199421 to ec97d90 Compare October 6, 2022 06:06
Copy link
Contributor

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@DifferentialOrange DifferentialOrange merged commit 12de422 into master Oct 10, 2022
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/gh-212-cleanup-python-2 branch October 10, 2022 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up Python 2 compatibility wrappers
2 participants