Zackery Spytz
2bfc2dc214
[2.7] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() (GH-13860) (GH-13898)
...
(cherry picked from commit dc2476500d
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-06-07 18:22:56 +02:00
Victor Stinner
80dfe99016
bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606) (GH-13625)
...
Fix possible overflow in wrap_lenfunc() when
sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows).
(cherry picked from commit 05f16416d9
)
2019-05-28 17:23:07 +02:00
Miss Islington (bot)
eda691dd9d
closes bpo-36951: Correct some types in the type_members struct in typeobject.c. (GH-13403)
...
(cherry picked from commit 53d378c812
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-05-19 17:49:50 -07:00
Victor Stinner
f24a9f3bf4
bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850) (GH-13319)
...
(cherry picked from commit f0be4bbb9b
)
2019-05-15 16:31:10 +02:00
Inada Naoki
4e8e8aabc6
bpo-30134: fix BytesWarning doc, docstring and message (GH-12739)
2019-04-09 21:49:49 +09:00
Gao, Xiang
69b4a17f34
bpo-36126: Fix ref count leakage in structseq_repr. (GH-12035)
2019-02-28 15:18:48 +02:00
Serhiy Storchaka
555755ecff
[2.7] bpo-35552: Fix reading past the end in PyString_FromFormat(). (GH-11276) (GH-11534)
...
Format character "%s" in PyString_FromFormat() no longer read memory
past the limit if precision is specified.
(cherry picked from commit d586ccb04f
)
2019-01-12 11:20:50 +02:00
Serhiy Storchaka
08a81df050
bpo-33817: Fix _PyString_Resize() and _PyUnicode_Resize() for empty strings. (GH-11515)
2019-01-12 09:22:52 +02:00
Zackery Spytz
f347c6eb75
bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175) (GH-11249)
...
(cherry picked from commit 842acaab13
)
2018-12-20 19:38:52 +02:00
Victor Stinner
c275be5441
bpo-35368: Make PyMem_Malloc() thread-safe in debug mode (GH-10828)
...
When Python is compiled in debug mode, PyMem_Malloc() uses debug
hooks, but it also uses pymalloc allocator instead of malloc().
Problem: pymalloc is not thread-safe, whereas PyMem_Malloc() is
thread-safe in release mode (it's a thin wrapper to malloc() in this
case).
Modify the debug hook to use malloc() for PyMem_Malloc().
2018-12-03 12:29:29 +01:00
Gregory P. Smith
b6f4472dc4
[2.7] bpo-35214: Fix OOB memory access in unicode escape parser (GH-10506) (GH-10538)
...
Discovered using clang's MemorySanitizer.
A msan build will fail by simply executing: ./python -c 'u"\N"'
(cherry picked from commit 746b2d3
)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
2018-11-14 11:55:07 -08:00
Serhiy Storchaka
43308dfc33
[2.7] bpo-34974: Do not replace unexpected errors in bytearray(). (GH-9852) (GH-9885)
...
The bytearray constructor converted unexpected exceptions
(e.g. MemoryError and KeyboardInterrupt) to TypeError.
(cherry picked from commit e890421e33
)
2018-10-15 08:46:16 +03:00
Zackery Spytz
0b9fe17341
[2.7] bpo-20047: Remove Objects/bytesobject.c from 2.7 (GH-9268)
...
It was accidentally added in 107f3cc791
.
2018-09-14 02:16:41 +03:00
Benjamin Peterson
ed62e64510
[2.7] Fix misleading mentions of tp_size in comments (GH-9138)
...
Many type object initializations labeled a field "tp_size" in the
comment, but the name of that field is tp_basicsize..
(cherry picked from commit 0e0bc4e221
)
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
2018-09-10 10:50:15 -07:00
Victor Stinner
bf2bd8f8a1
bpo-25750: fix refcounts in type_getattro() (GH-6118) (GH-9091)
...
When calling tp_descr_get(self, obj, type), make sure that
we own a strong reference to "self".
(cherry picked from commit 8f735485ac
)
2018-09-07 10:15:31 +02:00
Miss Islington (bot)
ea21206626
closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)
...
Reported by Svace static analyzer.
(cherry picked from commit f6247aac08
)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2018-08-24 00:51:46 -04:00
Victor Stinner
dd4d8b4d80
Fix compilation warnings on Windows (GH-8627)
...
* Fix compilation warning in _ctypes module on Window
(cherry picked from commit 20f11fe43c
)
* Fix compilation warnings on Windows 64-bit
(cherry picked from commit 725e421222
)
* Fix compiler warning in unicodeobject.c
Explicitly case to Py_UNICODE to fix the warning:
Objects\unicodeobject.c(4225): warning C4244: '=' :
conversion from 'long' to 'Py_UNICODE', possible loss of data
The downcast cannot overflow since we check that value <= 0x10ffff.
2018-08-02 18:02:59 +02:00
Serhiy Storchaka
48c8bf21f9
[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
2018-07-31 09:09:36 +03:00
Xtreak
2bea771609
bpo-34229: Check start and stop of slice object to be long when they are not int in PySlice_GetIndices (GH-8480)
2018-07-26 19:20:34 +03:00
Victor Stinner
d13169fc5a
bpo-16055: Fixes incorrect error text for int('1', base=1000) ( #6980 )
...
Fixes incorrect error text for int('1', base=1000)
and long('1', base=1000).
2018-05-19 01:53:13 +02:00
Miss Islington (bot)
6d3d02c69a
bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)
...
(cherry picked from commit 491bbedc20
)
Co-authored-by: lekma <lekmalek@gmail.com>
2018-05-02 03:23:41 -07:00
Miss Islington (bot)
e3e8bdc5d3
Fix typo and edit for clarity in the docstrings of sys.float_info. (GH-2251)
...
(cherry picked from commit 0301c9bdd1
)
Co-authored-by: Stefano Taschini <taschini@users.noreply.github.com>
2018-03-26 03:58:47 -07:00
xdegaye
baca85fcc7
[2.7] bpo-17288: Prevent jumps from 'return' and 'exception' trace events. (GH-6111)
...
(cherry picked from commit e32bbaf376
)
2018-03-13 23:06:14 +02:00
Miss Islington (bot)
3854f5885e
[2.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. (GH-6026). (GH-6074) (GH-6076)
...
(cherry picked from commit 26c9f565d0
)
(cherry picked from commit 04aadf23ea
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-03-11 10:55:59 +02:00
bennorth
c20c97f612
bpo-18533: Avoid RuntimeError from repr() of recursive dictview ( #4823 ) ( #5357 )
...
(cherry picked from commit d7773d92bd
)
2018-02-27 00:35:03 +02:00
Serhiy Storchaka
b7a2c17be8
[2.7] bpo-32137: The repr of deeply nested dict now raises a RuntimeError (GH-4570) ( #5493 )
...
instead of crashing due to a stack overflow.
This perhaps will fix similar problems in other extension types.
(cherry picked from commit 1fb72d2ad2
)
2018-02-02 16:29:02 +02:00
Benjamin Peterson
eb08a9290f
coalesce GILless sections in new_buffersize ( #5059 )
...
830daae1c8
added some new GIL-releasing to new_buffersize. This is fine, but it's better to avoid reacquiring the GIL for as long as possible. Also, it should use FILE_(BEGIN|END)_ALLOW_THREADS to avoid having the file closed from under it.
2018-01-02 15:52:42 -08:00
Benjamin Peterson
dbf52e02f1
bpo-31530: fix crash when multiple threads iterate over a file, round 2 ( #5060 )
...
Multiple threads iterating over a file can corrupt the file's internal readahead
buffer resulting in crashes. To fix this, cache buffer state thread-locally for
the duration of a file_iternext call and only update the file's internal state
after reading completes.
No attempt is made to define or provide "reasonable" semantics for iterating
over a file on multiple threads. (Non-crashing) races are still
present. Duplicated, corrupt, and missing data will happen.
This was originally fixed by 6401e56717
, which
raised an exception from seek() and next() when concurrent operations were
detected. Alas, this simpler solution breaks legitimate use cases such as
capturing the standard streams when multiple threads are logging.
2018-01-02 09:25:41 -08:00
Nir Soffer
830daae1c8
[2.7] bpo-32186: Release the GIL during fstat and lseek calls ( #4651 )
...
In fileio, there were 3 fstat() calls and one lseek() call that did not
release the GIL during the call. This can cause all threads to hang for
unlimited time when using io.FileIO with inaccessible NFS server.
Same issue seen in fileio exists also in fileobject, fixed in the same
way.
2017-12-07 21:25:39 +01:00
Victor Stinner
ed4743a2f2
bpo-31626: Fix _PyObject_DebugReallocApi() ( #4310 )
...
_PyObject_DebugReallocApi() now calls Py_FatalError() if realloc()
fails to shrink a memory block.
Call Py_FatalError() because _PyObject_DebugReallocApi() erased freed
bytes *before* realloc(), expecting that realloc() *cannot* fail to
shrink a memory block.
2017-11-24 02:13:26 +01:00
Serhiy Storchaka
6401e56717
[2.7] bpo-31530: Stop crashes when iterating over a file on multiple threads. ( #3672 )
2017-11-10 12:58:55 +02:00
Victor Stinner
52ba7b447f
bpo-20064: Document PyObject_Malloc() ( #4204 )
...
Document the following functions:
* PyObject_Malloc()
* PyObject_Realloc()
* PyObject_Free()
Document also the pymalloc allocator.
2017-10-31 10:08:28 -07:00
Serhiy Storchaka
107f3cc791
[2.7] bpo-20047: Make bytearray methods partition() and rpartition() rejecting (GH-4158) ( #4163 )
...
separators that are not bytes-like objects..
(cherry picked from commit a2314283ff
)
2017-10-29 12:25:38 +02:00
Serhiy Storchaka
19eb87d857
[2.7] bpo-31579: Fixed a possible leak in enumerate() with large indices. (GH-3753). ( #3761 )
...
(cherry picked from commit 0e950dd22b
)
2017-09-26 09:11:27 +03:00
Benjamin Peterson
a72d15c97f
consistently use Py_TYPE, Py_REFCNT, and correct initializer macros ( #3563 )
...
This no-op change makes 2.7 more consistent with 3.x to ease comparison and backports.
2017-09-13 21:20:29 -07:00
INADA Naoki
4cde4bdcc8
bpo-31095: Fix potential crash during GC (GH-3197)
...
(cherry picked from commit a6296d34a4
)
2017-09-04 12:31:41 +09:00
Serhiy Storchaka
3dd1ccbb09
bpo-29902: Emit a Py3k deprecation warning when pickling or copying ( #2823 )
...
some builtin and extension objects that don't support pickling
explicitly and are pickled incorrectly by default (like memoryview or
staticmethod).
2017-08-02 11:33:33 +03:00
Jay Bosamiya
c3c9db8927
[2.7] bpo-30657: Check & prevent integer overflow in PyString_DecodeEscape ( #2174 )
2017-06-18 19:41:03 +03:00
Serhiy Storchaka
e6a0b59829
[2.7] bpo-27945: Fixed various segfaults with dict. (GH-1657) ( #1681 )
...
Based on patches by Duane Griffin and Tim Mitchell.
(cherry picked from commit 753bca3934
)
2017-05-20 20:05:27 +03:00
Serhiy Storchaka
e9f9b04278
[2.7] bpo-25794: Fix `type.__setattr__()` for non-interned or unicode attribute names. (GH-1652) ( #1675 )
...
Based on patch by Eryk Sun.
(cherry picked from commit d896985bb2
)
2017-05-20 10:04:53 +03:00
Xiang Zhang
05469fa1c0
bpo-30281: Fix the default value for stop in PySlice_Unpack() ( #1531 ) ( #1480 )
2017-05-10 19:20:28 +08:00
Victor Stinner
f6a3133972
bpo-30255: Clip step in _PySlice_Unpack() ( #1429 )
...
In PySlice_IndicesEx, clip the step to [-PY_SSIZE_T_MAX,
PY_SSIZE_T_MAX] rather than [PY_SSIZE_T_MIN, PY_SSIZE_T_MAX].
(cherry picked from commit e6fc7401a9
)
2017-05-03 16:00:12 +02:00
Serhiy Storchaka
5e79321742
bpo-30074: Fix compile warnings of _PySlice_Unpack and convert missed ( #1154 )
...
PySlice_GetIndicesEx in _ctypes.c.
2017-04-15 20:11:12 +03:00
Serhiy Storchaka
e41390aca5
bpo-27867: Expand the PySlice_GetIndicesEx macro. ( #1023 ) ( #1046 )
...
(cherry picked from commit b879fe8
)
2017-04-08 11:48:57 +03:00
Serhiy Storchaka
079f21f873
bpo-29935: Fixed error messages in the index() method of tuple and list ( #887 ) ( #907 ) ( #910 )
...
when pass indices of wrong type.
(cherry picked from commit d4edfc9abf
)
(cherry picked from commit bf4bb2e430
)
2017-03-30 20:32:18 +03:00
Mark Dickinson
c0b336e0ad
bpo-29602: fix signed zero handling in complex constructor ( #204 )
...
* bpo-29602: fix signed zero handling in complex constructor
* Add missing have_getformat definition; remove use of unittest subtests.
2017-02-20 21:14:52 +00:00
Xiang Zhang
7131a73f96
bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects ( #128 ) ( #187 )
2017-02-20 14:32:53 +08:00
Serhiy Storchaka
8e21cc3ce0
Issue #29028 : Fixed possible use-after-free bugs in the subscription of the
...
buffer object with custom index object.
2017-02-01 22:47:44 +02:00
Serhiy Storchaka
3efe32ed48
Issue #27867 : Replaced function PySlice_GetIndicesEx() with a macro.
2017-01-25 13:22:06 +02:00
Xiang Zhang
7bdb516059
Issue #29145 : Fix overflow checks in string, bytearray and unicode.
...
Patch by jan matejek and Xiang Zhang.
2017-01-09 11:13:20 +08:00