Skip to content

Python3.11 compatibility #284

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

Closed
wants to merge 8 commits into from
Closed

Conversation

stephanelsmith
Copy link

@stephanelsmith stephanelsmith commented Jan 30, 2023

Reason for the change
Python3.11 compatibility issues with running

Description
"@asyncio.coroutine" and "yield from" syntax no longer allowed in 3.11. Changed to "async" and "await" respectively.

Code examples
For example, changes made like this:

@asyncio.coroutine        <<<<-- REMOVED
async def _read_until(streamreader, delimiter): <<<<--- ADDED
    """Naive implementation of reading until a delimiter"""
    buffer = bytearray()
    while True:
        # c = yield from streamreader.read(1)  <<<<<<-- REMOVED
        c = await streamreader.read(1)   <<<<<< -- ADDED
        if c == b"":
            break  # EOF
        buffer.append(c[0])
        if c == delimiter:
            break
    return bytes(buffer)

Checklist

References
I have a number of compatibility updates, made some for 3.10 as well last year. I wanted decreased verbosity in the export.
Happy to cherry pick what makes sense, but would like to see continued support track with Python versions.

pass

class Response:
class ResponseType:
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

COMPILE_ERROR = 17
RUNTIME_ERROR = 18

class ErrorType:
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Jan 30, 2023

Code Climate has analyzed commit 041dc5d and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

View more on Code Climate.

@stephanelsmith
Copy link
Author

Apologize for closing/opening. Confirming my verison is working in my 3.11 appliction. Happy to help cherry pick these changes into mainline, but definitely think updates are necessary for continued python support. Love this project, show must go on!

@lsabi
Copy link
Contributor

lsabi commented Nov 14, 2023

Closing as it has been integrated from another PR #298

@stephanelsmith thanks for the support!

@lsabi lsabi closed this Nov 14, 2023
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.

2 participants