Commit Graph

3273 Commits

Author SHA1 Message Date
Mark Dickinson c8a7c7c3b9 Issue #6846: bytearray.pop was returning ints in the range [-128, 128)
instead of [0, 256).  Thanks Hagen Fürstenau for the report and fix.
2009-09-06 10:03:31 +00:00
Benjamin Peterson 6fcf9b50bc remove the check that classmethod's argument is a callable 2009-09-01 22:27:57 +00:00
Mark Dickinson 2fdd58ad18 Silence gcc 'comparison always false' warning 2009-08-28 20:46:24 +00:00
Benjamin Peterson 4c6e8088f5 #6707 fix a crash with dir() on an uninitialized module 2009-08-15 13:16:38 +00:00
Eric Smith 5c4a5d2911 Issue 6330: Fix --enable-unicode=ucs4. 2009-07-30 13:39:44 +00:00
Raymond Hettinger c2b9e1a134 Issue 6573: Fix set.union() for cases where self is in the argument chain. 2009-07-27 20:32:04 +00:00
Eric Smith e94a826304 Sync trunk and py3k versions of string formatting. Will manually merge into py3k. 2009-07-27 01:58:25 +00:00
Benjamin Peterson 9119fbc683 clarify 2009-07-25 02:03:48 +00:00
Georg Brandl ec812caf5d Issue #6540: Fixed crash for bytearray.translate() with invalid parameters. 2009-07-22 11:57:15 +00:00
Benjamin Peterson 24d9175ebe must use _PyThreadState_Current so it isn't checked for NULL #6530 2009-07-21 14:08:40 +00:00
Alexandre Vassalotti fd00916c2e Grow the allocated buffer in PyUnicode_EncodeUTF7 to avoid buffer overrun.
Without this change, test_unicode.UnicodeTest.test_codecs_utf7 crashes in
debug mode. What happens is the unicode string u'\U000abcde' with a length
of 1 encodes to the string '+2m/c3g-' of length 8. Since only 5 bytes is
reserved in the buffer, a buffer overrun occurs.
2009-07-07 02:17:30 +00:00
Benjamin Peterson 1bf4765369 only order comparisons are removed in py3k #6119 2009-07-02 17:06:17 +00:00
Hirokazu Yamamoto 5c3dd9a1ee Issue #6368: Fixed unused variable warning on Unix. 2009-06-29 15:52:21 +00:00
Hirokazu Yamamoto a3c5609079 Issue #4856: Remove checks for win NT. 2009-06-28 10:23:00 +00:00
Amaury Forgeot d'Arc 595f7a5bf9 #2016 Fix a crash in function call when the **kwargs dictionary is mutated
during the function call setup.

This even gives a slight speedup, probably because tuple allocation
is faster than PyMem_NEW.
2009-06-25 22:29:29 +00:00
Raymond Hettinger 62641e9534 Issue 6329: Fix iteration for memoryviews. 2009-06-23 20:59:43 +00:00
Benjamin Peterson bf9ec9ba67 add underscores 2009-06-16 23:13:09 +00:00
Georg Brandl af01c03e14 Remove unused macro. 2009-06-16 17:43:44 +00:00
Alexandre Vassalotti 55bd1efb2a Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. 2009-06-12 18:56:57 +00:00
Georg Brandl 18187e2167 #6224: s/JPython/Jython/, and remove one link to a module nine years old. 2009-06-06 18:21:58 +00:00
Benjamin Peterson 064a381a14 use the offical api 2009-06-04 01:40:29 +00:00
Antoine Pitrou 25de0dd89b Fix compilation error with gcc 4.3.2 2009-06-01 23:23:16 +00:00
Amaury Forgeot d'Arc b02ceda3a5 #4547: When debugging a very large function, it was not always
possible to update the lineno attribute of the current frame.
2009-06-01 20:53:18 +00:00
Antoine Pitrou d11f7fcc0f Uninitialized file type would lead to __exit__ lookup failure when site.py
tries to read *.pth files on interpreter startup.
2009-05-31 18:05:51 +00:00
Raymond Hettinger 578a228ee2 Issue 5982: Classmethod and staticmethod expose wrapped function with __func__. 2009-05-29 04:58:52 +00:00
Benjamin Peterson 1afec5d6bf plug ref leak 2009-05-27 03:08:44 +00:00
Benjamin Peterson 39d43b4660 correctly handle descrs with __missing__ 2009-05-27 02:43:46 +00:00
Benjamin Peterson 87e5006d8c handle errors from _PyObject_LookupSpecial when __get__ fails 2009-05-25 02:40:21 +00:00
Jeffrey Yasskin 655d835415 Issue #6042:
lnotab-based tracing is very complicated and isn't documented very well.  There
were at least 3 comment blocks purporting to document co_lnotab, and none did a
very good job. This patch unifies them into Objects/lnotab_notes.txt which
tries to completely capture the current state of affairs.

