This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年03月15日 22:18 by bdirks, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (7) | |||
|---|---|---|---|
| msg184268 - (view) | Author: Bill Dirks (bdirks) | Date: 2013年03月15日 22:18 | |
This issue was discovered in 3.3.0 on Windows. Haven't looked at other versions.
Using the Limited API, the PyUnicode_Xxxx() functions are not accessible. A simple demonstration of the problem:
HMODULE p3 = ::LoadLibraryA("C:\\Python33\\DLLs\\python3.dll");
FARPROC f;
f = GetProcAddress(p3, "Py_IsInitialized"); // works
f = GetProcAddress(p3, "PyImport_AppendInittab"); // works, and so on
f = GetProcAddress(p3, "PyUnicode_FromString"); // fails
f = GetProcAddress(p3, "PyUnicode_FromFormat"); // fails
f = GetProcAddress(p3, "PyUnicode_FromStringAndSize"); // fails, and so on
::FreeLibrary(p3);
After some digging I found that python3.dll refers all of its exports on to python33.dll, and the problem exports all have the form:
PyUnicode_Xxxx -> python33.PyUnicodeUCS2_Xxxx
but python33.dll does not export any PyUnicodeUCS2_ symbols, confirmed by the Dependency Walker tool.
Any Limited API extension using PyUnicode_ functions will compile and link, but fail at runtime. If I understand the problem, the fix is just to correct the .def file.
|
|||
| msg184275 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2013年03月15日 22:49 | |
The Unicode functions were left out of the limited API precisely because of the UCS2/UCS4 issue. If you have an extension module on a narrow Python build using the limited API, it should work without recompilation on a wide build as well. Now, with Python 3.3, this issue is gone, so it might be reasonable to add some of the functions to the limited API. Can you propose a list of functions that you think should be there? |
|||
| msg184293 - (view) | Author: Bill Dirks (bdirks) | Date: 2013年03月16日 05:57 | |
A great number of PyUnicode functions are already added to the Limited API. That is, the declarations are outside of #ifndef Py_LIMITED_API guards in the header files, and the symbols are included in python3.lib and exported from python3.dll. (in 3.3.0) Can't those functions link to the functions of the same name in python33.dll? In other words, for example, PyUnicode_FromString in the python3.dll should link to PyUnicode_FromString in python33.dll, not PyUnicodeUCS2_FromString (which doesn't exist in python33.dll). Right? |
|||
| msg184325 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2013年03月16日 15:31 | |
Ah, I see. Yes, it seems indeed that the def file needs to be changed. |
|||
| msg201271 - (view) | Author: Christian Heimes (christian.heimes) * (Python committer) | Date: 2013年10月25日 18:03 | |
Martin, do you want to change the def-file for Python 3.4? |
|||
| msg207276 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年01月04日 09:06 | |
New changeset ea0aa3e32ab5 by Martin v. Löwis in branch '3.3': Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. http://hg.python.org/cpython/rev/ea0aa3e32ab5 New changeset 0ea09c824d9b by Martin v. Löwis in branch 'default': Merge with 3.3: Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. http://hg.python.org/cpython/rev/0ea09c824d9b |
|||
| msg207279 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2014年01月04日 10:33 | |
This is now fixed for 3.3 and 3.4. Sorry it took so long. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:42 | admin | set | github: 61634 |
| 2014年09月21日 16:55:29 | SilentGhost | set | title: ucs2 -> PyUnicode_ functions not accessible in Limited API on Windows |
| 2014年09月21日 16:55:15 | SilentGhost | set | title: PyUnicode_ functions not accessible in Limited API on Windows -> ucs2 |
| 2014年01月28日 07:44:03 | loewis | set | status: open -> closed |
| 2014年01月04日 10:33:00 | loewis | set | messages: + msg207279 |
| 2014年01月04日 09:06:41 | python-dev | set | nosy:
+ python-dev messages: + msg207276 |
| 2013年10月25日 19:32:55 | pitrou | set | stage: needs patch versions: + Python 3.3 |
| 2013年10月25日 18:03:54 | christian.heimes | set | priority: normal -> high versions: + Python 3.4, - Python 3.3 nosy: + christian.heimes messages: + msg201271 |
| 2013年03月16日 15:31:50 | loewis | set | messages: + msg184325 |
| 2013年03月16日 13:35:53 | vstinner | set | nosy:
+ vstinner |
| 2013年03月16日 05:57:35 | bdirks | set | messages: + msg184293 |
| 2013年03月15日 22:49:46 | loewis | set | nosy:
+ loewis messages: + msg184275 |
| 2013年03月15日 22:18:04 | bdirks | create | |