Andy Lester
7668a8bc93
Use calloc-based functions, not malloc. (GH-19152)
2020-03-24 23:26:44 -05:00
Hai Shi
2037502613
bpo-1635741: Port _ctypes_test extension to multiphase initialization (PEP 489) (GH-19012)
2020-03-17 02:15:23 +01:00
Victor Stinner
3225b9f973
bpo-39877: Remove useless PyEval_InitThreads() calls (GH-18883)
...
Py_Initialize() calls PyEval_InitThreads() since Python 3.7. It's no
longer needed to call it explicitly.
2020-03-09 20:56:57 +01:00
Dong-hee Na
1b55b65638
bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)
2020-02-17 11:09:15 +01:00
Petr Viktorin
ffd9753a94
bpo-39245: Switch to public API for Vectorcall (GH-18460)
...
The bulk of this patch was generated automatically with:
for name in \
PyObject_Vectorcall \
Py_TPFLAGS_HAVE_VECTORCALL \
PyObject_VectorcallMethod \
PyVectorcall_Function \
PyObject_CallOneArg \
PyObject_CallMethodNoArgs \
PyObject_CallMethodOneArg \
;
do
echo $name
git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
done
old=_PyObject_FastCallDict
new=PyObject_VectorcallDict
git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"
and then cleaned up:
- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
2020-02-11 17:46:57 +01:00
Dong-hee Na
7f6f7eef52
bpo-39573: Use Py_TYPE() macro in ctypes.h (GH-18411)
2020-02-09 00:45:52 +01:00
Victor Stinner
d2ec81a8c9
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
...
Add Py_SET_TYPE() function to set the type of an object.
2020-02-07 09:17:07 +01:00
Victor Stinner
daa9756cb6
bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)
...
Replace direct access to PyObject.ob_type with Py_TYPE().
2020-02-07 03:37:06 +01:00
Zackery Spytz
13c1c3556f
bpo-39393: Misleading error message on dependent DLL resolution failure (GH-18093)
2020-01-28 20:42:43 +11:00
Vinay Sajip
c12440c371
bpo-16575: Disabled checks for union types being passed by value. (GH-17960)
...
Although the underlying libffi issue remains open, adding these
checks have caused problems in third-party projects which are in
widespread use. See the issue for examples.
The corresponding tests have also been skipped.
2020-01-12 08:54:00 +00:00
Zackery Spytz
e02ab59fdf
bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-16857)
2020-01-03 13:16:12 +01:00
Steve Dower
dcf1f83de8
bpo-38622: Ensure ctypes.PyObj_FromPtr audit event passes tuples as a single argument (GH-17243)
2019-11-18 13:30:01 -08:00
Steve Dower
00923c6399
bpo-38622: Add missing audit events for ctypes module (GH-17158)
2019-11-18 11:32:46 -08:00
Vinay Sajip
106271568c
bpo-16576: Add checks for bitfields passed by value to functions. (GH-17097)
2019-11-12 12:29:34 +00:00
Vinay Sajip
79d4ed102a
bpo-16575: Add checks for unions passed by value to functions. (GH-16799)
2019-10-31 08:03:54 +00:00
Vinay Sajip
0b60f64e43
bpo-11410: Standardize and use symbol visibility attributes across POSIX and Windows. (GH-16347)
2019-10-15 08:26:12 +01:00
Vinay Sajip
e8bedbddad
bpo-38368: Added fix for ctypes crash when handling arrays in structs… (GH-16589)
2019-10-08 21:59:06 +01:00
Victor Stinner
c9a413ede4
bpo-38321: Fix PyCStructUnionType_update_stgdict() warning (GH-16492)
...
bpo-22273, bpo-38321: Fix following warning:
modules\_ctypes\stgdict.c(704):
warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
2019-09-30 16:49:47 +01:00
Vinay Sajip
c64af8fad3
Changed conditions for ctypes array-in-struct handling. (GH-16381)
2019-09-25 11:11:57 +01:00
Vinay Sajip
57dc7d5ae8
bpo-22273: Disabled tests while investigating buildbot failures on ARM7L/PPC64. (GH-16377)
2019-09-25 07:58:32 +01:00
Vinay Sajip
12f209eccb
bpo-22273: Update ctypes to correctly handle arrays in small structur… (GH-15839)
2019-09-25 04:38:44 +01:00
Zackery Spytz
ea683deccc
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
...
An exception may occur during a PyObject_IsSubclass() call.
2019-09-12 11:09:32 +01:00
Kenta Murata
9e61066355
Fix calling order of PyEval_InitThreads. (GH-4602)
...
As described in Doc/c-api/init.rst, PyEval_InitThreads() cannot be called
before Py_Initialize() function.
2019-09-10 11:29:56 +01:00
Zackery Spytz
a6563650c8
bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)
...
If FormatMessageW() is passed the FORMAT_MESSAGE_FROM_SYSTEM flag without FORMAT_MESSAGE_IGNORE_INSERTS, it will fail if there are insert sequences in the message definition.
2019-09-09 02:20:38 -07:00
HongWeipeng
3c87a667bb
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
...
This is a complement to PR 13375.
2019-09-08 13:15:56 +03:00
Min ho Kim
39d87b5471
Fix typos mostly in comments, docs and test names (GH-15209)
2019-08-30 16:21:19 -04:00
Victor Stinner
96b4087ce7
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
...
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.
Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.
2019-08-30 14:30:33 +02:00
Min ho Kim
c4cacc8c5e
Fix typos in comments, docs and test names ( #15018 )
...
* Fix typos in comments, docs and test names
* Update test_pyparse.py
account for change in string length
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Apply suggestion: Dealloccte -> Deallocate
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Update posixmodule checksum.
* Reverse idlelib changes.
2019-07-30 18:16:13 -04:00
Jeroen Demeyer
59ad110d7a
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
2019-07-11 17:59:05 +09:00
Hai Shi
3a3db970de
bpo-27679: Remove set_bitfields() from _ctypes_test (GH-14648)
2019-07-09 20:00:27 +02:00
Jeroen Demeyer
762f93ff2e
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
2019-07-08 17:19:25 +09:00
Jeroen Demeyer
7f41c8e0dd
bpo-37493: use _PyObject_CallNoArg in more places (GH-14575)
2019-07-04 19:35:31 +09:00
Jeroen Demeyer
196a530e00
bpo-37483: add _PyObject_CallOneArg() function ( #14558 )
2019-07-04 19:31:34 +09:00
Eric Wieser
0690c79c41
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects ( #13881 )
2019-06-07 10:13:26 +02:00
Jeroen Demeyer
530f506ac9
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
...
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
2019-05-30 19:13:39 -07:00
Victor Stinner
71c52e3048
bpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)
...
* sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs.
* Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call()
and gc delete_garbage().
2019-05-27 08:57:14 +02:00
Steve Dower
b82e17e626
bpo-36842: Implement PEP 578 (GH-12613)
...
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
2019-05-23 08:45:22 -07:00
Zackery Spytz
14514d9084
bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)
...
The final addition (cur += step) may overflow, so use size_t for "cur".
"cur" is always positive (even for negative steps), so it is safe to use
size_t here.
Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
2019-05-17 10:13:03 +03:00
Zackery Spytz
1a2252ed39
bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
...
In addition, fix some other minor violations of C99.
2019-05-06 12:56:50 -04:00
Inada Naoki
9d062d690b
ctypes: remove use of legacy unicode API (GH-12340)
...
PyUnicode_AsUnicodeAndSize() -> PyUnicode_AsWideChar()
2019-04-19 16:07:19 +09:00
Paul Monson
11efd79076
bpo-36071 Add support for Windows ARM32 in ctypes/libffi (GH-12059)
2019-04-17 18:09:16 -07:00
Zackery Spytz
487b73ab39
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660)
2019-04-02 13:47:51 +03:00
Zackery Spytz
5f2c50810a
bpo-36150: Fix possible assertion failures due to _ctypes.c's PyCData_reduce(). (GH-12106)
2019-03-31 19:02:11 +03:00
Zackery Spytz
48600c72c1
bpo-35947: Fix a compiler warning in _ctypes.c's StructUnionType_paramfunc(). (GH-12629)
2019-03-31 19:00:12 +03:00
Steve Dower
2438cdf0e9
bpo-36085: Enable better DLL resolution on Windows (GH-12302)
2019-03-29 16:37:16 -07:00
Paul Monson
32119e10b7
bpo-35947: Update Windows to the current version of libffi (GH-11797)
...
We now use a pre-built libffi binary from our binaries repository, and no longer vendor the full implementation.
2019-03-29 16:30:10 -07:00
Zackery Spytz
5e333784f0
bpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new(). (GH-12530)
...
Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
2019-03-25 10:07:47 +02:00
Serhiy Storchaka
d53fe5f407
bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)
2019-03-13 22:59:55 +02:00
Tony Roberts
4860f01ac0
bpo-33895: Relase GIL while calling functions that acquire Windows loader lock (GH-7789)
...
LoadLibrary, GetProcAddress, FreeLibrary and GetModuleHandle acquire the system loader lock. Calling these while holding the GIL will cause a deadlock on the rare occasion that another thread is detaching and needs to destroy its thread state at the same time.
2019-02-02 09:16:42 -08:00
Andreas Schwab
742d768656
bpo-35847: RISC-V needs CTYPES_PASS_BY_REF_HACK (GH-11694)
...
This fixes the ctypes.test.test_structures.StructureTestCase test.
https://bugs.python.org/issue35847
2019-01-29 08:16:10 -08:00