Skip to content

Updated int type for PEP353 #6

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

Merged
merged 1 commit into from
Sep 21, 2022
Merged

Conversation

tai
Copy link
Contributor

@tai tai commented Sep 21, 2022

Due to breaking change in Python API starting from 3.10, python-nkf does not function anymore.

$ ipython
Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 b
it (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import nkf

In [2]: nkf.guess('hogehoge')
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
Cell In [2], line 1
----> 1 nkf.guess('hogehoge')

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

This is caused by an intentional incompatibility introduced from 3.10:

This patch updates int type to Py_ssize_t and adds PY_SSIZE_T_CLEAN, so it will work again.
That said, since int values are still used everywhere in nkf.c, it still needs further update to handle input longer than 32bit limit. This patch does not handle that.

@fumiyas fumiyas merged commit 30a3ee0 into fumiyas:master Sep 21, 2022
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.

2 participants