I also discovered that we've attached 2 layers of patches to the basic tracing
scheme. The first layer avoids jumping to instructions that don't start a line,
to avoid problems in if statements and while loops.  The second layer
discovered that jumps backward do need to trace at instructions that don't
start a line, so it added extra lnotab entries for 'while' and 'for' loops, and
added a special case for backward jumps within the same line. I replaced these
patches by just treating forward and backward jumps differently.
2009-05-23 23:23:01 +00:00
Eric Smith 4b94b192ff Issue 6089: str.format raises SystemError. 2009-05-23 13:56:13 +00:00
Mark Dickinson a4e0efa4b1 Issue #5829: don't raise OverflowError for complex('1e500'). Backport of r72803. 2009-05-20 18:43:07 +00:00
Jeffrey Yasskin c8d30fec16 Fix issue #1689458 by teaching frame_setlineno how to jump to the first line of
a code object.
2009-05-20 17:57:57 +00:00
Jeffrey Yasskin 61328eef1f While I was modifying test_trace, it threw an exception when I accidentally
made it try to set the line number from the trace callback for a 'call' event.
This patch makes the error message a little more helpful in that case, and
makes it a little less likely that a future editor will make the same mistake
in test_trace.
2009-05-18 21:14:54 +00:00
Mark Dickinson 50626db437 Issue #6044: remove confusing wording from complex -> integer and
complex -> float conversion error messages.
2009-05-17 10:38:30 +00:00
Hirokazu Yamamoto b24bb27d22 Issue #3527: Removed Py_WIN_WIDE_FILENAMES which is not used any more. 2009-05-17 02:52:09 +00:00
Benjamin Peterson a27dbc68f0 completely ignore old-style stuff for type checking overloading 2009-05-16 22:40:56 +00:00
Benjamin Peterson 94eaba78b7 deal with old-style classes in issubclass and isinstance 2009-05-16 22:30:48 +00:00
Benjamin Peterson fb6fb062e8 properly lookup __instancecheck__ and __subclasscheck__ 2009-05-16 21:44:25 +00:00
Mark Dickinson b1d45856c2 Issue #5981: Fix some float.fromhex bugs related to inf and nan handling. 2009-05-11 15:33:08 +00:00
Benjamin Peterson ceea163e7c clear error state properly 2009-05-09 19:18:36 +00:00
Benjamin Peterson a7dc949e17 ignore AttributeErrors for classic classes 2009-05-09 19:03:05 +00:00
Benjamin Peterson 784d455066 *sigh* deal with instances correctly 2009-05-09 17:23:03 +00:00
Benjamin Peterson 0a32f9c448 can't handle classic classes here 2009-05-09 17:13:10 +00:00
Benjamin Peterson 3f3d36bd03 ignore classic classes 2009-05-09 16:51:51 +00:00
Benjamin Peterson af1692a266 convert some more special methods to use _PyObject_LookupSpecial 2009-05-09 16:36:39 +00:00
Benjamin Peterson 809e22543f lookup __reversed__ correctly as a special method 2009-05-09 02:07:04 +00:00
Jeffrey Yasskin f7f858d141 Issue 5954, PyFrame_GetLineNumber:
Most uses of PyCode_Addr2Line
(http://www.google.com/codesearch?q=PyCode_Addr2Line) are just trying to get
the line number of a specified frame, but there's no way to do that directly.
Forcing people to go through the code object makes them know more about the
guts of the interpreter than they should need.

The remaining uses of PyCode_Addr2Line seem to be getting the line from a
traceback (for example,
http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line),
which is replaced by the tb_lineno field.  So we may be able to deprecate
PyCode_Addr2Line entirely for external use.
2009-05-08 22:23:21 +00:00
Jeffrey Yasskin 1aa4700234 PyCode_NewEmpty:
Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New
are trying to build an empty code object, usually to put it in a dummy frame
object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify
just the filename, function name, and first line number, instead of also
requiring lots of code internals.
2009-05-08 21:51:06 +00:00
Benjamin Peterson 3a9930db47 this is now a bound method 2009-05-08 03:29:26 +00:00
Benjamin Peterson 399e4c4f8f add _PyObject_LookupSpecial to handle fetching special method lookup 2009-05-08 03:06:00 +00:00
Eric Smith a985a3aee4 Issue #5920: Changed format.__float__ and complex.__float__ to use a precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson. 2009-05-05 18:26:08 +00:00
Georg Brandl cecdc9c0e0 Remove unused variable. 2009-05-05 09:20:52 +00:00
Georg Brandl ba68a99656 #5929: fix signedness warning. 2009-05-05 09:19:43 +00:00
R. David Murray 7ba8e1cbfd Fix issue 5890: (property subclass shadows __doc__ string) by inserting
the __doc__ into the subclass instance __dict__.  The fix refactors
property_copy to call property_init in such a way that the __doc__
logic is re-executed correctly when getter_doc is 1, thus simplifying
property_copy.
2009-05-04 22:16:24 +00:00
Antoine Pitrou 653dece278 Issue #4426: The UTF-7 decoder was too strict and didn't accept some legal sequences.
Patch by Nick Barnes and Victor Stinner.
2009-05-04 18:32:32 +00:00
Walter Dörwald 342c8db859 There's no %A in Python 2.x! 2009-05-03 22:46:07 +00:00
Walter Dörwald ed960ac404 Issue #5108: Handle %s like %S and %R in PyUnicode_FromFormatV(): Call
PyUnicode_DecodeUTF8() once, remember the result and output it in a second
step. This avoids problems with counting UTF-8 bytes that ignores the effect
of using the replace error handler in PyUnicode_DecodeUTF8().
2009-05-03 22:36:33 +00:00
Mark Dickinson 777e4ff503 Eliminate some locale-dependent calls to isspace and tolower. 2009-05-03 20:59:48 +00:00
Mark Dickinson 85e269b37d Remove unnecessary uses of context in PyGetSetDef. See issue #5880. 2009-05-03 20:39:06 +00:00
Mark Dickinson d4b5c98fa6 Remove unnecessary use of context for long getters.
(Related to issue #5880).
2009-05-02 17:55:01 +00:00
Eric Smith 27f204dc29 Keep py3k and trunk code in sync. 2009-05-02 09:58:09 +00:00
Georg Brandl ca87fa5a5b #5889: remove comma at the end of a list that some C compilers don't like. 2009-05-01 08:51:37 +00:00
Eric Smith 9139cc6a3b Issue #1588: Add complex.__format__. 2009-04-30 00:58:58 +00:00
Mark Dickinson df108ca324 Remove format_float and use _PyOS_double_to_string instead. 2009-04-29 21:56:53 +00:00
Eric Smith cac7af6863 Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors. 2009-04-27 19:04:37 +00:00
Mark Dickinson 6d6b220215 Backport r71967 changes from py3k to trunk.
(Internal plumbing changes for float parsing.)
2009-04-26 16:04:05 +00:00
Mark Dickinson 944c6aedd0 Reset errno before both calls to PyOS_ascii_strtod, not just one. 2009-04-26 14:00:08 +00:00
Martin v. Löwis 99f277933e Issue #4971: Fix titlecase for characters that are their own
titlecase, but not their own uppercase.
2009-04-26 00:53:18 +00:00
Eric Smith 068f06568b Issue #5835, deprecate PyOS_ascii_formatd.
If anyone wants to clean up the documentation, feel free. It's my first documentation foray, and it's not that great.

Will port to py3k with a different strategy.
2009-04-25 21:40:15 +00:00
Walter Dörwald 5d98ec76bb Issue #5828 (Invalid behavior of unicode.lower): Fixed bogus logic in
makeunicodedata.py and regenerated the Unicode database (This fixes
u'\u1d79'.lower() == '\x00').
2009-04-25 14:03:16 +00:00
Mark Dickinson 0a6501bf56 Fix typo in complex parsing code; expand tests. 2009-04-25 09:47:00 +00:00
Benjamin Peterson 5083dc552b fix a segfault when setting __class__ in __del__ #5283 2009-04-25 00:41:22 +00:00
Mark Dickinson 90d47cb46c Fix missing 'return NULL' 2009-04-24 13:14:07 +00:00
Mark Dickinson 95bc980d9e Issue #5816:
- simplify parsing and printing of complex numbers
 - make complex(repr(z)) round-tripping work for complex
   numbers involving nans, infs, or negative zeros
 - don't accept some of the stranger complex strings
   that were previously allowed---e.g., complex('1..1j')
2009-04-24 12:46:53 +00:00
Eric Smith ebafbb705c Fixed issue 5782: formatting with commas didn't work if no specifier type code was given. 2009-04-22 16:20:47 +00:00
Eric Smith aca19e6a74 Backport of some of the work in r71665 to trunk. This reworks much of
int, long, and float __format__(), and it keeps their implementation
in sync with py3k.

Also added PyOS_double_to_string. This is the "fallback" version
that's also available in trunk, and should be kept in sync with that
code. I'll add an issue to document PyOS_double_to_string in the C
API.

There are many internal cleanups. Externally visible changes include:

- Implement PEP 378, Format Specifier for Thousands Separator, for
  floats, ints, and longs.

- Issue #5515: 'n' formatting for ints, longs, and floats handles
  leading zero formatting poorly.

- Issue #5772: For float.__format__, don't add a trailing ".0" if
  we're using no type code and we have an exponent.
2009-04-22 13:29:05 +00:00
Mark Dickinson 6736cf8d20 Issue #3166: Make long -> float (and int -> float) conversions
correctly rounded, using round-half-to-even.  This ensures that the
value of float(n) doesn't depend on whether we're using 15-bit digits
or 30-bit digits for Python longs.
2009-04-20 21:13:33 +00:00
Benjamin Peterson 8cfa8e613f make errors consistent 2009-04-19 02:40:43 +00:00
Benjamin Peterson 308c6ba002 initialize weakref some weakref types 2009-04-19 02:32:42 +00:00
Benjamin Peterson 01c6e6fb35 many more types to initialize (I had to expose some of them) 2009-04-18 22:15:26 +00:00
Benjamin Peterson 5ce73759bf initalize -> initialize 2009-04-18 20:25:25 +00:00
Benjamin Peterson d4d400cb8a try to initalize all builtin types with PyType_Ready to avoid problems like #5787 2009-04-18 20:12:47 +00:00
Benjamin Peterson d672001b03 rename internal bytes_ functions to bytearray 2009-04-18 15:31:34 +00:00
Georg Brandl f5fd523981 "not subscriptable" should be a bit more understandable than "unsubscriptable". 2009-04-18 08:26:21 +00:00
Benjamin Peterson 99d36f1563 call __float__ on str subclasses #5759
tests by R. David Murray
2009-04-15 21:26:36 +00:00
Eric Smith 8c023248ed Fixed incorrect object passed into format_float_internal(). This was resulting in a conversion being done twice. 2009-04-13 00:29:50 +00:00
Georg Brandl 517cfdcfd9 Whitespace normalization. 2009-04-05 13:16:35 +00:00
Georg Brandl d3eaa745a9 #5615: make it possible to configure --without-threads again. 2009-04-05 11:07:14 +00:00
Antoine Pitrou 789be0c0a0 Issue #2396: backport the memoryview object. 2009-04-02 21:18:34 +00:00
Mark Dickinson 48e3fd240f sys.long_info attributes should be ints, not longs 2009-04-02 18:39:37 +00:00
Georg Brandl 42827e91ee Fix a wrong struct field assignment (docstring as closure). 2009-03-31 01:25:15 +00:00
Mark Dickinson d4814bfa23 Issue #532631: Apply floatformat changes to unicodeobject.c
as well as stringobject.c.
2009-03-29 16:24:29 +00:00
Mark Dickinson 174e909842 Issue #532631: Add paranoid check to avoid potential buffer overflow
on systems with sizeof(int) > 4.
2009-03-29 16:17:16 +00:00
Mark Dickinson 2e648ecc7d Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test
with fabs(x) >= 1e50, and fix documentation.
2009-03-29 14:37:51 +00:00
Antoine Pitrou 1fba62427c The tracking statistics were actually too pessimistic 2009-03-23 19:17:00 +00:00
Antoine Pitrou f8387af262 Issue #4688: Add a heuristic so that tuples and dicts containing only
untrackable objects are not tracked by the garbage collector. This can
reduce the size of collections and therefore the garbage collection overhead
on long-running programs, depending on their particular use of datatypes.

(trivia: this makes the "binary_trees" benchmark from the Computer Language
Shootout 40% faster)
2009-03-23 18:41:45 +00:00
Mark Dickinson 0b666bfdf9 Issue #5512: speed up the long division algorithm for Python longs.
The basic algorithm remains the same; the most significant speedups
come from the following three changes:

  (1) normalize by shifting instead of multiplying and dividing
  (2) the old algorithm usually did an unnecessary extra iteration of
      the outer loop; remove this.  As a special case, this means that
      long divisions with a single-digit result run twice as fast as
      before.
  (3) make inner loop much tighter.

Various benchmarks show speedups of between 50% and 150% for long
integer divisions and modulo operations.
2009-03-23 18:25:13 +00:00
Hirokazu Yamamoto 52a3492efb There is no macro named SIZEOF_SSIZE_T. Should use SIZEOF_SIZE_T instead. 2009-03-21 10:32:52 +00:00
Mark Dickinson efc82f7e8e Issue #4258: Use 30-bit digits for Python longs, on 64-bit platforms.
Backport of r70459.
2009-03-20 15:51:55 +00:00
Benjamin Peterson 6ffe852f90 fix strange errors when setting attributes on tracebacks #4034 2009-03-18 20:52:15 +00:00
Mark Dickinson 6b265f1bf8 Issue 4474: On platforms with sizeof(wchar_t) == 4 and
sizeof(Py_UNICODE) == 2, PyUnicode_FromWideChar now converts
each character outside the BMP to the appropriate surrogate pair.

Thanks Victor Stinner for the patch.

(backport of r70452 from py3k to trunk)
2009-03-18 16:07:26 +00:00
Georg Brandl ed4cefbedd Fix a small nit in the error message if bool() falls back on __len__ and it returns the wrong type: it would tell the user that __nonzero__ should return bool or int. 2009-03-15 21:43:38 +00:00
Benjamin Peterson 1706c644ae fix tuple.index() error message #5495 2009-03-15 14:38:55 +00:00
Eric Smith 6f42edb682 Issue 5237, Allow auto-numbered replacement fields in str.format() strings.
For simple uses for str.format(), this makes the typing easier. Hopfully this
will help in the adoption of str.format().

For example:
'The {} is {}'.format('sky', 'blue')

You can mix and matcth auto-numbering and named replacement fields:
'The {} is {color}'.format('sky', color='blue')

But you can't mix and match auto-numbering and specified numbering:
'The {0} is {}'.format('sky', 'blue')
ValueError: cannot switch from manual field specification to automatic field numbering

Will port to 3.1.
2009-03-14 11:57:26 +00:00
Benjamin Peterson 9c1f7b2b04 fix funky indentation 2009-03-08 00:21:17 +00:00
Hirokazu Yamamoto a3e6c9763c Fixed memory leak on failure. 2009-03-05 09:34:14 +00:00
Mark Dickinson b646487687 Replace long with twodigits, to avoid depending
on sizeof(digit) < sizeof(long)
2009-02-25 20:29:50 +00:00
Mark Dickinson 3e4caeb3bf Issue #5341: Fix a variety of spelling errors. 2009-02-21 20:27:01 +00:00
Eric Smith e9fb6863da Issue #5247: Improve error message when unknown format codes are used when using str.format() with str, unicode, long, int, and float arguments. 2009-02-20 14:02:36 +00:00
Mark Dickinson bcf6b18eb7 A few more minor fixes in longobject.c 2009-02-15 15:48:39 +00:00
Mark Dickinson 2ffb26fb83 Issue #5260: Various portability and standards compliance fixes, optimizations
and cleanups in Objects/longobject.c.  The most significant change is that
longs now use less memory:  average savings are 2 bytes per long on 32-bit
systems and 6 bytes per long on 64-bit systems.  (This memory saving already
exists in py3k.)
2009-02-15 10:13:41 +00:00
Antoine Pitrou 9e8a250ed9 Fix compiler warning (gcc) 2009-02-13 13:57:40 +00:00
Antoine Pitrou 76a4b896c4 Issue #5186: Reduce hash collisions for objects with no __hash__ method by
rotating the object pointer by 4 bits to the right.
2009-02-13 13:52:33 +00:00
Georg Brandl cbb4958cd8 Fix warnings GCC emits where the argument of PyErr_Format is a single variable. 2009-02-13 11:06:59 +00:00
Mark Dickinson 4015f62e39 Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
negative arguments.  Previously, it raised TypeError.

Thanks Lisandro Dalcin.
2009-02-10 15:46:50 +00:00
Kristján Valur Jónsson 6a743d3694 Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions. 2009-02-10 13:32:24 +00:00
Mark Dickinson 10fe877dcd Issue #789290: make sure that hash(2**63) == hash(2.**63) on 64-bit
platforms.  The previous code was fragile, depending on the twin
accidents that:

  (1) in C, casting the double value 2.**63 to long returns the integer
      value -2**63, and
  (2) in Python, hash(-2**63) == hash(2**63).

There's already a test for this in test_hash.
2009-02-08 14:42:28 +00:00
Mark Dickinson b91d2f5bd3 Remove redundant assignment in _PyObject_LengthHint 2009-02-08 13:58:10 +00:00
Kristján Valur Jónsson fd4c872726 issue 4804: Provide checks for the format string of strftime, and for the "mode" string of fopen on Windows. These strings are user provided from python and so we can avoid invoking the C runtime invalid parameter handler by first checking that they are valid. 2009-02-04 10:05:25 +00:00
Raymond Hettinger d6fc2623c5 Validate that __length_hint__ returns a usable result. 2009-02-03 02:23:19 +00:00
Raymond Hettinger b516370bcb Issue 1242657: list(obj) can swallow KeyboardInterrupt. 2009-02-02 21:50:13 +00:00
Benjamin Peterson 1c5d21d644 fix indentation in comment 2009-01-31 22:33:02 +00:00
Benjamin Peterson be1399e39a fix indentation; looks like all I managed to do the first time is make things uglier 2009-01-31 22:03:19 +00:00
Benjamin Peterson d17fec74e5 fix indentation 2009-01-31 21:47:42 +00:00
Benjamin Peterson 857ce15791 completely detabify unicodeobject.c 2009-01-31 16:29:18 +00:00
Mark Dickinson a0eae0398c Fix comment. 2009-01-26 21:40:08 +00:00
Mark Dickinson 6ffa4a2a7d Fix undefined behaviour (left shift of negative value) in long_hash. Also,
rewrap a line of length > 79, and update comments.
2009-01-26 21:36:30 +00:00
Mark Dickinson 1afe6ddd07 No need for carry to be type twodigits in _PyLong_AsByteArray; digit is large enough.
This change should silence a compiler warning on Windows.
2009-01-25 22:12:31 +00:00
Hirokazu Yamamoto 1e234e8c19 Fixed compile error on windows. 2009-01-25 17:46:48 +00:00
Benjamin Peterson 78821ddf8c fix building the core with --disable-unicode
I changed some bytearray methods to use strings instead of unicode like bytes_repr
Also, bytearray.fromhex() can take strings as well as unicode
2009-01-25 17:15:10 +00:00
Mark Dickinson ff84aa87b4 Issue #4393: fix 3 classes of potential portability problems in longobject.c:
- fix some places where counters into ob_digit were declared as
   int instead of Py_ssize_t
 - add (twodigit) casts where necessary
 - fix code in _PyLong_AsByteArray that uses << on negative values
2009-01-24 15:27:44 +00:00
Benjamin Peterson e548d2487d fix url 2009-01-20 18:58:27 +00:00
Amaury Forgeot d'Arc 59ce042766 #4077: No need to append \n when calling Py_FatalError
+ fix a declaration to make it match the one in pythonrun.h
2009-01-17 20:18:59 +00:00
Amaury Forgeot d'Arc bd55c52565 #4930: Slightly cleaner (and faster) code in type creation:
compare slots by address, not by name.
2009-01-17 17:11:50 +00:00
Antoine Pitrou c2f02216b6 Issue #4935: The overflow checking code in the expandtabs() method common
to str, bytes and bytearray could be optimized away by the compiler, letting
the interpreter segfault instead of raising an error.
2009-01-13 23:13:52 +00:00
Amaury Forgeot d'Arc a40d573664 #3720: Interpreter crashes when an evil iterator removes its own next function.
Now the slot is filled with a function that always raises.

Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
2009-01-12 23:36:55 +00:00
Martin v. Löwis b90304acb9 Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t. 2009-01-07 18:40:40 +00:00
Antoine Pitrou aa687902f2 Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected. 2009-01-01 14:11:22 +00:00
Nick Coghlan 180e400766 Issue #4701: implicitly call PyType_Ready from PyObject_Hash 2008-12-30 01:18:48 +00:00
Benjamin Peterson fe231b07e4 #4764 set IOError.filename when trying to open a directory on POSIX platforms 2008-12-29 17:47:42 +00:00
Georg Brandl 6425a2fa8f Backport r67974:
#4759: allow None as first argument of bytearray.translate(), for consistency with bytes.translate().

Also fix segfault for bytearray.translate(x, None) -- will backport this part to 3.0 and 2.6.
2008-12-28 11:54:53 +00:00
Alexandre Vassalotti 034e08ce8d Remove unnecessary casts related to unicode_decode_call_errorhandler.
Make the _PyUnicode_Resize macro a static function.

These changes are needed to avoid breaking strict aliasing rules.
2008-12-27 06:36:10 +00:00
Benjamin Peterson f09925da67 add py3k warnings to frame.f_exc_* 2008-12-22 20:16:25 +00:00
Mark Dickinson 1a707981c8 Issue #3439: add bit_length method to int and long.
Thanks Fredrik Johansson and Victor Stinner for code,
Raymond Hettinger for review.
2008-12-17 16:14:37 +00:00
Amaury Forgeot d'Arc 3538a3107a #3632: the "pyo" macro from gdbinit can now run when the GIL is released.
Patch by haypo.
2008-12-15 22:29:14 +00:00
Antoine Pitrou ae5beceb35 Issue #4509: bugs in bytearray with exports (buffer protocol) 2008-12-06 21:29:24 +00:00
Mark Dickinson 826f3fefe5 Issue #4445: save 3 bytes (on average, on a typical machine) per
string allocation.
2008-12-05 21:55:28 +00:00
Raymond Hettinger 7989a4dccb Backport r67478 2008-12-03 15:42:10 +00:00
Amaury Forgeot d'Arc 2a1fd05971 Fix a small typo in docstring 2008-11-29 02:03:32 +00:00
Benjamin Peterson 46cc6d1102 make sure that bytearray methods return a new bytearray even if there is no change
Fixes #4348
Reviewed by Brett
2008-11-19 21:49:09 +00:00