Skip to content

Fixed the bug that the handler cannot get the main thread context on the Windows platform. #3479

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bestcondition
Copy link

platform

windows

minimal reproducible demo

import tornado.ioloop
import tornado.web

import contextvars

v = contextvars.ContextVar('v', default='default')


# Define a request handler
class MainHandler(tornado.web.RequestHandler):
    def get(self):
        print(v.get())
        self.write("Hello, World!")


# Define the application
def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),
    ])


# Start the server
if __name__ == "__main__":
    v.set('foo')
    app = make_app()
    app.listen(8888)  # Listen on port 8888
    print("Server is running on http://localhost:8888")
    tornado.ioloop.IOLoop.current().start()

Run and visit http://localhost:8888, then print default

@bestcondition
Copy link
Author

@bdarnell , hello! My pull request has been open for a while, and I would appreciate it if you could take a look. Thank you very much for your contributions to this project! I look forward to your feedback.

@bdarnell
Copy link
Member

Thanks and sorry for the delay. The change looks good, but would you mind adding a simple test case for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants