Pauli Virtanen
2d1653aa43
[3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) ( #3241 )
...
Ctypes currently produces wrong pep3118 type codes for several types.
E.g. memoryview(ctypes.c_long()).format gives "<l" on 64-bit platforms,
but it should be "<q" instead for sizeof(c_long) == 8
The problem is that the '<>' endian specification in the struct syntax
also turns on the "standard size" mode, which makes type characters have
a platform-independent meaning, which does not match with the codes used
internally in ctypes. The struct module format syntax also does not
allow specifying native-size non-native-endian items.
This commit adds a converter function that maps the internal ctypes
codes to appropriate struct module standard-size codes in the pep3118
format strings. The tests are modified to check for this.
(cherry picked from commit 07f1658aa0
)
2017-08-30 11:40:05 +02:00
Serhiy Storchaka
0834905d9b
[3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) ( #2462 )
...
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters..
(cherry picked from commit f7eae0adfc
)
2017-06-28 09:27:35 +03:00
Serhiy Storchaka
0edffa3073
[3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) ( #2443 )
...
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters..
(cherry picked from commit e613e6add5
)
2017-06-27 21:08:58 +03:00
Zachary Ware
f57e34b672
[3.6] Use Travis to make sure all generated files are up to date (GH-2080) (GH-2092)
...
(cherry picked from commit 0afbabe245
)
Also fixes some line endings missed in GH-840 backport.
2017-06-11 11:30:57 -05:00
Victor Stinner
e005dd9a6d
bpo-30125: disable faulthandler in ctypes test_SEH ( #1237 ) ( #1343 )
...
Disable faulthandler to run test_SEH() of test_ctypes to prevent the
following log with a traceback:
Windows fatal exception: access violation
Add support.disable_faulthandler() context manager.
(cherry picked from commit a36e939aeb
)
2017-04-28 16:06:48 +02:00
Serhiy Storchaka
da88596a19
bpo-29845: Mark tests that use _testcapi as CPython-only ( #711 ) ( #725 )
...
(cherry picked from commit 24c738a9e9
)
2017-03-19 20:53:42 +02:00
Vinay Sajip
3cc5817cfa
Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. ( #168 ) ( #220 )
...
Fixed bpo-29565: Corrected ctypes passing of large structs by value.
(cherry picked from commit a86339b83f
)
2017-02-22 06:21:17 +00:00
Serhiy Storchaka
4c4ff5f4d4
Issue #29219 : Fixed infinite recursion in the repr of uninitialized
...
ctypes.CDLL instances.
2017-01-13 09:42:17 +02:00
Serhiy Storchaka
4b318f8be9
Issue #29219 : Fixed infinite recursion in the repr of uninitialized
...
ctypes.CDLL instances.
2017-01-13 09:37:56 +02:00
Martin Panter
04b35753f7
Issue #25659 : Merge ctypes fix from 3.5
2016-11-20 22:07:29 +00:00
Martin Panter
6e723d2d11
Issue #25659 : Change assert to TypeError in from_buffer/_copy()
...
Based on suggestion by Eryk Sun.
2016-11-20 07:58:35 +00:00
Martin Panter
6a8e1ea80c
Merge test cleanup from 3.5 into 3.6
2016-09-29 04:40:56 +00:00
Martin Panter
c49b4d8ef3
Remove disabled ctypes test
...
The test was commented out in 2005 before ctypes was added to Python, because
the “cdll” attribute loading feature “will no longer work this way”:
http://svn.python.org/view?view=revision&revision=49102
2016-09-29 02:50:20 +00:00
Berker Peksag
11179b2ed7
Issue #18893 : Merge from 3.5
2016-09-26 23:07:38 +03:00
Berker Peksag
8b6b50814e
Issue #18893 : Fix invalid exception handling in Lib/ctypes/macholib/dyld.py
...
Patch by Madison May.
2016-09-26 23:06:32 +03:00
Martin Panter
b745f920c9
Issue #27355 : Import no longer needed
2016-09-06 02:18:16 +00:00
Larry Hastings
10108a7b9a
Issue #27355 : Removed support for Windows CE. It was never finished,
...
and Windows CE is no longer a relevant platform for Python.
2016-09-05 15:11:23 -07:00
Vinay Sajip
82df3b3071
Closes #9998 : Allowed find_library to search additional locations for libraries.
2016-08-17 16:20:07 +01:00
Vinay Sajip
a9391a4522
Closes #20160 : Merged fix from 3.5.
2016-08-05 21:44:52 +01:00
Vinay Sajip
0b588869ee
Issue #20160 : Merged fix from 3.4.
2016-08-05 21:44:15 +01:00
Vinay Sajip
a0b2568627
Issue #20160 : Merged fix from 3.3.
2016-08-05 21:43:25 +01:00
Vinay Sajip
6f25003291
Issue #20160 : Handled passing of large structs to callbacks correctly.
2016-08-05 21:24:27 +01:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Benjamin Peterson
ab078e9ed1
Backed out changeset af29d89083b3 ( closes #25548 ) ( closes #27498 )
2016-07-13 21:13:29 -07:00
Serhiy Storchaka
d91e676fd5
Issue #27343 : Fixed error message for conflicting initializers of ctypes.Structure.
2016-06-18 09:58:55 +03:00
Serhiy Storchaka
886a5f352f
Issue #27343 : Fixed error message for conflicting initializers of ctypes.Structure.
2016-06-18 09:58:24 +03:00
Martin Panter
bd305e497f
Issue #22636 : Merge ctypes.util from 3.5
2016-06-14 04:31:14 +00:00
Martin Panter
e1b3431cef
Issue #22636 : Handle OSError from subprocess, e.g. if command not found
2016-06-14 04:08:30 +00:00
Martin Panter
1db314bd5c
Issue #22636 : Merge ctypes.util shell injection fixes from 3.5
2016-06-14 02:59:21 +00:00
Martin Panter
bfb15ab711
Issue #22636 : avoid using a shell in the ctypes.util module
...
Replace os.popen() with subprocess.Popen. Based on patch by Victor Stinner.
If the "gcc", "cc" or "objdump" command is not available, the code was
supposed to raise an OSError exception. But there was a bug in the code. The
shell code returns the exit code 10 if the required command is missing, and the
code tries to check for the status 10. The problem is that os.popen() doesn't
return the exit code directly, but a status which should be processed by
os.WIFEXITED() and os.WEXITSTATUS(). In practice, the exception was never
raised. The OSError exception was not documented and ctypes.util.find_library()
is expected to return None if the library is not found.
2016-06-14 01:27:11 +00:00
Kushal Das
5801ecb440
Issue #25548 : Showing memory address of class objects in repl
2016-06-04 16:21:13 -07:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00:00
Serhiy Storchaka
b0f80b0312
Issue #26647 : Python interpreter now uses 16-bit wordcode instead of bytecode.
...
Patch by Demur Rumed.
2016-05-24 09:15:14 +03:00
Martin Panter
4dd27f0adc
Issue #25533 : Merge frozen module docs from 3.5
2016-05-15 00:41:40 +00:00
Martin Panter
f47a400347
Issue #25533 : Update documentation regarding the frozen modules table
...
* "ctypes" documentation was using Python 2 bytes-str equivalence.
* PyImport_FrozenModules is a pointer to const as of Python 3.4
2016-05-15 00:13:04 +00:00
Martin Panter
38e2f175ea
Remove old Python 2 compatibility from ctypes test
2016-05-14 06:17:43 +00:00
Meador Inge
f1e2671fdf
Issue #24114 : Fix an uninitialized variable in `ctypes.util`.
...
The bug only occurs on SunOS when the ctypes implementation searches
for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by
Kees Bos.
2016-04-30 22:17:22 -05:00
Meador Inge
8988ebf2a7
Issue #24114 : Fix an uninitialized variable in `ctypes.util`.
...
The bug only occurs on SunOS when the ctypes implementation searches
for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by
Kees Bos.
2016-04-30 21:56:59 -05:00
Serhiy Storchaka
a6f26c1d34
Remove more unused imports in tests.
2016-04-25 00:05:30 +03:00
Serhiy Storchaka
e437a10d15
Issue #23277 : Remove unused imports in tests.
2016-04-24 21:41:02 +03:00
Berker Peksag
1e8ee9b380
Issue #23277 : Remove unused sys and os imports
...
Patch by Jon Dufresne.
2016-04-24 07:31:42 +03:00
Martin Panter
32f2eb4941
Issue #21042 : Revert Linux find_library() to return just filename
...
This reverts most of revision 3092cf163eb4. The change worked on x86
architectures, but did not work on ARM, probably due to extra ABI flags in
the ldconfig output.
2016-03-17 07:50:22 +00:00
Martin Panter
b9f3114d42
Issue #21042 : Return full path in ctypes.util.find_library() on Linux
...
Patch by Tamás Bence Gedai.
2016-03-10 01:06:23 +00:00
Martin Panter
c04fb56e36
Issue #26304 : Change "allows to <verb>" to "allows <verb>ing" or similar
...
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Martin Panter
34360c8e09
Issue #19023 : Document ctypes array and pointer classes
...
Also add some more tests. Based on patch by Sye van der Veen.
2016-01-29 10:12:19 +00:00
Ezio Melotti
ee2a392e6a
#24789 : fix docstring of ctypes.create_string_buffer. Patch by Matheus Vieira Portela.
2016-01-09 16:08:24 +02:00
Martin Panter
077e36af25
Issue #25622 : Use repr(bytes) to avoid BytesWarning
2015-11-26 02:36:26 +00:00
Martin Panter
7b2eb81997
Issue #25622 : Merge ctypes test from 3.4 into 3.5
2015-11-26 10:26:33 +00:00