Commit Graph

688 Commits

Author SHA1 Message Date
Serhiy Storchaka 3ffa8b9ba1
bpo-35384: The repr of ctypes.CArgObject no longer fails for non-ascii character. (GH-10863) 2018-12-06 11:16:24 +02:00
Serhiy Storchaka 398bd27967
bpo-32787: Better error handling in ctypes. (#3727)
* bpo-31572: Get rid of PyObject_HasAttrString() in ctypes.

* Fix error handling for _pack_.

* Don't silence errors when look up in a dict.

* Use _PyObject_LookupAttrId().

* More changes.
2018-12-05 16:44:14 +02:00
Zackery Spytz 062cbb6772 bpo-10320: Replace nonstandard sprintf() length modifier in ctypes' PyCArg_repr(). (GH-10853)
Use "ll" instead of the nonstandard "q".
2018-12-03 10:31:35 +02:00
Serhiy Storchaka d4f9cf5545
bpo-33029: Fix signatures of getter and setter functions. (GH-10746)
Fix also return type for few other functions (clear, releasebuffer).
2018-11-27 19:34:35 +02:00
Gregory P. Smith 3015fb8ce4
bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)
Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER.
Project based C Preprocessor namespacing at its finest. :P
2018-11-12 22:01:22 -08:00
Gregory P. Smith 1584a00815
bpo-35214: Initial clang MemorySanitizer support (GH-10479)
Adds configure flags for msan and ubsan builds to make it easier to enable.
These also encode the detail that address sanitizer and memory sanitizer
should disable pymalloc.

Define MEMORY_SANITIZER when appropriate at build time and adds workarounds
to existing code to mark things as initialized where the sanitizer is otherwise unable to
determine that.  This lets our build succeed under the memory sanitizer.  not all tests
pass without sanitizer failures yet but we're in pretty good shape after this.
2018-11-12 12:07:14 -08:00
Tal Einat 2447773573
bpo-29843: raise AttributeError if given negative _length_ (GH-10029)
Raise ValueError OverflowError in case of a negative
_length_ in a ctypes.Array subclass.  Also raise TypeError
instead of AttributeError for non-integer _length_.


