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

Stopgap measure for Python 3.13 testing: Minimal port of tests from bottle to flask #838

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

Conversation

hroncok
Copy link

@hroncok hroncok commented Apr 24, 2024

Bottle is not Python 3.13+ ready, see bottlepy/bottle#1403

In Fedora, we need pycurl to be able to use fedpkg, our tool for building Fedora packages.

I plan to use this patch in Fedora temporarily until the bottle situation is resolved.


I do not expect this to be merged, but I opened this PR anyway, in case you or others find it useful. With this, tests pass on Python 3.13.

Bottle is not Python 3.13+ ready, see bottlepy/bottle#1403

In Fedora, we need pycurl to be able to use fedpkg, our tool for building Fedora packages.

I plan to use this patch in Fedora temporarily until the bottle situation is resolved.
@hroncok hroncok changed the title Stop gap measure for Python 3.13 testing: Minimal port of tests from bottle to flask Stopgap measure for Python 3.13 testing: Minimal port of tests from bottle to flask Apr 24, 2024
@swt2c
Copy link
Contributor

swt2c commented Apr 24, 2024

Thanks @hroncok! Any reasons this couldn't/shouldn't be merged? It seems like bottle is under-maintained these days.

@hroncok
Copy link
Author

hroncok commented Apr 24, 2024

That's entirely up to you. I just didn't want to appear out of nowhere asking for you to switch your test web framework :)

I need to stress out:

  • I have not touched any documentation.
  • I ignored all Python 2 tests completely and only tested this on Python 3.12 and 3.13.
  • Some places could be tidied up, e.g. xconvert_file seems unused.

Comment on lines 113 to +121
@app.route('/set_cookie_invalid_utf8')
def set_cookie_invalid_utf8():
bottle.response.set_header('Set-Cookie', '\xb3\xd2\xda\xcd\xd7=%96%A6g%9Ay%B0%A5g%A7tm%7C%95%9A')
return 'cookie set'
response = flask.Response('cookie set')
# WARNING: The original bottle test passed '\xb3\xd2\xda\xcd\xd7...' as string
# Presumably bottle encoded that as utf-8 in the response.
# Flask on the other hand encodes such strings as latin-1 (chars in == bytes out).
# In order to make the test pass I replicate the original bottle behavior by utf-8->latin1 roundtrip.
response.headers['Set-Cookie'] = '\xb3\xd2\xda\xcd\xd7=%96%A6g%9Ay%B0%A5g%A7tm%7C%95%9A'.encode('utf-8').decode('latin-1')
return response
Copy link
Author

Choose a reason for hiding this comment

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

Also, if this PR would be merged, perhaps we need a better look at this.

What is "invalid UTF-8" supposed to test here?

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.

None yet

2 participants