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