Co-authored-by: Oren Milman <orenmn@gmail.com>
2018-10-22 18:33:10 +03:00
Stéphane Wirtel 683281f536 bpo-34906: Doc: Fix typos (2) (GH-9735)
Fix typos
2018-10-06 16:35:53 +02:00
Vladimir Matveev 7843caeb90 bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258) 2018-09-15 22:36:29 -07:00
Raymond Hettinger 1401018da1
Remove wording that could be deemed to be perjorative (GH-9287) 2018-09-13 21:17:40 -07:00
Segev Finer 735abadd5b bpo-16865: Support arrays >=2GB in ctypes. (GH-3006) 2018-05-15 02:54:29 +03:00
Oren Milman d518d8bc8d bpo-21983: Fix a crash in ctypes.cast() when passed a ctypes structured data type (GH-3859) 2018-05-09 14:38:56 -07:00
Benjamin Peterson 0a37a30037
closes bpo-32460: ensure all non-static globals have initializers (#5061) 2017-12-31 10:04:13 -08:00
Serhiy Storchaka e2f92de6a9
Add the const qualifier to "char *" variables that refer to literal strings. (#4370) 2017-11-11 13:06:26 +02:00
luzpaz a5293b4ff2 Fix miscellaneous typos (#4275) 2017-11-05 15:37:50 +02:00
Oren Milman 57c2561c8c bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (#3254) 2017-09-25 11:09:11 +03:00
Oren Milman 4facdf523a bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255) 2017-09-24 12:21:42 +03:00
Oren Milman 30b61b51e0 bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (#3615) 2017-09-17 13:45:38 +03:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Pauli Virtanen 07f1658aa0 bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (#31)
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.
2017-08-28 14:08:49 +02:00
Stefan Krah f432a3234f bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) 2017-08-21 13:09:59 +02:00
Oren Milman 1d1d3e9db8 bpo-28261: Fixed err msgs where PyArg_ParseTuple is used to parse normal tuples. (#3119) 2017-08-20 18:35:36 +03:00
Ville Skyttä 49b2734bf1 Spelling fixes (#2902) 2017-08-03 09:00:59 +03:00
Serhiy Storchaka ccdc09ed1e Fix compiler warnings on Windows introduced in bpo-13617. (#2464) 2017-06-28 09:55:22 +03:00
Serhiy Storchaka f7eae0adfc [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)
Based on patch by Victor Stinner.

Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
2017-06-28 08:30:06 +03:00
Erik Bray 9ba3aa4d02 bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559) 2017-06-07 18:42:24 +01:00
Serhiy Storchaka bf623ae884 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)
raised an error.

Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Serhiy Storchaka b879fe82e7 Expand the PySlice_GetIndicesEx macro. (#1023) 2017-04-08 09:53:51 +03:00
Benjamin Peterson 164d30eb1e suppress compiler warnings in _ctypes_test (#902)
Changed test code to suppress a compiler warning, while taking care to avoid the code being optimized out by the compiler.
2017-03-31 12:05:25 +01:00
Serhiy Storchaka ba85d69a3e bpo-29878: Add global instances of int for 0 and 1. (#852) 2017-03-30 09:09:41 +03:00
Serhiy Storchaka 0b3ec19225 Use NULL rather than 0. (#778)
There was few cases of using literal 0 instead of NULL in the context of
pointers.  While this was a legitimate C code, using NULL rather than 0 makes
the code clearer.
2017-03-23 17:53:47 +02:00
Serhiy Storchaka 8999caeb00 bpo-15695: Implemented StgDict.__sizeof__(). (#509) 2017-03-12 11:12:30 +02:00
orenmn 1bea762d9e bpo-28129: fix ctypes crashes (#386)
* init commit, with initial tests for from_param and fields __set__ and __get__, and some additions to from_buffer and from_buffer_copy

* added the rest of tests and patches. probably only a first draft.

* removed trailing spaces

* replace ctype with ctypes in error messages

* change back from ctypes instance to ctype instance
2017-03-02 18:42:40 +01:00
Vinay Sajip a86339b83f Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168)
* Fixed bpo-29565: Corrected ctypes passing of large structs by value.

Added code and test to check that when a structure passed by value
is large enough to need to be passed by reference, a copy of the
original structure is passed. The callee updates the passed-in value,
and the test verifies that the caller's copy is unchanged. A similar
change was also added to the test added for bpo-20160 (that test was
passing, but the changes should guard against regressions).

* Reverted unintended whitespace changes.
2017-02-20 00:16:33 +00:00
Serhiy Storchaka d1302c0154 Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible but Coccinelle couldn't find opportunity.
2017-01-23 10:23:58 +02:00
Serhiy Storchaka 228b12edcc Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible.  Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka 5ab81d787f Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. 2016-12-16 16:18:57 +02:00
Victor Stinner 5670764812 Use _PyObject_CallMethodIdObjArgs() in _ctypes
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() in unpickle(). _PyObject_CallMethodIdObjArgs()
avoids the creation of a temporary tuple and doesn't have to parse a format
string.

Replace _PyObject_CallMethodId() with _PyObject_GetAttrId()+PyObject_Call() for
the second call since it requires to "unpack" a tuple.

Add also a check in the type of the second parameter (state): it must be a
tuple.
2016-12-09 15:18:31 +01:00
Victor Stinner 070c4d7ca7 Issue #28915: Use _PyObject_CallNoArg()
Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func).
2016-12-09 12:29:18 +01:00
Victor Stinner f17c3de263 Use _PyObject_CallNoArg()
Replace:
    PyObject_CallFunctionObjArgs(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner a5ed5f000a Use _PyObject_CallNoArg()
Replace:
    PyObject_CallObject(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Martin Panter 7d6e9232b1 Issue #25659: Merge ctypes fix from 3.6 2016-11-20 22:17:44 +00:00
Martin Panter 04b35753f7 Issue #25659: Merge ctypes fix from 3.5 2016-11-20 22:07:29 +00:00
Serhiy Storchaka 85b0f5beb1 Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02: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
Serhiy Storchaka a98c4a984b Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:40 +02:00
Serhiy Storchaka 06515833fe Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Serhiy Storchaka f6f1591808 Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:48:30 +02:00
Serhiy Storchaka e20973926a Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:48:07 +02:00
Serhiy Storchaka 144f77a981 Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:47:21 +02:00
Ned Deily ae8ca1c0e2 Issue #24381: merge from 3.6 2016-10-20 15:40:56 -04:00
Ned Deily 82919ec44f Issue #24381: merge from 3.5 2016-10-20 15:40:22 -04:00
Ned Deily f536af1fcd Issue #24381: Avoid unused function warning when building bundled macOS libffi.
Patch by Vajrasky Kok.
2016-10-20 15:38:27 -04:00
Zachary Ware f40d4ddff3 Closes #27979: Remove bundled copy of libffi
An installed copy of libffi is now required for building _ctypes on
any platform but OSX and Windows.
2016-09-17 01:25:24 -05:00
Martin Panter 6d57fe1c23 Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Martin Panter 0be894b2f6 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-09-07 12:03:06 +00:00
Martin Panter be8da9c990 Issue #27570: Avoid zero-length memcpy() calls with null source pointers 2016-09-07 11:04:41 +00:00
Benjamin Peterson 5130a4d5d7 Backed out changeset 8b6be1341770 2016-09-05 17:22:09 -07:00
Benjamin Peterson 6d999803a0 remove long double from ctypes value union
It is unused. It also forces a 16-byte alignment, which creates problems because
Python's allocator only uses 8-byte alignment.
2016-09-05 16:24:52 -07:00
Benjamin Peterson c235af47f1 fix a PY_LONG_LONG straggler 2016-09-08 09:25:03 -07:00
Benjamin Peterson 47ff0734b8 more PY_LONG_LONG to long long 2016-09-08 09:15:54 -07:00
Martin Panter 1c748f3830 Issue #27570: Merge null pointer fixes from 3.5 2016-09-07 23:31:39 +00:00
Benjamin Peterson 840ef8f84b more linux -> __linux__ 2016-09-07 14:45:10 -07:00
Benjamin Peterson a9296e7f3b require C99 bool 2016-09-07 11:06:17 -07:00
Steve Dower a439191efa Fix some warnings from MSVC 2016-09-06 19:09:15 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Benjamin Peterson f3dd32950b merge 3.5 2016-09-05 17:22:22 -07:00
Benjamin Peterson 63604032af merge 3.5 2016-09-05 16:27:08 -07: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
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07: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
Victor Stinner 2561726aa6 Merge 3.5 (issue #11048) 2016-07-27 16:59:22 +02:00
Victor Stinner e33797b686 ctypes: fix CThunkObject_new()
* Initialize restype and flags fields to fix a crash when Python runs on a
  read-only file system
* Use Py_ssize_t type rather than int for the "i" iterator variable
* Reorder assignements to be able to more easily check if all fields are
  initialized

Issue #11048. Initial patch written by Marcin Bachry.
2016-07-27 16:58:47 +02: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
Serhiy Storchaka d4b45cb9ca ctypes: the type of b_size is Py_ssize_t. 2016-06-17 11:13:03 +03:00
Serhiy Storchaka 85e6635edf ctypes: the type of b_size is Py_ssize_t. 2016-06-17 11:11:07 +03:00
Serhiy Storchaka 74108614b1 Issue #27330: Fixed possible leaks in the ctypes module. 2016-06-16 22:10:13 +03:00
Serhiy Storchaka adef6460d7 Issue #27330: Fixed possible leaks in the ctypes module. 2016-06-16 22:08:46 +03:00
Martin Panter e2e71685f3 Issue #27171: Fix typo in exception message 2016-06-02 10:13:47 +00: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
Martin Panter 0e40df6e54 Merge ctypes from 3.5 2016-05-14 06:17:30 +00:00
Martin Panter 2dc1bbb659 Remove outdated PEP 291 compatibility requirement comment 2016-05-14 05:55:38 +00:00
Serhiy Storchaka c2f7d87897 Issue #26932: Fixed support of RTLD_* constants defined as enum values,
not via macros (in particular on Android).  Patch by Chi Hsuan Yen.
2016-05-04 09:44:44 +03:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Serhiy Storchaka f01e408c16 Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka 57a01d3a0e Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka ec39756960 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:50:03 +03:00
Serhiy Storchaka 48842714b9 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:45:48 +03:00
Martin Panter 3008b1c4bb Issue #26304: Merge doc wording from 3.5 2016-02-10 05:44:56 +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
Zachary Ware bffa73e582 Issue #25972, #20440: Fix compilation on Windows 2015-12-28 21:51:02 -08:00
Serhiy Storchaka 1ed017ae92 Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner.
This patch doesn't fix bugs and hence there is no need to backport it.
2015-12-27 15:51:32 +02:00
Serhiy Storchaka 726fc139a5 Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:44:33 +02:00
Serhiy Storchaka 191321d11b Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:41:34 +02:00
Serhiy Storchaka ef1585eb9a Issue #25923: Added more const qualifiers to signatures of static and private functions. 2015-12-25 20:01:53 +02:00
Serhiy Storchaka 2d06e84455 Issue #25923: Added the const qualifier to static constant arrays. 2015-12-25 19:53:18 +02:00
Serhiy Storchaka f006940351 Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:39:57 +02:00
Serhiy Storchaka 5a57ade58e Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Martin Panter ad587f96a3 Issue #25845: Merge PyLong_Check() cleanup from 3.5 2015-12-12 07:14:03 +00:00
Martin Panter f0c0318cdc Issue #25845: Drop redundant checks leftover from int to long conversion 2015-12-12 06:57:13 +00:00
Martin Panter ceaabc100c Issue #25498: Merge ctypes crash fix from 3.5 2015-11-13 22:14:53 +00:00
Martin Panter 0da4ac1f21 Issue #25498: Merge ctypes crash fix from 3.4 into 3.5 2015-11-13 22:12:12 +00:00
Martin Panter 1bb651540e Issue #25498: Fix GC crash due to ctypes objects wrapping a memoryview
This was a regression caused by revision 1da9630e9b7f.  Based on patch by
Eryksun.
2015-11-13 21:43:39 +00:00
Serhiy Storchaka fad85aadb0 Issue #25558: Use compile-time asserts. 2015-11-07 15:42:38 +02:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Victor Stinner 9c631a0f71 Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch
written by Matthieu Gautier.
2015-07-29 14:33:52 +02:00
Victor Stinner 5ef6fde92c Merge 3.4 (ctypes) 2015-07-29 14:35:12 +02:00
Benjamin Peterson 43e3d22fee merge 3.4 (#23042) 2015-05-08 21:32:36 -04:00
Benjamin Peterson 0171d7faa0 fix libffi compilation on FreeBSD (#23042)
Patch from Marc-Andre Lemburg.
2015-05-08 21:31:36 -04:00
Berker Peksag dfa4e045a3 Issue #23943: Fix typos. Patch by Piotr Kasprzyk. 2015-04-14 09:35:51 +03:00
Berker Peksag 4882cacab6 Issue #23943: Fix typos. Patch by Piotr Kasprzyk. 2015-04-14 09:30:01 +03:00
Serhiy Storchaka f8aa133cce Issue #23338: Fixed formatting ctypes error messages on Cygwin.
Patch by Makoto Kato.
2015-04-04 10:06:58 +03:00
Serhiy Storchaka 2e229e025c Issue #23338: Fixed formatting ctypes error messages on Cygwin.
Patch by Makoto Kato.
2015-04-04 10:05:48 +03:00
Steve Dower ef42dae7fa Issue #23765: Remove IsBadStringPtr calls in ctypes
Also renames a local to avoid warnings about shadowing
2015-03-24 23:28:54 -07:00
Serhiy Storchaka b48af340b9 Silenced minor GCC warnings. 2015-02-26 15:27:57 +02:00
Serhiy Storchaka 26861b0b29 Issue #23450: Fixed possible integer overflows. 2015-02-16 20:52:17 +02:00
Serhiy Storchaka 4d0d982985 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:33:32 +02:00
Serhiy Storchaka 1a1ff29659 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka 4fdb68491e Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Benjamin Peterson 610bc6a211 merge 3.4 (#23221) 2015-01-13 09:20:31 -05:00
Benjamin Peterson 82f34ada45 fix instances of consecutive articles (closes #23221)
Patch by Karan Goel.
2015-01-13 09:17:24 -05:00
Steve Dower 2a8ef68028 Issue #22733: MSVC ffi_prep_args doesn't handle 64-bit arguments properly 2014-12-17 06:31:44 -08:00
Benjamin Peterson 8726f2b89c merge 3.4 2014-11-06 00:53:18 -05:00
Benjamin Peterson abd1c97bd2 fix test where sizeof(long) != sizeof(int) 2014-11-06 00:52:58 -05:00
Steve Dower 5c2939cc41 Issue #20160: broken ctypes calling convention on MSVC / 64-bit Windows (large structs) Patch by mattip 2014-11-05 19:30:30 -08:00
Steve Dower b7fa201113 Issue #20160: broken ctypes calling convention on MSVC / 64-bit Windows (large structs) Patch by mattip 2014-11-04 21:21:22 -08:00
R David Murray 9755174464 Merge: #13096: Fix segfault in CTypes POINTER handling of large values. 2014-10-12 13:56:37 -04:00
R David Murray 817905b239 #13096: Fix segfault in CTypes POINTER handling of large values.
Patch by Meador Inge.
2014-10-12 13:54:48 -04:00
Antoine Pitrou 94262ebc9c Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:02:40 +02:00
Antoine Pitrou 0ddbf4795f Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:00:09 +02:00
Victor Stinner 706768c687 Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
2014-08-16 01:03:39 +02:00
doko@ubuntu.com 3b48af018f - Issue #22176: Fix build failure on ARM with -Werror=declaration-after-statement 2014-08-10 00:01:04 +02:00
doko@ubuntu.com 6a66f155df - Issue #22176: Add src/x86/win32.S for x86 libffi builds. 2014-08-09 23:52:34 +02:00
doko@ubuntu.com 736a913321 - Issue #22176: Update the ctypes module's libffi to v3.1. This release
adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian
  architectures.
2014-08-09 22:36:35 +02:00
Serhiy Storchaka 4f06d604c4 Issue #22161: Conformed arguments type checks in ctype to actually supported
types.  Corrected error messages about bytes arguments.
2014-08-09 09:33:05 +03:00
Benjamin Peterson 5eb6b39210 support pep 3118 format strings for ctypes objects with nontrivial shapes (closes #10744)
Patch by Matti Picus.
2014-05-17 14:59:12 -07:00
Benjamin Peterson fca286601b merge 3.3 (#20946) 2014-03-16 11:30:54 -05:00
Benjamin Peterson fda33559dc fix ctypes test alignment assumptions (closes #20946)
Patch by Andreas Schwab.
2014-03-16 10:07:26 +01:00
Serhiy Storchaka dfe98a102e Issue #20437: Fixed 22 potential bugs when deleting objects references. 2014-02-09 13:46:20 +02:00
Serhiy Storchaka 505ff755d7 Issue #20437: Fixed 21 potential bugs when deleting objects references. 2014-02-09 13:33:53 +02:00
Serhiy Storchaka fe5fff6305 Issue #19936: Restored executable bits for several libffi files.
These files have shebangs and executable bits in the libffi distribution.
2014-01-23 16:23:50 +02:00
Serhiy Storchaka 744135d7bb Issue #19936: Restored executable bits for several libffi files.
These files have shebangs and executable bits in the libffi distribution.
2014-01-23 16:22:55 +02:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Serhiy Storchaka b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
Christian Heimes bd306db07c silence unused-value warnings in libffi's dlmalloc.c 2013-12-04 09:43:21 +01:00
Victor Stinner e106e5ce4b Issue #19437: Fix error handling of PyCArrayType_new(), don't decreases the
reference counter of stgdict after result stole a reference to it
2013-11-18 18:37:33 +01:00
Victor Stinner 2399ad51d4 Issue #19437: Fix error handling of CDataType_from_buffer()
KeepRef() decreases the reference counter of its 'keep' parameter on error
2013-11-18 18:35:55 +01:00
Gregory P. Smith 61b976f127 Fix compilation error under gcc of the ctypes module bundled libffi for arm.
A variable was declared below the top of a block and one function was using
a K&R C style function declaration!
2013-11-17 21:57:43 +00:00
Gregory P. Smith 7929a1da1a Fix compilation error under gcc of the ctypes module bundled libffi for arm.
A variable was declared below the top of a block and one function was using
a K&R C style function declaration!
2013-11-17 21:56:07 +00:00
Victor Stinner 3b5901143d Fix compiler warning on Windows 64 bit: _init_pos_args() result type is
Py_ssize_t, not int
2013-11-16 00:17:22 +01:00
Victor Stinner e223439c13 Issue #19437: Fix ctypes, handle PyCData_GetContainer() and GetKeepedObjects()
failures
2013-11-13 13:29:37 +01:00
Victor Stinner 588544d186 Issue #19437: Fix GetKeepedObjects() of ctypes, handle PyCData_GetContainer()
failure
2013-11-13 13:24:50 +01:00
Victor Stinner 7184366dab Issue #19437: Fix PyCData_GetContainer() of ctypes, handle PyDict_New() failure 2013-11-13 13:23:35 +01:00
Victor Stinner bd303c165b Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner 090543736f Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects

Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner e75996a77c Issue #19437: Fix PyCFuncPtrType constructor, handle
_ctypes_alloc_format_string() failure
2013-10-31 16:34:08 +01:00
Victor Stinner a215002453 Issue #19437: Fix PyCArrayType constructor, raise MemoryError on PyMem_Malloc()
failure
2013-10-31 16:33:05 +01:00
Victor Stinner 6decccdafe Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure 2013-10-29 16:05:14 +01:00
Victor Stinner dd371b92c4 Issue #18408: Fix PyCStructUnionType_update_stgdict(), handle
_ctypes_alloc_format_string() failure
2013-10-29 03:50:45 +01:00
Victor Stinner 68f6adca6d Issue #18408: Fix _ctypes_alloc_format_string(), raise MemoryError on memory
allocation failure
2013-10-29 03:50:21 +01:00
Antoine Pitrou 4d397008cd Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers. 2013-10-23 19:21:55 +02:00
Antoine Pitrou 09fcb72048 Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers. 2013-10-23 19:20:21 +02:00
Georg Brandl 782952b8fe Re #18521: fix not-quite-C syntax that works only because the PyXXX_Check are macros defined with () around them. 2013-10-14 06:46:12 +02:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Christian Heimes 1d8e7dbf1a Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke malloc weak symbols. 2013-08-17 15:02:05 +02:00
Christian Heimes 9ff79f7c46 Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke malloc weak symbols. 2013-08-17 15:01:54 +02:00
Serhiy Storchaka 8fa8ee3970 Issue #18701: Remove support of old CPython versions (<3.0) from C code. 2013-08-17 00:48:02 +03:00
Raymond Hettinger d7bd7a5525 Silence compiler warnings for strict function prototype declarations. 2013-08-04 12:43:37 -07:00
Raymond Hettinger 28dc9b9fc0 merge 2013-08-04 12:43:59 -07:00
Victor Stinner 044c516854 Issue #18609, #18408: _ctypes_add_traceback() now clears the current exception
while adding the traceback, because it may call indirectly a Python function
and Python functions must not be called with an exception set.

In the case of the issue #18609, _ctypes_add_traceback() called the iso8859-1
decoder which is implemented in Python. Python has a ISO-8859-1 codec
implemented in C. It is not used because PyUnicode_Decode() only uses the C
codec for other names (aliases) of this codec ("latin-1", "latin1" and
"iso-8859-1").
2013-08-02 00:47:47 +02:00
Christian Heimes f6e7e36c3d Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL.
CID 486199
2013-07-26 23:04:39 +02:00
Christian Heimes 6ca8a05f10 Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL.
CID 486199
2013-07-26 23:04:29 +02:00
Brett Cannon 5d7c1b1a2b merge for issue #18556 2013-07-25 17:36:15 -04:00
Brett Cannon 845f7845aa Issue #18556: Check the return value for PyUnicode_AsWideChar() in
U_set() from ctypes.

CID #486657
2013-07-25 17:34:00 -04:00
Christian Heimes 71945880fb Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() 2013-07-21 16:25:30 +02:00
Christian Heimes 8c4c1f6e66 Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() 2013-07-21 16:24:51 +02:00
Christian Heimes abfc4d838a Fix fishy sizeof(Py_ssize_t *).
sizeof(Py_ssize_t *) == sizeof(Py_ssize_t) but it's not a portable assumption.
CID 486403
2013-07-20 14:11:52 +02:00
Raymond Hettinger 5ea0f80165 Make the GCC-4.8 compiler happy by moving declarations to the top of the function. 2013-07-19 19:52:04 -07:00
Victor Stinner 3f15cf0961 Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure
(MemoryError).
2013-07-09 00:27:12 +02:00
Benjamin Peterson 15a7d2e8d6 merge 3.3 (#18248) 2013-06-19 09:01:58 -07:00
Benjamin Peterson 19886b8adc fix libffi build on AIX (closes #18248) 2013-06-19 09:01:42 -07:00
Christian Heimes 262e7f389c fixed libffi on PPC without __NO_FPRS__
ISO C90 forbids mixed declarations and code
2013-06-19 02:43:19 +02:00
Christian Heimes 2f13f546e6 fixed libffi on PPC without __NO_FPRS__
ISO C90 forbids mixed declarations and code
2013-06-19 02:40:38 +02:00
Christian Heimes 360b89ca5e Fix for r84195: add HAVE_ALLOCA_H to configure and only include alloca.h if it's available 2013-06-18 13:22:37 +02:00
Christian Heimes f0400baba8 Fix for r84195: add HAVE_ALLOCA_H to configure and only include alloca.h if it's available 2013-06-18 13:22:17 +02:00
Victor Stinner 8f0aae54ba (Merge 3.3) ctypes: AIX needs an explicit #include <alloca.h> to get alloca() 2013-06-17 22:02:14 +02:00
Victor Stinner 43b2639fe2 ctypes: AIX needs an explicit #include <alloca.h> to get alloca() 2013-06-17 22:01:53 +02:00
Gregory P. Smith d8fe1f7881 * Fix remaining bits of issue 17192 for 3.4 - these changes
were missing from a messed up merge during the libffi 3.0.13
  import.  the diffs from upstream libffi 3.0.13 are now small.
2013-04-30 00:03:30 -07:00
Gregory P. Smith 5dc268ed26 * Fix remaining bits of issue 17192 for 3.3 - these changes
were missing from a messed up merge during the libffi 3.0.13
  import.  the diffs from upstream libffi 3.0.13 are now small.
2013-04-30 00:03:01 -07:00
Gregory P. Smith 6897267759 * Fix PART of issue 17192 for 3.4 - reapply the issue11729 patch
that was undone in the merge fun from upstream which already
  had it in 3.0.13.
* Add the missing update to libffi.info.
2013-04-29 23:48:03 -07:00
Gregory P. Smith e9d0633d36 * Fix PART of issue 17192 for 3.3 - reapply the issue11729 patch
that was undone in the merge fun from upstream which already
  had it in 3.0.13.
* Add the missing update to libffi.info.
2013-04-29 23:47:17 -07:00
Gregory P. Smith 933059710c * Fix issue 17192 for 3.2 - reapply the issue11729 patch that was undone
in the merge fun from upstream which already had it in 3.0.13.
* Add the missing update to libffi.info.
2013-04-29 23:45:38 -07:00
Kristján Valur Jónsson d6e9f32b79 Merge 2013-03-19 16:00:01 -07:00
Kristján Valur Jónsson ece12222ce Merge 2013-03-19 15:57:19 -07:00
Kristján Valur Jónsson 23f854ca68 Issue #10296: Merge to default 2013-03-19 15:38:32 -07:00
Kristján Valur Jónsson a251b37179 #10296: Merge to 3.3 2013-03-19 15:35:28 -07:00
Gregory P. Smith c70e53aca8 Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues
on some more recent platforms.
2013-03-19 15:24:46 -07:00
Kristján Valur Jónsson 5aed330e37 Issue #10296 : Don't handle BreakPoint exceptions using
Structured Exception Handling on windows.
2013-03-19 15:24:10 -07:00
Gregory P. Smith 0408bf9cfb Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues
on some more recent platforms.
2013-03-19 14:59:02 -07:00
Gregory P. Smith 029273fc90 Fixes issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues on
some more recent platforms.
2013-03-18 17:11:20 -07:00
Terry Jan Reedy 16c41d8520 Merge 3.3, issue #17047: remove doubled words found in 2.7 to 3.4
Modules/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:46:07 -04:00
Terry Jan Reedy 09b7503bc9 Merge 3.2, Issue #17047: remove doubled words found in 2.7 to 3.4
Modules/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:45:12 -04:00
Terry Jan Reedy 0158af38b7 Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:42:46 -04:00
Eli Bendersky ca83233216 Fix formatting changes that led to compilation errors 2013-03-06 06:30:23 -08:00
Eli Bendersky 3612da6b2b call_commethod was only used in samples/Windows, which no longer exists.
This method is dead code - not documented, not tested. As far as we know, it
can be horribly broken.
2013-03-06 06:21:46 -08:00
Eli Bendersky d867bad0fc Fix some formatting 2013-03-06 05:45:57 -08:00
doko@ubuntu.com 38e2a2afbd - Issue #17192: Import libffi-3.0.12. 2013-02-12 15:33:16 +01:00
Serhiy Storchaka b6a53404b7 Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
2013-02-04 12:57:16 +02:00
Serhiy Storchaka 1d0bb9c8f9 Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
2013-02-04 12:54:04 +02:00
Serhiy Storchaka 19c4e0df29 Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
2013-02-04 12:47:24 +02:00
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka 441d30fac7 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Stefan Krah 31efb380b3 Merge 3.3. 2013-01-16 23:25:41 +01:00
Stefan Krah 897c3e994f Issue #11729: Backport commit bff052d9 from libffi upstream in order to fix
a ctypes build failure with clang.
2013-01-16 23:18:34 +01:00
Serhiy Storchaka 7898043868 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
2013-01-15 01:12:17 +02:00
Kristjan Valur Jonsson 1724bb196a Merge with 3.3 : Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 11:23:23 +00:00
Kristjan Valur Jonsson c51bafbbda Merge with 3.2 : Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 11:22:29 +00:00
Kristjan Valur Jonsson 3cbdaa3fee Merge with 3.1 : Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 11:20:53 +00:00
Kristjan Valur Jonsson 9946bd69fa Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 09:41:25 +00:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Benjamin Peterson 18d105b824 merge 3.2 2012-12-15 15:44:08 -05:00
Benjamin Peterson 7eb8a1a0cb remove dead code 2012-12-15 15:43:58 -05:00
Antoine Pitrou 12f33df4a2 Issue #16628: Fix a memory leak in ctypes.resize(). 2012-12-08 11:07:16 +01:00
Antoine Pitrou 305e1a749f Issue #16628: Fix a memory leak in ctypes.resize(). 2012-12-08 11:05:50 +01:00
Ronald Oussoren cb460b920f Fix issue 13370: Ensure that ctypes works on Mac OS X when Python is
compiled using the clang compiler

(merge from 3.2)
2012-08-25 11:24:00 +02:00
Ronald Oussoren 25437565f9 Fix issue 13370: Ensure that ctypes works on Mac OS X when Python is compiled using the clang compiler 2012-08-25 11:19:14 +02:00
Meador Inge 7506dab2e8 Issue #6493: Fix handling of c_uint32 bitfields with width of 32 on Windows. 2012-07-19 00:14:35 -05:00
Meador Inge 60c2266afe Issue #6493: Fix handling of c_uint32 bitfields with width of 32 on Windows. 2012-07-19 00:01:22 -05:00
doko@ubuntu.com d4ea23f200 - Issue #15194: check in the missing m4/ax_append_flag.m4 file.
Regenerate aclocalm4 and configure.
2012-07-01 01:08:20 +02:00
doko@ubuntu.com 49a7da30aa - Issue #15194: check in the missing m4/ax_check_compile_flag.m4 file.
Regenerate aclocalm4 and configure.
2012-07-01 00:37:47 +02:00
doko@ubuntu.com cc5addd3b6 - Issue #14330: Don't derive the include and library search dirs
from GCC for native builds
2012-07-01 00:23:51 +02:00
doko@ubuntu.com 36f98051af - Regenerate the libffi configure file 2012-06-30 22:35:52 +02:00
Matthias Klose c02be613cc - whitespace-normalize libffi file 2012-06-26 17:59:32 +02:00
doko@ubuntu.com 2a918768f1 - Issue #15194: Update libffi to the 3.0.11 release. 2012-06-26 17:56:44 +02:00
Meador Inge d102e04e4a Issue #9041: raised exception is misleading
An issue in ctypes.c_longdouble, ctypes.c_double, and ctypes.c_float that
caused an incorrect exception to be returned in the case of overflow has been
fixed.
2012-05-28 14:47:53 -05:00
Meador Inge 031e25b0f7 Issue #9041: raised exception is misleading
An issue in ctypes.c_longdouble, ctypes.c_double, and ctypes.c_float that
caused an incorrect exception to be returned in the case of overflow has been
fixed.
2012-05-28 14:21:16 -05:00
Meador Inge c9e7ef7d70 - Issue #13840: Fix ctypes.create_string_buffer exception message and docs. 2012-01-26 08:47:27 -06:00
Meador Inge 65992c1c01 - Issue #13840: Fix ctypes.create_string_buffer exception message and docs. 2012-01-26 08:44:00 -06:00
Ezio Melotti e81ac8b56b #13665: merge with 3.2. 2012-01-18 05:43:21 +02:00