Commit Graph

2238 Commits

Author SHA1 Message Date
Andrew Svetlov 3ba3a3ee56 Issue #15422: get rid of PyCFunction_New macro 2012-12-25 13:32:35 +02:00
Gregory P. Smith 27dc02e8c5 Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.

NOTE: This change is smaller compared to 3.2 as much of this cleanup had
already been done.  I added the comment that my change in 3.2 added so that the
code would match up.  Otherwise this just adds or synchronizes appropriate UL
designations on some constants to be pedantic.

In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.  We could work to get rid of the -fwrapv requirement
in 3.4 but that requires more planning.

Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).

Cleanup only - no functionality or hash values change.
2012-12-10 19:51:29 -08:00
Gregory P. Smith c2176e46d7 Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.

NOTE: This change is smaller compared to 3.2 as much of this cleanup had
already been done.  I added the comment that my change in 3.2 added so that the
code would match up.  Otherwise this just adds or synchronizes appropriate UL
designations on some constants to be pedantic.

In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.

Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).

Cleanup only - no functionality or hash values change.
2012-12-10 18:32:53 -08:00
Gregory P. Smith 27cbcd6241 Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.

In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.

Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).

Cleanup only - no functionality or hash values change.
2012-12-10 18:15:46 -08:00
Gregory P. Smith e348c8d154 Using 'long double' to force this structure to be worst case aligned is no
longer required as of Python 2.5+ when the gc_refs changed from an int (4
bytes) to a Py_ssize_t (8 bytes) as the minimum size is 16 bytes.

The use of a 'long double' triggered a warning by Clang trunk's
Undefined-Behavior Sanitizer as on many platforms a long double requires
16-byte alignment but the Python memory allocator only guarantees 8 byte
alignment.

So our code would allocate and use these structures with technically improper
alignment.  Though it didn't matter since the 'dummy' field is never used.
This silences that warning.

Spelunking into code history, the double was added in 2001 to force better
alignment on some platforms and changed to a long double in 2002 to appease
Tru64.  That issue should no loner be present since the upgrade from int to
Py_ssize_t where the minimum structure size increased to 16 (unless anyone
knows of a platform where ssize_t is 4 bytes?) or 24 bytes depending on if the
build uses 4 or 8 byte pointers.

We can probably get rid of the double and this union hack all together today.
That is a slightly more invasive change that can be left for later.

