Ticket #46419

PEP623対応について

Open Date: 2023-01-02 15:24 Last Update: 2023-01-24 00:15

Reporter:
Owner:
Type:
Status:
Open [Owner assigned]
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

Fedora 39でpython 3.12が採用されることが宣言された為、現在その準備をしています。
その過程で、PEP623によって、skf-2.10.15のpythonextがpython3.12で動作出来無くなるという報告がありました: https://bugzilla.redhat.com/show_bug.cgi?id=2155283
実際python 3.12.0a3 でビルドすると、以下の通りです。

+ make -j1 pythonext
....
gcc -I/usr/include/python3.12 -I/usr/include/python3.12 -DUNI_DECOMPOSE -DFOLD_SUPPORT -DDYNAMIC_LOADING -DKEIS_EXTRA_SUPPORT -DSKFDEBUG -DSKFPDEBUG -DOLD_NEC_COMPAT -DFAST_GETC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1   -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-strict-aliasing -DHAVE_GETENV -DHAVE_CONFIG_H -I. -I. -I.   -DROT_SUPPORT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DTABLEDIR="\"/usr/lib64/skf/lib/2.10\""  -DDEFAULT_EOL_LF -DSYSTEM_EXEEXT=\"""\" -fPIC -D_GNU_SOURCE -D_REENTRANT -DSWIG_EXT -DSKF_PYTHON3 -DSKF_PYTHON -DUSE_PEP393 -O2  -Wno-format-security -fno-delete-null-pointer-checks  -Wall -flto -Wno-empty-body -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-sign-compare -Wjump-misses-init -Wno-implicit-fallthrough  -DSKF_PYTHON3 -DSKF_PYTHON -DUSE_PEP393 -c skf_convert_f_wrap.c \
                -o skf_convert_f_wrap.o
skf_convert_f_wrap.c: In function 'skfstrstrconv':
skf_convert_f_wrap.c:3117:36: warning: implicit declaration of function 'PyUnicode_AS_UNICODE'; did you mean 'PyUnicode_AsUCS4'? [-Wimplicit-function-declaration]
 3117 | #define skf_PyUnicode_AsUnicode(x) PyUnicode_AS_UNICODE(x)
      |                                    ^~~~~~~~~~~~~~~~~~~~
skf_convert_f_wrap.c:3466:23: note: in expansion of macro 'skf_PyUnicode_AsUnicode'
 3466 |         if ((srcstr = skf_PyUnicode_AsUnicode(robj)) == NULL) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
skf_convert_f_wrap.c:3466:21: warning: assignment to 'Py_UNICODE *' {aka 'int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 3466 |         if ((srcstr = skf_PyUnicode_AsUnicode(robj)) == NULL) {
      |                     ^
skf_convert_f_wrap.c: In function 'skf_pystring2skfstring':
skf_convert_f_wrap.c:3747:19: warning: 'istr' may be used uninitialized [-Wmaybe-uninitialized]
 3747 |     sstrdef->sstr = istr;
      |     ~~~~~~~~~~~~~~^~~~~~
skf_convert_f_wrap.c:3553:26: note: 'istr' was declared here
 3553 |     unsigned char       *istr;
      |                          ^~~~
...
++ python3 -c 'import skf ; print (skf.convert('\''-z'\'', b"\xa4\xa2"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/builddir/build/BUILDROOT/skf-2.10.15-1.fc38.x86_64/usr/lib64/python3.12/site-packages/skf.py", line 12, in <module>
    import _skf
ImportError: /builddir/build/BUILDROOT/skf-2.10.15-1.fc38.x86_64/usr/lib64/python3.12/site-packages/_skf.so: undefined symbol: PyUnicode_AS_UNICODE

PEP623で、python3.12では PyUnicode_AS_UNICODE などが削除されることが宣言されています。 https://peps.python.org/pep-0623/

Ticket History (3/5 Histories)

2023-01-02 15:24 Updated by: mtasaka
  • New Ticket "PEP623対応について" created
2023-01-02 15:26 Updated by: mtasaka
Comment

一先ずPEP623対応へのpatchを書いてみましたが、確認をよろしくお願いします。

2023-01-09 16:43 Updated by: efialtes
  • Owner Update from (None) to efialtes
2023-01-24 00:15 Updated by: efialtes
  • Resolution Update from None to Fixed
Comment

2.10.16 で修正しました。前からかもしれないけど、BOM をつけて投げると byteArray にしかならないので BOM を既定抑止に直しました。

Attachment File List

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login