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

fix python wrapper issues #2

Merged
1 commit merged into from
Dec 15, 2010
Merged

fix python wrapper issues #2

1 commit merged into from
Dec 15, 2010

Conversation

tchaikov
Copy link
Contributor

hi BYVoid,

你好,我觉得 Python wrapper 有些问题:

  • Mac 上没办法 load so 文件。
  • convert 的出错处理
  • 还有 __delete__ 无法保证调用

例子如果不加载词典,便无法使用。所以也稍微改了一下。

* don't specify the fname of lib to load (Mac and Win32 don't have 'so')
* handle the convertion failure
* load dict in python wrapper sample
jjgod added a commit to jjgod/OpenCC that referenced this pull request Nov 12, 2012
I hit this crash on Mac OS X while processing a file with 1 MB in
only one line.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000100456000
0x00007fff82eb4337 in memmove$VARIANT$sse3x ()
(gdb) bt
 #0  0x00007fff82eb4337 in memmove$VARIANT$sse3x ()
 BYVoid#1  0x00007fff82f2fe97 in fgets ()
 BYVoid#2  0x000000010000135d in convert (input_file=0x1001039a0
 "/Users/jjgod/Downloads/昨日的世界/mobi7/z.html",
 output_file=0x1001000e0 "n.html", config_file=0x1001023f0 "zht2zhs.ini")
at /Users/jjgod/Codes/cpp/OpenCC/src/tools/opencc.c:81
 BYVoid#3  0x000000010000176e in main (argc=7, argv=0x7fff5fbff920) at
/Users/jjgod/Codes/cpp/OpenCC/src/tools/opencc.c:185

The solution I found is to avoid using the fragile fgets() and
memory reallocation and replace it with simple fread() and fseek().
@comword comword mentioned this pull request Nov 5, 2016
This pull request was closed.
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.

1 participant