Commit Graph

4985 Commits

Author SHA1 Message Date
Victor Stinner 5a1bb4e080 Initialize base types before child types
object (PyBaseObject_Type) is the base type of type (PyType_Type), int
(PyLong_Type) is the base type of bool (PyBool_Type).
2014-06-02 14:10:59 +02:00
Raymond Hettinger 426d9958a2 Add development comments to setobject.c 2014-05-18 21:40:20 +01:00
Stefan Krah bcaf5999e6 Issue #20186: memoryobject.c: add function signatures. 2014-05-18 00:35:09 +02:00
Victor Stinner 45e8e2f218 Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
2014-05-14 17:24:35 +02:00
Victor Stinner 470cf8dfbe (Merge 3.4) Issue #21418: Fix a crash in the builtin function super() when
called without argument and without current frame (ex: embedded Python).
2014-05-13 01:32:54 +02:00
Victor Stinner 1c6970fac9 Issue #21418: Fix a crash in the builtin function super() when called without
argument and without current frame (ex: embedded Python).
2014-05-13 01:32:36 +02:00
Zachary Ware bca9694ac1 Issue #21442: Fix MSVC compiler warning introduced by issue21377. 2014-05-06 11:42:37 -05:00
Victor Stinner 3080d926af Issue #21233: Fix _PyObject_Alloc() when compiled with WITH_VALGRIND defined 2014-05-06 11:32:29 +02:00
Raymond Hettinger 4b74fba62f Issue 21101: Internal API for dict getitem and setitem where the hash value is known. 2014-05-03 16:32:11 -07:00
Victor Stinner af8fc645af Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to
redirect.
2014-05-02 23:26:03 +02:00
Victor Stinner db067af12a Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now
using ``calloc()`` instead of ``malloc()`` for large objects which is faster
and use less memory (until the bytearray buffer is filled with data).
2014-05-02 22:31:14 +02:00
Antoine Pitrou 161d695fb0 Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the first argument has a reference count of 1.
Patch by Nikolaus Rath.
2014-05-01 14:36:20 +02:00
Benjamin Peterson 027ce16691 sprinkle some _PyId goodness around moduleobject.c 2014-04-24 19:39:18 -04:00
Benjamin Peterson 1184e266b9 do not override errors from descriptors on modules 2014-04-24 19:29:23 -04:00
Ethan Furman 7b9ff0e6da Issue8297: module attribute lookup failures now include module name in error message. 2014-04-24 14:47:47 -07:00
Zachary Ware 715ef02ddc Fix a typo in the docstring of nb_index. 2014-04-18 09:23:14 -05:00
Zachary Ware ea42b4cc80 Fix a typo in the signature for object.__ge__ 2014-04-18 09:14:31 -05:00
Zachary Ware 9996a7d21b Merge typo fix from 3.4 2014-04-18 09:23:35 -05:00
Zachary Ware 07b4c5e1f6 Merge typo fix from 3.4 2014-04-18 09:17:04 -05:00
Mark Dickinson 0c346d827d Issue #21193: Make (e.g.,) pow(2, -3, 5) raise ValueError rather than TypeError. Patch by Josh Rosenberg. 2014-04-11 14:34:40 -04:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
Victor Stinner 4dd25256e2 Issue #21118: PyLong_AS_LONG() result type is long
Even if PyLong_AS_LONG() cannot fail, I prefer to use the right type.
2014-04-08 09:14:21 +02:00
Benjamin Peterson 1365de764e fix reference leaks in the translate fast path (closes #21175)
Patch by Josh Rosenberg.
2014-04-07 20:15:41 -04:00
Victor Stinner 872b291b96 Issue #21118: Optimize also str.translate() for ASCII => ASCII deletion 2014-04-05 14:27:07 +02:00
Victor Stinner 4ff33af257 Issue #21118: Add unit test for invalid character replacement (code point higher than U+10ffff) 2014-04-05 11:56:37 +02:00
Victor Stinner 89a76abf20 Issue #21118: Optimize str.translate() for ASCII => ASCII translation 2014-04-05 11:44:04 +02:00
Victor Stinner 8a4422e78d Issue #21118: Remove unused variable 2014-04-05 00:15:52 +02:00
Victor Stinner 69598d4ccf Issue #21118: Fix _PyUnicodeTranslateError_Create(), add missing format
character for the "end" parameter
2014-04-04 20:59:44 +02:00
Victor Stinner 1194ea020c Issue #21118: Use _PyUnicodeWriter API in str.translate() to simplify and
factorize the code
2014-04-04 19:37:40 +02:00
Victor Stinner d129eeb303 Issue #21118: Fix _PyUnicodeTranslateError_Create(), add missing format
character for the "end" parameter
2014-04-04 20:59:44 +02:00
Benjamin Peterson d818fc9205 merge 3.4 (#21134) 2014-04-02 12:16:55 -04:00
Benjamin Peterson 9b09ba1234 bail in unicode error's __str__ methods if the objects are not properly initialized (closes #21134) 2014-04-02 12:15:06 -04:00
Antoine Pitrou 3fec24ef13 Issue #21073: explain why Py_ReprEnter() allows for a missing thread state. 2014-03-31 22:05:02 +02:00
Antoine Pitrou 04d17d30b4 Issue #21073: explain why Py_ReprEnter() allows for a missing thread state. 2014-03-31 22:04:38 +02:00
Benjamin Peterson 00ced0f4c7 merge 3.4 2014-03-30 19:52:50 -04:00
Benjamin Peterson d455ce4fd4 merge 3.3 2014-03-30 19:52:39 -04:00
Benjamin Peterson 0ad6098b67 merge 3.2 2014-03-30 19:52:22 -04:00
Benjamin Peterson 23cf403ca1 fix expandtabs overflow detection to be consistent and not rely on signed overflow 2014-03-30 19:47:57 -04:00
Ethan Furman 9ab748013b Issue19995: more informative error message; spelling corrections; use operator.mod instead of __mod__ 2014-03-21 06:38:46 -07:00
Ethan Furman 38d872ee5d Issue19995: passing a non-int to %o, %c, %x, or %X now raises an exception 2014-03-19 08:38:52 -07:00
Victor Stinner 7d00cc1a64 Issue #20574: Implement incremental decoder for cp65001 code
(Windows code page 65001, Microsoft UTF-8).
2014-03-17 23:08:06 +01:00
Benjamin Peterson df813791db correct the fix for #20637; allow slot descriptor inheritance to take place before creating cached keys 2014-03-17 15:57:17 -05:00
Benjamin Peterson af9049ebbc merge 3.3 2014-03-15 12:21:47 -05:00
Benjamin Peterson 4a42cd48d5 avoid referencing past the bounds of an array 2014-03-15 12:21:28 -05:00
Benjamin Peterson 1aca78da62 merge 3.3 2014-03-14 21:54:41 -05:00
Benjamin Peterson ef87f8cb57 avoid referencing out-of-bounds memory 2014-03-14 21:54:31 -05:00
Benjamin Peterson 45c9dceb56 fix c89 declaration order 2014-03-14 21:53:51 -05:00
Benjamin Peterson dfa822811a merge 3.3 2014-03-14 21:47:36 -05:00
Benjamin Peterson 041c38a790 don't do pointer arithmetic with signed numbers 2014-03-14 21:47:23 -05:00
Kristján Valur Jónsson 25dded041f Make the various iterators' "setstate" sliently and consistently clip the
index.  This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 13:47:57 +00:00
Kristján Valur Jónsson 4ca688edeb Fix pickling of rangeiter. rangeiter_setstate would not allow setting it
to the exhausted state.
2014-03-04 23:19:24 +00:00
Kristján Valur Jónsson c5cc5011ac Make the various iterators' "setstate" sliently and consistently clip the
index.  This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 15:23:07 +00:00
Kristján Valur Jónsson 25ea45db81 Merge with 3.3 2014-03-04 23:22:15 +00:00
Yury Selivanov 056e265491 Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__ 2014-03-02 12:25:27 -05:00
Serhiy Storchaka 94ee389308 Issue #19619: Blacklist non-text codecs in method API
str.encode, bytes.decode and bytearray.decode now use an
internal API to throw LookupError for known non-text encodings,
rather than attempting the encoding or decoding operation and
then throwing a TypeError for an unexpected output type.

The latter mechanism remains in place for third party non-text
encodings.

Backported changeset d68df99d7a57.
2014-02-24 14:43:03 +02:00
Antoine Pitrou f0b5a7c0f6 Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson. 2014-02-23 16:50:07 +01:00
Benjamin Peterson e686c5c3e8 look up __getnewargs__ and __getnewargs_ex__ on the object type (#16251) 2014-02-16 13:49:16 -05:00
Benjamin Peterson 4267869ad8 merge 3.3 (#20507) 2014-02-15 13:03:20 -05:00
Benjamin Peterson 9743b2c2b5 give non-iterable TypeError a message (closes #20507) 2014-02-15 13:02:52 -05:00
Serhiy Storchaka 226c57100c Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.
This silences a Coverity complain.
2014-02-12 09:55:45 +02:00
Serhiy Storchaka 1f9d11b986 Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.
This silences a Coverity complain.
2014-02-12 09:55:01 +02:00
Serhiy Storchaka 87a5c515d0 Issue #19255: The builtins module is restored to initial value before
cleaning other modules.  The sys and builtins modules are cleaned last.
2014-02-10 18:21:34 +02:00
Larry Hastings 8f9f0f12e8 Issue #20517: Removed unnecessary new (short-lived) functions from PyErr. 2014-02-10 03:43:57 -08:00
Larry Hastings 69a2547cd5 Issue #20530: The signatures for slot builtins have been updated
to reflect the fact that they only accept positional-only arguments.
2014-02-09 22:22:38 -08:00
Larry Hastings b082731fbb Issue #20517: Functions in the os module that accept two filenames
now register both filenames in the exception on failure.
This required adding new C API functions allowing OSError exceptions
to reference two filenames instead of one.
2014-02-09 22:05:19 -08: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
Larry Hastings 2623c8c23c Issue #20530: Argument Clinic's signature format has been revised again.
The new syntax is highly human readable while still preventing false
positives.  The syntax also extends Python syntax to denote "self" and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.
2014-02-08 22:15:29 -08:00
Nick Coghlan d979e4335d Close #20500: Don't trigger PyObject_Str assertion at shutdown 2014-02-09 10:43:21 +10:00
Serhiy Storchaka 6cbf151032 Issue #20538: UTF-7 incremental decoder produced inconsistant string when
input was truncated in BASE64 section.
2014-02-08 14:06:33 +02:00
Serhiy Storchaka 016a3f33a5 Issue #20538: UTF-7 incremental decoder produced inconsistant string when
input was truncated in BASE64 section.
2014-02-08 14:01:29 +02:00
Victor Stinner 1ea4e4174b Issue #17162: Fix compilation, replace non-breaking space with an ASCII space 2014-02-04 09:49:14 +01:00
Martin v. Löwis ca7b04644c Issue #17162: Add PyType_GetSlot. 2014-02-04 09:33:05 +01:00
Larry Hastings 581ee3618c Issue #20326: Argument Clinic now uses a simple, unique signature to
annotate text signatures in docstrings, resulting in fewer false
positives.  "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.

Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00
Nick Coghlan 77b286b2cc Close #20105: set __traceback__ when chaining exceptions in C 2014-01-27 00:53:38 +10:00
Larry Hastings c20472640c Issue #20390: Small fixes and improvements for Argument Clinic. 2014-01-25 20:43:29 -08:00
Larry Hastings 5c66189e88 Issue #20189: Four additional builtin types (PyTypeObject,
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08: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
Meador Inge e02de8c2ad Fix minor bug in dict.__contains__ docstring.
When dict got clinicized in 8fde1a2c94dc for Issue #16612 an erroneous
trailing quote was left in the clinic docstring summary line.
2014-01-14 16:48:31 -06:00
Eric V. Smith 6ba5665fc7 Fix typo in comment. 2014-01-14 08:15:03 -05:00
Ethan Furman a70805e1fa Issue19995: fixed typo; switched from test.support.check_warnings to assertWarns 2014-01-12 08:42:35 -08:00
Ethan Furman f9bba9c67f Issue19995: issue deprecation warning for non-integer values to %c, %o, %x, %X 2014-01-11 23:20:58 -08:00
Larry Hastings 61272b77b0 Issue #19273: The marker comments Argument Clinic uses have been changed
to improve readability.
2014-01-07 12:41:53 -08:00
Raymond Hettinger 74fc8c47f6 Add comments to frozenset_hash().
Also, provide a minor hint to the compiler on how to group the xors.
2014-01-05 12:00:31 -08:00
Ethan Furman df3ed242c0 Issue19995: %o, %x, %X now only accept ints 2014-01-05 06:50:30 -08:00
Serhiy Storchaka 3079328d29 Reverted changeset b72c5573c5e7 (issue #15027). 2014-01-04 22:44:01 +02:00
Serhiy Storchaka 583a93943c Issue #15027: Rewrite the UTF-32 encoder. It is now 1.6x to 3.5x faster. 2014-01-04 19:25:37 +02:00
Victor Stinner fa4e68d425 Remove deadcode (HASH macro is no more defined) 2014-01-03 17:42:18 +01:00
Victor Stinner 92a419eea4 Remove now unused variables 2014-01-03 17:39:40 +01:00
Victor Stinner f3b46b4a66 unicode_char() uses get_latin1_char() to get latin1 singleton characters 2014-01-03 13:16:00 +01:00
Victor Stinner 985a82a6d2 add unicode_char() in unicodeobject.c to factorize code 2014-01-03 12:53:47 +01:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Victor Stinner 4ac9c00cff Better assertion in PyObject_Call() to detect functions returning a result with
an exception set (invalid state).
2013-12-19 13:47:35 +01:00
Raymond Hettinger e259f13874 Minor code clean-up. Keep the C-API all in one section. 2013-12-15 11:56:14 -08:00
Serhiy Storchaka c836a28cc1 Issue #17576: Removed deprecation warnings added in changeset 618cca51a27e. 2013-12-14 21:07:09 +02:00
Victor Stinner 507ac3a591 (Merge 3.3) Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if
"%c" argument is not in range [0; 255].
2013-12-13 12:15:31 +01:00
Victor Stinner c9362cf86a Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
2013-12-13 12:14:44 +01:00
Victor Stinner 1310510793 Issue #14432: Generator now clears the borrowed reference to the thread state
Fix a crash when a generator is created in a C thread that is destroyed while
the generator is still used. The issue was that a generator contains a frame,
and the frame kept a reference to the Python state of the destroyed C thread.
The crash occurs when a trace function is setup.
2013-12-13 02:17:29 +01:00
Victor Stinner fdeb6ec45a Issue #14432: Remove the thread state field from the frame structure. Fix a
crash when a generator is created in a C thread that is destroyed while the
generator is still used. The issue was that a generator contains a frame, and
the frame kept a reference to the Python state of the destroyed C thread. The
crash occurs when a trace function is setup.
2013-12-13 02:01:38 +01:00