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

In Python 3.10, PY_SSIZE_T_CLEAN must be defined before including Python.h #44

Closed
kitterma opened this issue Nov 2, 2021 · 11 comments
Closed

Comments

@kitterma
Copy link
Collaborator

kitterma commented Nov 2, 2021

Issue was reported against dkimpy-milter, but I think this is in pymilter:

2021-11-02T15:56:39.946644-04:00 mx dkimpy-milter[30551]: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
2021-11-02T15:56:39.946668-04:00 mx dkimpy-milter[30551]: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
2021-11-02T15:56:39.946688-04:00 mx dkimpy-milter[30551]: dkimpy-filter: milter claimed not to reply in state 9 but did anyway 4

noting

Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
https://gitlab.gnome.org/GNOME/libxml2/-/issues/203

Parsing arguments and building values
https://docs.python.org/3/c-api/arg.html
"For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python 3.9 and older, the type of the length argument is Py_ssize_t if the PY_SSIZE_T_CLEAN macro is defined, or int otherwise."

See https://bugs.launchpad.net/dkimpy-milter/+bug/1949520 for details.

@sdgathman
Copy link
Owner

7a5c942

Also have some deprecated C-API functions to update in miltermodule.c

@pgnd
Copy link

pgnd commented Nov 16, 2021

@kitterma

Is this commit sufficient for getting dkimpy-milter back up?

or, Release needed here?

@sdgathman

are the "deprecated C-API functions" just cleanup? Or req'd for 3.10 usage?

@sdgathman
Copy link
Owner

The deprecated C-API functions are cleanup - they will disappear in some future Python release.
It builds and WorksForMe™ with the PY_SSIZE_T_CLEAN commit on 3.10.

@pgnd
Copy link

pgnd commented Nov 16, 2021

deprecated C-API functions are cleanup

+1

builds and WorksForMe™

& here,

pip install git+https://github.com/sdgathman/pymilter (... until release ...)
pip install --force --upgrade dkimpy-milter dkimpy

does the trick. outbound dkim signing by dkimpy-milter, with python 3.10, working as expected.

thx o/

@kitterma
Copy link
Collaborator Author

Thanks. For Debian I can add this as a patch when we add python3.10 (which is soon). A release isn't urgent. With my dkimpy-milter hat on getting a release with a fix for #12 in it would be far more important. So yes, a release please, but with this and #12 addressed.

@sdgathman
Copy link
Owner

What do you regard a "fix for #12" ? Go with the current api?

@pgnd
Copy link

pgnd commented Dec 30, 2021

@kitterma

Have these now-releaed fixes made their way into dkimpy/dkimpy-milter releaes?

Or still not sufficient?

On pip install,

virtual environment instead: https://pip.pypa.io/warnings/venv
[2008][root@edge: /usr/local/src]$ pip install dkimpy-milter
Collecting dkimpy-milter
  Using cached dkimpy_milter-1.2.2-py3-none-any.whl
Collecting authres>=1.1.0
  Using cached authres-1.2.0-py3-none-any.whl
Collecting pymilter
  Using cached pymilter-1.0.4-cp310-cp310-linux_x86_64.whl
Requirement already satisfied: dkimpy>=1.0 in /usr/lib/python3.10/site-packages (from dkimpy-milter) (1.0.5)
Collecting PyNaCl
  Using cached PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB)
Requirement already satisfied: Py3DNS in /usr/lib/python3.10/site-packages (from dkimpy-milter) (3.2.1)
Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python3.10/site-packages (from PyNaCl->dkimpy-milter) (1.14.6)
Requirement already satisfied: six in /usr/lib/python3.10/site-packages (from PyNaCl->dkimpy-milter) (1.16.0)
Requirement already satisfied: pycparser in /usr/lib/python3.10/site-packages (from cffi>=1.4.1->PyNaCl->dkimpy-milter) (2.21)
Installing collected packages: PyNaCl, pymilter, authres, dkimpy-milter
Successfully installed PyNaCl-1.4.0 authres-1.2.0 dkimpy-milter-1.2.2 pymilter-1.0.4

still seeing pymilter v1.0.4

@kitterma
Copy link
Collaborator Author

I have not had time to work on updates based on the new API in 1.0.5. Pip isn't going to see 1.0.5 though until you upload it to pip (or give me permissions to).

@sdgathman
Copy link
Owner

sdgathman commented Dec 31, 2021

Trying to get upload to work. They can't make up their mind what the markup format is. What is it supposed to be these days? The check tool says it is invalid, but gives no clues as to the target.

@sdgathman
Copy link
Owner

Currently complaining: line 129: Error: Unexpected indentation.
That is in a preformatted block. But maybe the pypi flavor of markdown has some special preformatted syntax.
I tried indenting and triple accent to delineate the block.

@sdgathman
Copy link
Owner

Released on PyPi - docs formatting improved over 1.0.4 but still messed up.

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

No branches or pull requests

3 participants