A more correct non-hacky alternative if any alignment issues are still found
would be to use a compiler specific alignment declaration on the structure and
determine which value to use at configure time.
2012-12-10 18:05:05 -08:00
Antoine Pitrou f9d0b1256f Issue #13390: New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated.
Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
2012-12-09 14:28:26 +01:00
Antoine Pitrou 53f604c794 Issue #16602: When a weakref's target was part of a long deallocation chain, the object could remain reachable through its weakref even though its refcount had dropped to zero.
Thanks to Eugene Toder for diagnosing and reporting the issue.
2012-12-08 21:18:50 +01:00
Antoine Pitrou f93ed3fa67 Issue #16602: When a weakref's target was part of a long deallocation chain, the object could remain reachable through its weakref even though its refcount had dropped to zero.
Thanks to Eugene Toder for diagnosing and reporting the issue.
2012-12-08 21:17:03 +01:00
Antoine Pitrou 62a0d6ea40 Issue #16602: When a weakref's target was part of a long deallocation chain, the object could remain reachable through its weakref even though its refcount had dropped to zero.
Thanks to Eugene Toder for diagnosing and reporting the issue.
2012-12-08 21:15:26 +01:00
Benjamin Peterson 442f20996d create NameConstant AST class for None, True, and False literals (closes #16619) 2012-12-06 17:41:04 -05:00
Andrew Svetlov 746d0434ae Update comment: SAVE_EXC_STATE and SWAP_EXC_STATE macroses are saave_exc_state and swap_exc_state functions now. 2012-12-05 17:59:29 +02:00
Andrew Svetlov c37cfd6709 Update comment: SAVE_EXC_STATE and SWAP_EXC_STATE macroses are saave_exc_state and swap_exc_state functions now. 2012-12-05 17:59:10 +02:00
Victor Stinner d45c7f8d74 Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
2012-12-04 01:34:47 +01:00
Mark Dickinson 6e61d18891 Issue 10052: merge fix from 3.2. 2012-12-02 13:21:37 +00:00
Mark Dickinson ce31f66a6d Issue 10052: fix failed uint32_t / uint64_t / int32_t / int64_t detection on some platforms. 2012-12-02 13:20:22 +00:00
Mark Dickinson 983bc16c15 Issue 10052: fix failed uint32_t / uint64_t / int32_t / int64_t detection on some platforms. 2012-12-02 12:11:38 +00:00
Benjamin Peterson e5b45cc5e5 remove unused flag (closes #16505) 2012-11-18 20:49:39 -06:00
Stefan Krah 36f021621e Backport 9dd4638de73b. 2012-11-19 00:54:05 +01:00
Stefan Krah 2cbbed6541 Issue #6308: Try to fix the termios build failure on HP-UX. 2012-11-19 00:07:18 +01:00
Mark Dickinson ffdb2c21b3 Issue #16451: Refactor to remove duplication between range and slice in slice index computations. 2012-11-17 19:18:10 +00:00
Stefan Krah abaca8cb06 Merge 3.3. 2012-11-12 20:24:09 +01:00
Stefan Krah 6df5cae49a Issue #15835: Define PATH_MAX on HP-UX. 2012-11-12 20:14:36 +01:00
Nick Coghlan e69bfc3fb6 Issue #5765: Merge from 3.3 2012-11-04 23:53:15 +10:00
Nick Coghlan aab9c2b2ea Issue #5765: Apply a hard recursion limit in the compiler
Previously, excessive nesting in expressions would blow the
stack and segfault the interpreter. Now, a hard limit based
on the configured recursion limit and a hardcoded scaling
factor is applied.
2012-11-04 23:14:34 +10:00
Benjamin Peterson d9c8702c0f point errors related to nonlocals and globals to the statement declaring them (closes #10189) 2012-10-31 20:26:20 -04:00
Benjamin Peterson 742b2f8d7a make PyGrammar_LabelRepr return a const char * (closes #16369) 2012-10-31 13:36:13 -04:00
Victor Stinner 4ca1cf35fb Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned
... (unsigned long and unsigned int) to avoid an undefined behaviour with
Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is now
unsigned too (unsigned long, instead of long).
2012-10-30 23:40:45 +01:00
Victor Stinner 76df43de30 Issue #16330: Use surrogate-related macros
Patch written by Serhiy Storchaka.
2012-10-30 01:42:39 +01:00
Georg Brandl 3962d5e892 Minor typo fix. 2012-10-28 08:48:28 +01:00
Benjamin Peterson d0845588b8 make _PyParser_TokenNames const 2012-10-24 08:21:52 -07:00
Christian Heimes 743e0cd6b5 Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
endianess detection and handling.
2012-10-17 23:52:17 +02:00
Armin Ronacher 74b38b190f Issue #16148: Small improvements and cleanup. Added version information
to docs.
2012-10-07 10:29:32 +02:00
Victor Stinner e215d960be Issue #16147: Rewrite PyUnicode_FromFormatV() to use _PyUnicodeWriter API
* Simplify the code: replace 4 steps with one unique step using the
   _PyUnicodeWriter API. PyUnicode_Format() has the same design. It avoids to
   store intermediate results which require to allocate an array of pointers on
   the heap.
 * Use the _PyUnicodeWriter API for speed (and its convinient API):
   overallocate the buffer to reduce the number of "realloc()"
 * Implement "width" and "precision" in Python, don't rely on sprintf(). It
   avoids to need of a temporary buffer allocated on the heap: only use a small
   buffer allocated in the stack.
 * Add _PyUnicodeWriter_WriteCstr() function
 * Split PyUnicode_FromFormatV() into two functions: add
   unicode_fromformat_arg().
 * Inline parse_format_flags(): the format of an argument is now only parsed
   once, it's no more needed to have a subfunction.
 * Optimize PyUnicode_FromFormatV() for characters between two "%" arguments:
   search the next "%" and copy the substring in one chunk, instead of copying
   character per character.
2012-10-06 23:03:36 +02:00
Armin Ronacher aa9a79d279 Issue #16148: implemented PEP 424 2012-10-06 14:03:24 +02:00
Ezio Melotti 080a2c087e #16127: merge with 3.3. 2012-10-05 03:34:02 +03:00
Ezio Melotti e7f90375b1 #16127: remove outdated references to narrow builds. Patch by Serhiy Storchaka. 2012-10-05 03:33:31 +03:00
Jesus Cea b176203dda #16135: Removal of OS/2 support (C code and Docs) 2012-10-05 02:27:40 +02:00
Victor Stinner 90db9c47dc Enable also ptr==ptr optimization in PyUnicode_Compare()
It was already implemented in PyUnicode_RichCompare()
2012-10-04 21:53:50 +02:00
Benjamin Peterson 14fb44e1ba merge mostly from default 2012-09-29 14:14:19 -04:00
Georg Brandl ac76833033 Post-release update. 2012-09-29 14:21:25 +02:00
Georg Brandl 08a9012352 Bump version to 3.4.0 alpha 0. 2012-09-29 09:34:13 +02:00
Georg Brandl 99a247fd01 Merge with main repo default branch. 2012-09-29 09:27:15 +02:00
Georg Brandl c7dcd50e4e Bump version to 3.3.0 final. 2012-09-29 09:04:54 +02:00
Georg Brandl b5f91d7eb7 Merge with 3.3.0 release clone. 2012-09-24 07:46:35 +02:00
Georg Brandl f2487177eb Post-release updates. 2012-09-24 07:42:20 +02:00
Georg Brandl 8506d3591c Bump to 3.3.0rc3. 2012-09-23 17:15:21 +02:00
Christian Heimes fd0ddab97b GCC doesn't support typeof in strict ansi mode (e.g. -ansi or -std=c89) 2012-09-23 16:15:01 +02:00
Christian Heimes ab816b5c85 GCC doesn't support typeof in strict ansi mode (e.g. -ansi or -std=c89) 2012-09-23 16:15:01 +02:00
Antoine Pitrou ca8aa4acf6 Issue #15144: Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
Patch by Serhiy Storchaka.
2012-09-20 20:56:47 +02:00
Georg Brandl 5497295917 Merge in changes from 3.3.0rc2 release clone. 2012-09-09 11:19:17 +02:00
Georg Brandl 05823f7d67 Post-release updates for 3.3.0rc2. 2012-09-09 11:16:41 +02:00
Antoine Pitrou 5b4faae307 Issue #13992: The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.

Note that the trashcan functions are part of the stable ABI, therefore
they have to be kept around for binary compatibility of extensions.
2012-09-06 01:17:42 +02:00
Antoine Pitrou 56cd62c04a Issue #13992: The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.

Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
2012-09-06 00:59:49 +02:00
Georg Brandl 02f66cbe87 Bump to 3.3.0rc2. 2012-09-09 08:56:46 +02:00
Antoine Pitrou 2b0218a259 Issue #13992: The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.

Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
2012-09-06 00:59:49 +02:00
Trent Nelson 81378c8296 Merge whitespace fix from 3.2. 2012-08-31 17:14:31 -04:00
Trent Nelson 2a0fb147ec Remove trailing whitespace in order to silence warnings on HP-UX. 2012-08-31 17:11:39 -04:00
Georg Brandl 3694401ad2 Post-release updates. 2012-08-25 21:33:08 +02:00
Georg Brandl 4ab4ec258c Bump to 3.3.0rc1. 2012-08-25 12:16:37 +02:00
Georg Brandl a026db907f Post-release updates. 2012-08-12 16:58:55 +02:00
Georg Brandl 1b94ab79a9 Bump to 3.3b2. 2012-08-11 08:49:20 +02:00
Brett Cannon 522267e784 Issue #15610: The PyImport_ImportModuleEx macro now calls
PyImport_ImportModuleLevel() with a 'level' of 0 instead of -1 as the
latter is no longer a valid value.

Also added a versionchanged note for PyImport_ImportModuleLevel() just
in case people don't make the connection between changes to
__import__() and this C function.
2012-08-10 18:55:08 -04:00
Benjamin Peterson 1a1367b821 use char instead of int to please T_BOOL (closes #15597) 2012-08-08 17:22:50 -07:00
Jesus Cea 88ca04e6a8 MERGE: Closes #15512: Correct __sizeof__ support for parser 2012-08-03 14:29:26 +02:00
Jesus Cea e9c5318967 Closes #15512: Correct __sizeof__ support for parser 2012-08-03 14:28:37 +02:00
Stefan Krah 7d12d9df13 Issue #12834: Fix PyBuffer_ToContiguous() for non-contiguous arrays. 2012-07-28 12:25:55 +02:00
Georg Brandl d08cec6d62 Bump version to 3.3.0b1. 2012-06-26 09:43:40 +02:00
Martin v. Löwis 75aeaa9b18 Issue #11626: Add _SizeT functions to stable ABI. 2012-06-24 00:00:30 +02:00
Martin v. Löwis 9c56409d33 Issue #15146: Add PyType_FromSpecWithBases. Patch by Robin Schreiber. 2012-06-23 23:20:45 +02:00
David Malcolm 49526f48fc Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues 2012-06-22 14:55:41 -04:00
Martin v. Löwis 7800f75827 Issue #15042: Add PyState_AddModule and PyState_RemoveModule.
Add version  guard for Py_LIMITED_API additions.
Issue #15081: Document PyState_FindModule.
Patch by Robin Schreiber.
2012-06-22 12:20:55 +02:00
Antoine Pitrou e67f48ce5e Issue #14928: Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h. 2012-06-19 22:29:35 +02:00
Nick Coghlan c40bc09942 Issue #13783: the PEP 380 implementation no longer expands the public C API 2012-06-17 15:15:49 +10:00
Antoine Pitrou 27f6a3b0bf Issue #15026: utf-16 encoding is now significantly faster (up to 10x).
Patch by Serhiy Storchaka.
2012-06-15 22:15:23 +02:00
Victor Stinner 2b89fdf7eb PEP 418: Rename adjusted attribute to adjustable in time.get_clock_info() result
Fix also its value on Windows and Linux according to its documentation:
"adjustable" indicates if the clock *can be* adjusted, not if it is or was
adjusted.

In most cases, it is not possible to indicate if a clock is or was adjusted.
2012-06-12 22:46:37 +02:00
Victor Stinner d7b7c7472b Issue #14993: Use standard "unsigned char" instead of a unsigned char bitfield 2012-06-04 22:52:12 +02:00
Barry Warsaw c58c392da7 Trunk merge. 2012-06-04 09:41:48 -04:00
Benjamin Peterson ca75b00069 __GNUC__ does not imply gcc version is present, so just check for version (closes #14994) 2012-06-03 18:15:15 -07:00
Barry Warsaw 409da157d7 Eric Snow's implementation of PEP 421.
Issue 14673: Add sys.implementation
2012-06-03 16:18:47 -04:00
Eli Bendersky 0813168e94 Issue #14090: fix some minor C API problems in default branch (3.3) 2012-06-03 08:07:47 +03:00
Eli Bendersky 2b6b73e7e1 Issue #14007: implement doctype() method calling in XMLParser of _elementtree.
Includes exposing a doctype handler from expat through pyexpat.
2012-06-01 11:32:34 +03:00
Georg Brandl 8e0ed333b9 Post-release update. 2012-05-31 22:41:51 +02:00
Georg Brandl f0397b9953 Bump version to 3.3.0a4. 2012-05-30 22:04:31 +02:00
Victor Stinner d3f0882dfb Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args and str.format(args)
* Formatting string, int, float and complex use the _PyUnicodeWriter API. It
   avoids a temporary buffer in most cases.
 * Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just
   keep a reference to the string if the output is only composed of one string
 * Disable overallocation when formatting the last argument of str%args and
   str.format(args)
 * Overallocation allocates at least 100 characters: add min_length attribute
   to the _PyUnicodeWriter structure
 * Add new private functions: _PyUnicode_FastCopyCharacters(),
   _PyUnicode_FastFill() and _PyUnicode_FromASCII()

The speed up is around 20% in average.
2012-05-29 12:57:52 +02:00
Richard Oudkerk 3e0a1eb889 Issue #14930: Make memoryview objects weakrefable. 2012-05-28 21:35:09 +01:00
Eli Bendersky e1f107e981 s/tabs/spaces, and clean trailing whitespace 2012-05-23 07:09:08 +03:00
Martin v. Löwis cc10a37ef0 Widen ASDL sequences to Py_ssize_t lengths to better match PEP 353. 2012-05-15 14:45:03 +02:00
Benjamin Peterson d5a1c44455 PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133.
2012-05-14 22:09:31 -07:00
Georg Brandl 85a2394467 Post-3.3a3 bump. 2012-05-06 11:20:09 +02:00
Larry Hastings 76ad59b7e8 Issue #14127: Add ns= parameter to utime, futimes, and lutimes.
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Benjamin Peterson 49a69e4d48 strip is_ prefixes on clock_info fields 2012-05-01 09:38:34 -04:00
Georg Brandl ab0ef20663 Bump to 3.3.0a3. 2012-05-01 09:35:18 +02:00
Brett Cannon 62228dbd6c Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.
Thanks to Eric Snow for the patch.
2012-04-29 14:38:11 -04:00
Mark Dickinson e383e82e04 Issue #14521: Make result of float('nan') and float('-nan') more consistent across platforms. Further, don't rely on Py_HUGE_VAL for float('inf'). 2012-04-29 15:31:56 +01:00
Victor Stinner ec89539ccc Issue #14428, #14397: Implement the PEP 418
* Rename time.steady() to time.monotonic()
 * On Windows, time.monotonic() uses GetTickCount/GetTickCount64() instead of
   QueryPerformanceCounter()
 * time.monotonic() uses CLOCK_HIGHRES if available
 * Add time.get_clock_info(), time.perf_counter() and time.process_time()
   functions
2012-04-29 02:41:27 +02:00
Victor Stinner d0880d57b0 Simplify and optimize formatlong()
* Remove _PyBytes_FormatLong(): inline it into formatlong()
 * the input type is always a long, so remove the code for bool
 * don't duplicate the string if the length does not change
 * Use PyUnicode_DATA() instead of _PyUnicode_AsString()
2012-04-27 23:40:13 +02:00
Martin v. Loewis 4f2f3b6217 Account for shared keys in type's __sizeof__ (#13903). 2012-04-24 19:13:57 +02:00
Victor Stinner ece58deb9f Close #14648: Compute correctly maxchar in str.format() for substrin 2012-04-23 23:36:38 +02:00
Benjamin Peterson 7d95e40721 Implement PEP 412: Key-sharing dictionaries (closes #13903)
Patch from Mark Shannon.
2012-04-23 11:24:50 -04:00
Larry Hastings 6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Martin v. Löwis aa2efcb0bc Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02:00
Brian Curtin 09b86d1196 Fix #14600. Correct reference handling and naming of ImportError convenience function 2012-04-17 16:57:09 -05:00
Mark Dickinson b0f00476a0 Issue #13889: Merge fix from 3.2. 2012-04-15 15:12:37 +01:00
Mark Dickinson 18e3d81f96 Issue #13889: On MSVC builds, set FPU control word at runtime for all string <-> float conversions. Patch by Samuel Iseli and Stefan Krah. 2012-04-15 15:10:56 +01:00
Brett Cannon fd0741555b Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Benjamin Peterson 633b32a7fa put PyImportErrorObject with its brothers 2012-04-12 21:50:35 -04:00
Brett Cannon 79ec55e980 Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).

Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
2012-04-12 20:24:54 -04:00
Georg Brandl a51497ab86 Merge 3.2.3 release clone. 2012-04-11 12:46:24 +02:00
Georg Brandl 507776e787 Post-release update. 2012-04-11 12:45:12 +02:00
Georg Brandl 44036016b9 Bump to 3.2.3 final. 2012-04-10 19:28:09 +02:00
Eli Bendersky 0069bab115 Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
and gets rid of some gross formatting on tab=4-space-configured editors.
2012-04-05 06:42:48 +03:00
Antoine Pitrou a701388de1 Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI. 2012-04-05 00:04:20 +02:00
Kristján Valur Jónsson 31668b8f7a Issue #14288: Serialization support for builtin iterators. 2012-04-03 10:49:41 +00:00
Georg Brandl d3fca8e07f Post-release update. 2012-04-02 07:51:45 +02:00
Georg Brandl 50af011ca6 Bump to 3.3.0a2. 2012-04-01 13:49:21 +02:00
Victor Stinner 3c1e48176e Issue #14383: Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
2012-03-26 22:10:51 +02:00
Kristján Valur Jónsson 192195a4fc Merge with 3.2 (Issue #14387) 2012-03-22 23:13:48 +00:00
Kristján Valur Jónsson aa589b3ca7 Issue #14387 : undefine 'small' so that it doesn't clash with Windows headers. 2012-03-22 23:10:37 +00:00
Kristján Valur Jónsson b81e5388b6 Issue #14387 : undefine 'small' so that it doesn't clash with Windows headers. 2012-03-22 23:10:37 +00:00
Antoine Pitrou d0acb411ef Issue #14387: Do not include accu.h from Python.h. 2012-03-22 14:42:18 +01:00
Antoine Pitrou 0197ff97d0 Issue #14387: Do not include accu.h from Python.h. 2012-03-22 14:38:16 +01:00
Benjamin Peterson b7f1da5a3c make _PyNumber_ConvertIntegralToInt static, since it's only used in abstract.c 2012-03-21 14:44:43 -04:00
Stefan Krah 1919b7e72b Issue #7652: Integrate the decimal floating point libmpdec library to speed
up the decimal module. Performance gains of the new C implementation are
between 12x and 80x, depending on the application.
2012-03-21 18:25:23 +01:00
Georg Brandl 3187749646 Merge 3.2.3rc2 from release clone. 2012-03-18 20:37:43 +01:00
Georg Brandl 1eb0f9de99 Post-release updates for 3.2.3rc2. 2012-03-18 08:36:53 +01:00
Georg Brandl 226af70a59 Bump to 3.2.3rc2. 2012-03-18 07:34:49 +01:00
Benjamin Peterson 2afe6aeae8 perform yield from delegation by repeating YIELD_FROM opcode (closes #14230)
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.

Patch mostly from Mark Shannon with a few tweaks by me.
2012-03-15 15:37:39 -05:00
Matthias Klose 5ce31cc4fc merge 3.2 2012-03-14 23:17:31 +01:00
Matthias Klose d83be23689 merge 3.1 2012-03-14 23:14:35 +01:00
Matthias Klose 0f4c16e29c - rename configure.in to configure.ac
- change references from configure.in to configure.ac
2012-03-14 23:10:15 +01:00
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Antoine Pitrou b4a92376f8 Fix regression after c8d1df9ac987
(PPC buildbot)
2012-03-10 23:43:12 +01:00
Larry Hastings 064474134c Fix a comment: PySequence_Fast() creates a list, not a tuple. 2012-03-05 22:59:13 -08:00
Georg Brandl ab8f392ff0 3.3.0a1 is done. 2012-03-05 08:54:46 +01:00
Georg Brandl 6c8850d94d Bump to 3.3.0a1. 2012-03-04 16:23:53 +01:00
Victor Stinner c9590ad745 Close #14085: remove assertions from PyUnicode_WRITE macro
Add checks in PyUnicode_WriteChar() and convert PyUnicode_New() assertion to a
test raising a Python exception.
2012-03-04 01:34:37 +01:00
Victor Stinner 643cd68ea4 Issue #13964: signal.sigtimedwait() timeout is now a float instead of a tuple
Add a private API to convert an int or float to a C timespec structure.
2012-03-02 22:54:03 +01:00
Brett Cannon efb00c0cc1 Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
2012-02-29 18:31:31 -05:00
Benjamin Peterson 9bd126a1c4 the days of pre-standard C compilers are gone 2012-02-26 15:54:47 -05:00
Nick Coghlan ab7bf2143e Close issue #6210: Implement PEP 409 2012-02-26 17:49:52 +10:00
Georg Brandl 48605a65b5 3.2.3rc1 done 2012-02-25 18:30:26 +01:00
Stefan Krah 9a2d99e28a - Issue #10181: New memoryview implementation fixes multiple ownership
and lifetime issues of dynamically allocated Py_buffer members (#9990)
  as well as crashes (#8305, #7433). Many new features have been added
  (See whatsnew/3.3), and the documentation has been updated extensively.
  The ndarray test object from _testbuffer.c implements all aspects of
  PEP-3118, so further development towards the complete implementation
  of the PEP can proceed in a test-driven manner.

  Thanks to Nick Coghlan, Antoine Pitrou and Pauli Virtanen for review
  and many ideas.

- Issue #12834: Fix incorrect results of memoryview.tobytes() for
  non-contiguous arrays.

- Issue #5231: Introduce memoryview.cast() method that allows changing
  format and shape without making a copy of the underlying memory.
2012-02-25 12:24:21 +01:00
Victor Stinner 41a863cb81 Issue #13706: Fix format(int, "n") for locale with non-ASCII thousands separator
* Decode thousands separator and decimal point using PyUnicode_DecodeLocale()
   (from the locale encoding), instead of decoding them implicitly from latin1
 * Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used
 * Change _PyUnicode_InsertThousandsGrouping() API to return the maximum
   character if unicode is NULL
 * Replace MIN/MAX macros by Py_MIN/Py_MAX
 * stringlib/undef.h undefines STRINGLIB_IS_UNICODE
 * stringlib/localeutil.h only supports Unicode
2012-02-24 00:37:51 +01:00
Georg Brandl afe05bd494 Bump version to 3.2.3rc1. 2012-02-23 21:14:12 +01:00
Benjamin Peterson 36a6558891 version now 3.1.5rc1 2012-02-23 10:45:48 -05:00
Antoine Pitrou 528b54b263 Fix test failure in test_cmd_line by initializing the hash secret at the earliest point. 2012-02-21 19:08:26 +01:00
Antoine Pitrou 86838b02f0 Fix test failure in test_cmd_line by initializing the hash secret at the earliest point. 2012-02-21 19:03:47 +01:00
Benjamin Peterson d9a3591ed1 merge 3.2 2012-02-21 11:12:14 -05:00
Benjamin Peterson e249dcab7a merge 3.2 2012-02-21 11:09:13 -05:00
Benjamin Peterson 69e9727657 ensure no one tries to hash things before the random seed is found 2012-02-21 11:08:50 -05:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl 09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl 2daf6ae249 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Benjamin Peterson 8eb1269c34 add generic implementation of a __dict__ descriptor for C types 2012-02-19 19:59:10 -05:00
Victor Stinner 4195b5caea Backout f8409b3d6449: the PEP 410 is not accepted yet 2012-02-08 23:03:19 +01:00
Victor Stinner ccd5715a14 PEP 410 2012-02-08 14:31:50 +01:00
Victor Stinner ed27785b32 Issue #13706: Add assertions to detect bugs earlier 2012-02-01 00:22:23 +01:00
Antoine Pitrou 7ab4af0427 Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
2012-01-29 18:43:36 +01:00
Antoine Pitrou 1334884ff2 Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
2012-01-29 18:36:34 +01:00
Benjamin Peterson ce79852077 use the static identifier api for looking up special methods
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
2012-01-22 11:24:29 -05:00
Meador Inge fa21bf015d Issue #12705: Raise SyntaxError when compiling multiple statements as single interactive statement 2012-01-19 01:08:41 -06:00
Amaury Forgeot d'Arc 5e8260b09c Issue #13727: Add 3 macros to access PyDateTime_Delta members:
PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS,
PyDateTime_DELTA_GET_MICROSECONDS.

Please use them instead of directly accessing PyDateTime_Delta struct members.
2012-01-17 21:31:50 +01:00
Benjamin Peterson c0beabc2a5 move LINENO define to where it actually belongs 2012-01-16 17:29:05 -05:00
Meador Inge da05f454e3 Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes. 2012-01-15 19:31:57 -06:00
Meador Inge 3388060127 Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes. 2012-01-15 19:15:36 -06:00
Gregory P. Smith f5b62a9b31 Consolidate the occurrances of the prime used as the multiplier when hashing. 2012-01-14 15:45:13 -08:00
Gregory P. Smith 63e6c3222f Consolidate the occurrances of the prime used as the multiplier when hashing
to a single #define instead of having several copies in several files.

This excludes the Modules/ tree (datetime and expat both have a copy
for their own purposes with no need for it to be the same).
2012-01-14 15:31:34 -08:00
Benjamin Peterson d5890c8db5 add str.casefold() (closes #13752) 2012-01-14 13:23:30 -05:00
Benjamin Peterson 527c622926 make YieldFrom its own distinct from Yield (closes #13780) 2012-01-14 08:58:23 -05:00
Nick Coghlan 76e1bb0ef9 Fix indenting 2012-01-14 16:08:08 +10:00
Amaury Forgeot d'Arc 77b1ecf0ad Silence compilation warnings on Windows 2012-01-13 22:12:37 +01:00
Nick Coghlan 1f7ce62bd6 Implement PEP 380 - 'yield from' (closes #11682) 2012-01-13 21:43:40 +10:00
Benjamin Peterson b2bf01d824 use full unicode mappings for upper/lower/title case (#12736)
Also broaden the category of characters that count as lowercase/uppercase.
2012-01-11 18:17:06 -05:00
Victor Stinner 3fe553160c Add a new PyUnicode_Fill() function
It is faster than the unicode_fill() function which was implemented in
formatter_unicode.c.
2012-01-04 00:33:50 +01:00
Antoine Pitrou 5b62942074 Issue #13577: Built-in methods and functions now have a __qualname__.
Patch by sbt.
2011-12-23 12:40:16 +01:00
Victor Stinner 80bc72d5a2 fix PyCompactUnicodeObject doc (test) 2011-12-22 03:23:10 +01:00
Victor Stinner 52e2cc8604 backout 7876cd49300d: Move PyUnicode_WCHAR_KIND outside PyUnicode_Kind enum 2011-12-19 22:14:45 +01:00
Victor Stinner 0ba5af20c0 Move PyUnicode_WCHAR_KIND outside PyUnicode_Kind enum 2011-12-17 22:18:27 +01:00
Victor Stinner 1b57967b96 Issue #13560: Locale codec functions use the classic "errors" parameter,
instead of surrogateescape

So it would be possible to support more error handlers later.
2011-12-17 05:47:23 +01:00
Victor Stinner f2ea71fcc8 Issue #13560: Add PyUnicode_EncodeLocale()
* Use PyUnicode_EncodeLocale() in time.strftime() if wcsftime() is not
   available
 * Document my last changes in Misc/NEWS
2011-12-17 04:13:41 +01:00
Victor Stinner af02e1c85a Add PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale()
* PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale() decode a string
   from the current locale encoding
 * _Py_char2wchar() writes an "error code" in the size argument to indicate
   if the function failed because of memory allocation failure or because of a
   decoding error. The function doesn't write the error message directly to
   stderr.
 * Fix time.strftime() (if wcsftime() is missing): decode strftime() result
   from the current locale encoding, not from the filesystem encoding.
2011-12-16 23:56:01 +01:00
Antoine Pitrou 093ce9cd8c Issue #6695: Full garbage collection runs now clear the freelist of set objects.
Initial patch by Matthias Troffaes.
2011-12-16 11:24:27 +01:00
Benjamin Peterson bfebb7b54a improve abstract property support (closes #11610)
Thanks to Darren Dale for patch.
2011-12-15 15:34:02 -05:00
Antoine Pitrou 9d57481f04 Issue #13577: various kinds of descriptors now have a __qualname__ attribute.
Patch by sbt.
2011-12-12 13:47:25 +01:00
Victor Stinner 16e6a80923 PyUnicode_Resize(): warn about canonical representation
Call also directly unicode_resize() in unicodeobject.c
2011-12-12 13:24:15 +01:00
Victor Stinner b0a82a6a7f Fix PyUnicode_Resize() for compact string: leave the string unchanged on error
Fix also PyUnicode_Resize() doc
2011-12-12 13:08:33 +01:00
Victor Stinner bf6e560d0c Make PyUnicode_Copy() private => _PyUnicode_Copy()
Undocument the function.

Make also decode_utf8_errors() as private (static).
2011-12-12 01:53:47 +01:00
Victor Stinner 7a9105a380 resize_copy() now supports legacy ready strings 2011-12-12 00:13:42 +01:00
Victor Stinner 24c74be9a3 PyUnicode_IS_ASCII() macro ensures that the string is ready
It has no sense to check if a not ready string is ASCII or not.
2011-12-12 01:24:20 +01:00
Barry Warsaw 04f6974d84 - Issue #11147: Fix an unused argument in _Py_ANNOTATE_MEMORY_ORDER. (Fix
given by Campbell Barton).
2011-12-05 16:50:41 -05:00
Barry Warsaw 9f57135465 - Issue #11147: Fix an unused argument in _Py_ANNOTATE_MEMORY_ORDER. (Fix
given by Campbell Barton).
2011-12-05 16:45:02 -05:00
Victor Stinner 551ac95733 Py_UNICODE_HIGH_SURROGATE() and Py_UNICODE_LOW_SURROGATE() macros
And use surrogates macros everywhere in unicodeobject.c
2011-11-29 22:58:13 +01:00
Jesus Cea 66f412e4dc MERGE: Closes issue #13488: Some old preprocessors have problem with #define not in the first column 2011-11-27 05:17:14 +01:00
Jesus Cea 6d47db31f0 Closes issue #13488: Some old preprocessors have problem with #define not in the first column 2011-11-27 05:16:22 +01:00
Victor Stinner 0fdfceb782 Issue #12567: The curses module uses Unicode functions for Unicode arguments
when it is linked to the ncurses library. It encodes also Unicode strings to
the locale encoding instead of UTF-8.
2011-11-25 22:10:02 +01:00
Antoine Pitrou 86a36b500a PEP 3155 / issue #13448: Qualified name for classes and functions. 2011-11-25 18:56:07 +01:00
Antoine Pitrou 6dd381eb62 Issue #12328: Under Windows, refactor handling of Ctrl-C events and
make _multiprocessing.win32.WaitForMultipleObjects interruptible when
the wait_flag parameter is false.  Patch by sbt.
2011-11-21 21:26:56 +01:00
Antoine Pitrou ce4a9da705 Issue #13411: memoryview objects are now hashable when the underlying object is hashable. 2011-11-21 20:46:33 +01:00
Victor Stinner f3ae6208c7 PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed
using an assertion
2011-11-21 02:24:49 +01:00
Victor Stinner 77faf69ca1 _PyUnicode_CheckConsistency() also checks maxchar maximum value,
not only its minimum value
2011-11-20 18:56:05 +01:00