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

Replace deprecated PyUnicode_FromUnicode(NULL, size) calls (#998) #999

Closed
wants to merge 1 commit into from

Conversation

bkline
Copy link
Contributor

@bkline bkline commented Jan 2, 2022

Current versions of Python write a deprecation warning message to stderr, which breaks CGI scripts running under web servers which fold stderr into stdout. Likely breaks other software. This change replaces the deprecated calls with PyUnicode_New(size, 0x10ffff). The second argument represents the highest code point for Unicode characters, which is used because the calls being replaced have no string value from which we can determine the smallest number of bytes needed to represent any value which can be stored in the newly-created object.

Fixes #998

@bkline
Copy link
Contributor Author

bkline commented Jan 2, 2022

I have included a unit test, but I assume others more familiar with the project will want to decide how to integrate it with the existing tests. I didn't fold the test in with any of the other sets, because the only sets in tests3 which were not DBMS-specific were for tests of the API, and this isn't a fix of API behavior (or rather, it's a fix of internals related to working with the Python APIs). The test fails without the fix and passes with it.

…er#998)

Current versions of Python write a deprecation warning message to
stderr, which breaks CGI scripts running under web servers which
fold stderr into stdout. Likely breaks other software. This change
replaces the deprecated calls with PyUnicode_New(size, 0x10ffff).
The second argument represents the highest code point for Unicode
characters, which is used because the calls being replaced have
no string value from which we can determine the smallest number
of bytes needed to represent any value which can be stored in the
newly-created object.
@bkline
Copy link
Contributor Author

bkline commented Jan 2, 2022

Reaching out in the ticket for assistance.

@bkline
Copy link
Contributor Author

bkline commented Jan 2, 2022

Going to get another running start on this one.

@bkline bkline closed this Jan 2, 2022
@bkline bkline deleted the issue998 branch January 2, 2022 21:53
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.

Deprecation warning breaks CGI scripts
1 participant