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
Michael Felt
22462da70c
bpo-27643 - skip test_ctypes test case with XLC compiler. (GH-5164)
...
This test case needs "signed short" bitfields, but the
IBM XLC compiler (on AIX) does not support this.
Skip the code and test when AIX and XLC are used.
Use __xlc__ as identifier to detect the XLC compiler.
2018-12-26 13:54:22 +10:00
Zackery Spytz
d77d97c9a1
bpo-35529: Fix a reference counting bug in PyCFuncPtr_FromDll(). (GH-11229)
...
"dll" would leak if an error occurred in _validate_paramflags() or
GenericPyCData_new().
2018-12-20 10:29:38 +02:00
Zackery Spytz
842acaab13
bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175)
2018-12-17 16:52:45 +02:00
Zackery Spytz
4c49da0cb7
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015)
...
Set MemoryError when appropriate, add missing failure checks,
and fix some potential leaks.
2018-12-07 12:11:30 +02:00
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