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

Receiving warning message with successful call to pycurl.Curl.perform() #599

Open
skeptycal opened this issue Nov 28, 2019 · 0 comments

Comments

@skeptycal
Copy link

@skeptycal skeptycal commented Nov 28, 2019

What did you try to do?

When successfully running a short example pycurl wrapper, received a warning message related to PY_SSIZE_T_CLEAN.

TLDR: indexes should be typed as Py_ssize_t (signed) instead of int to allow the use of full address space (64bit vs. 32bit). The conversion codes 's#' and 't#' will output Py_ssize_t if the macro PY_SSIZE_T_CLEAN is defined before Python.h is included. Use PY_SSIZE_T_CLEAN and make sure all values are correctly converted.

Documentation:
This warning message is new in Python 3.8 and conversion must be complete before 3.10 ...

Use of # variants of formats in parsing or building value (e.g. PyArg_ParseTuple(), Py_BuildValue(), PyObject_CallFunction(), etc.) without PY_SSIZE_T_CLEAN defined raises DeprecationWarning now. It will be removed in 3.10 or 4.0. Read Parsing arguments and building values for detail. (Contributed by Inada Naoki in bpo-36381.)

Raise warning for # use without PY_SSIZE_T_CLEAN.

  • 3.8: PendingDeprecationWarning
  • 3.9: DeprecationWarning
  • 3.10 (or 4.0): Remove PY_SSIZE_T_CLEAN and use Py_ssize_t always

The conversion codes 's#' and 't#' will output Py_ssize_t if the macro PY_SSIZE_T_CLEAN is defined before Python.h is included, and continue to output int if that macro isn't defined.

What happened?

success, but received this warning message:

./ssm_pycurl.py:45: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  self.crl.perform()
pycurl.VERBOSE = 1
pycurl.version = 'PycURL/7.43.0.3 libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2'
pycurl.version_info() = (4, '7.64.1', 475137, 'x86_64-apple-darwin19.0', 5211037, 'SecureTransport (LibreSSL/2.8.3)', 0, '1.2.11', ('dict', 'file', 'ftp', 'ftps', 'gopher', 'http', 'https', 'imap', 'imaps', 'ldap', 'ldaps', 'pop3', 'pop3s', 'rtsp', 'smb', 'smbs', 'smtp', 'smtps', 'telnet', 'tftp'), None, 0, None)

If reporting a problem with using PycURL, include a SHORT code snippet
which includes setting pycurl.VERBOSE to 1 and reproduces the problem
and its complete output.

#*###################################################################################
test_url: bytes = b'https://wiki.python.org/moin/BeginnersGuide'
crl = Curl_Wrapper(test_url) # per documentation: initializing a Curl object sets VERBOSE = 0
crl.set_verbose() # explicitly set VERBOSE = 1, as requested
response = crl.get()
print(f"{pycurl.VERBOSE = }")
print(f"{pycurl.version = }")
print(f"{pycurl.version_info() = }")
# print(f'Output of GET request:\n{response}') # prints html from url
crl.close()
#*###################################################################################

What did you expect to happen?

return response with no warnings or error messages

What is the PycURL version?

(output of pycurl.version)

pycurl.version = 'PycURL/7.43.0.3 libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2'

What is your Python version?

(output of python -V)

Python 3.8.0

What is your operating system and its version?

uname -a
Darwin MacBook-Pro.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64 i386 MacBookPro11,4 Darwin

Other versions

n/a

Is this the most recent PycURL release?

yes

Did you check libcurl behavior?

yes, this is an issue related to Python 3.8 interaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.