Antoine Pitrou
c5bef75c77
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:16:51 +02:00
Benjamin Peterson
f1ae5cf5c7
fix possible refleak ( closes #14752 )
2012-05-08 09:22:24 -04:00
Benjamin Peterson
d157a4c3dd
don't use a slot wrapper from a different special method ( closes #14658 )
...
This also alters the fix to #11603 . Specifically, setting __repr__ to
object.__str__ now raises a recursion RuntimeError when str() or repr() is
called instead of silently bypassing the recursion. I believe this behavior is
more correct.
2012-04-24 11:06:25 -04:00
Benjamin Peterson
6e7832b04c
check to make sure the attribute is a string ( #14334 )
2012-03-16 09:32:59 -05:00
Benjamin Peterson
a8d458560e
allow cycles throught the __dict__ slot to be cleared ( closes #1469629 )
...
Patch from Armin, test from me.
2012-03-07 18:41:11 -06:00
Antoine Pitrou
5b4b2da55d
Fix the fix for issue #12149 : it was incorrect, although it had the side
...
effect of appearing to resolve the issue. Thanks to Mark Shannon for
noticing.
2011-12-15 14:15:31 +01:00
Eli Bendersky
d784185303
Issue #13161 : fix doc strings of __i*__ operators
2011-11-11 16:52:16 +02:00
Benjamin Peterson
de66ecc75f
fix possible refleaks
2011-08-16 22:26:48 -05:00
Antoine Pitrou
304f0f952d
Issue #11603 : Fix a crash when __str__ is rebound as __repr__.
...
Patch by Andreas Stührk.
2011-07-15 21:22:50 +02:00
Antoine Pitrou
1616645a00
Issue #12149 : Update the method cache after a type's dictionnary gets
...
cleared by the garbage collector. This fixes a segfault when an instance
and its type get caught in a reference cycle, and the instance's
deallocator calls one of the methods on the type (e.g. when subclassing
IOBase).
Diagnosis and patch by Davide Rizzo.
2011-07-12 22:04:20 +02:00
Benjamin Peterson
80a09c70bf
use '->' to indicate return values
2011-05-24 12:42:51 -05:00
Ezio Melotti
c2077b0d9b
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 12:34:31 +02:00
Benjamin Peterson
fba33478a5
Merged revisions 88069 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88069 | benjamin.peterson | 2011-01-17 13:54:55 -0600 (Mon, 17 Jan 2011) | 1 line
remove unneeded assertion
........
2011-01-17 19:57:01 +00:00
Benjamin Peterson
cd8500193f
Merged revisions 88066 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88066 | benjamin.peterson | 2011-01-17 13:44:46 -0600 (Mon, 17 Jan 2011) | 1 line
correct assertion
........
2011-01-17 19:48:58 +00:00
Benjamin Peterson
cf94b8b4da
Merged revisions 88063 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88063 | benjamin.peterson | 2011-01-17 13:24:34 -0600 (Mon, 17 Jan 2011) | 4 lines
turn some checks into assertions, since they are implied by the caller
Reviewed by Georg.
........
2011-01-17 19:30:29 +00:00
Benjamin Peterson
f4676b0378
Merged revisions 87960 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87960 | benjamin.peterson | 2011-01-12 12:56:07 -0600 (Wed, 12 Jan 2011) | 1 line
use PyErr_SetString instead of PyErr_Format
........
2011-01-12 19:00:37 +00:00
Benjamin Peterson
9b911ca14d
Merged revisions 87952-87954 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87952 | benjamin.peterson | 2011-01-12 09:24:27 -0600 (Wed, 12 Jan 2011) | 1 line
move this test to test_descr; it's not abc specific
........
r87953 | benjamin.peterson | 2011-01-12 09:25:02 -0600 (Wed, 12 Jan 2011) | 1 line
oops, wrong class
........
r87954 | benjamin.peterson | 2011-01-12 09:34:01 -0600 (Wed, 12 Jan 2011) | 1 line
don't segfault on deleting __abstractmethods__ #10892
........
2011-01-12 15:49:47 +00:00
Benjamin Peterson
35c6be0b74
Merged revisions 85193 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85193 | benjamin.peterson | 2010-10-02 21:13:39 -0500 (Sat, 02 Oct 2010) | 1 line
typo
........
2010-10-03 02:17:04 +00:00
Benjamin Peterson
a5d5cc45c9
Merged revisions 85154 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85154 | benjamin.peterson | 2010-10-01 19:03:31 -0500 (Fri, 01 Oct 2010) | 1 line
type.__abstractmethods__ should raise an AttributeError #10006
........
2010-10-02 00:08:58 +00:00
Benjamin Peterson
6f3d6a9b23
Merged revisions 84320 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84320 | benjamin.peterson | 2010-08-25 18:13:17 -0500 (Wed, 25 Aug 2010) | 1 line
basicsize and itemsize are Py_ssize_t #9688
........
2010-08-25 23:17:42 +00:00
Alexander Belopolsky
b8de9fab30
Merged revisions 84106 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84106 | alexander.belopolsky | 2010-08-16 16:17:07 -0400 (Mon, 16 Aug 2010) | 1 line
Issue #8983 : Corrected docstrings.
........
2010-08-16 20:30:26 +00:00
Mark Dickinson
77acee9567
Fix comment typo.
2010-06-05 12:51:21 +00:00
Mark Dickinson
e4b83e013b
Issue #8627 : Fix "XXX undetected error" from unchecked PyErr_WarnPy3k return.
...
This is just a quick fix: if the warning is turned into an exception, the
exception simply gets ignored.
2010-06-05 12:14:43 +00:00
Mark Dickinson
23f0d6b57b
Issue #8627 : remove out-of-date warning about overriding __cmp__
2010-06-05 11:52:24 +00:00
Benjamin Peterson
67783b1f71
fix ref counting
2010-06-05 01:00:10 +00:00
Benjamin Peterson
039c585805
implement object.__format__ with PyObject_Format
2010-06-05 00:56:46 +00:00
Antoine Pitrou
c83ea137d7
Untabify C files. Will watch buildbots.
2010-05-09 14:46:46 +00:00
Brett Cannon
8a478ced55
Remove an unneeded assignment.
...
Found using Clang's static analyzer.
2010-05-05 20:19:26 +00:00
Eric Smith
d44b2fc87c
Issue 7994: Make object.__format__ with a non-empty format string a PendingDecprecationWarning. Still need to remove uses of this from various tests.
2010-04-02 12:30:56 +00:00
Benjamin Peterson
0c0dcaf272
remove type_compare, since type_richcompare does the same trick
2009-12-16 03:36:22 +00:00
Benjamin Peterson
4895af4ef1
fix the ignoring of __cmp__ method on metaclasses #7491
2009-12-13 16:36:53 +00:00
Benjamin Peterson
fb6fb062e8
properly lookup __instancecheck__ and __subclasscheck__
2009-05-16 21:44:25 +00:00
Benjamin Peterson
0a32f9c448
can't handle classic classes here
2009-05-09 17:13:10 +00:00
Benjamin Peterson
399e4c4f8f
add _PyObject_LookupSpecial to handle fetching special method lookup
2009-05-08 03:06:00 +00:00
Benjamin Peterson
5083dc552b
fix a segfault when setting __class__ in __del__ #5283
2009-04-25 00:41:22 +00:00
Antoine Pitrou
789be0c0a0
Issue #2396 : backport the memoryview object.
2009-04-02 21:18:34 +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
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
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
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
Benjamin Peterson
273c233c78
when __getattr__ is a descriptor, call it correctly; fixes #4230
...
patch from Ziga Seilnacht
2008-11-17 22:39:09 +00:00
Antoine Pitrou
0668c62677
Issue #2534 : speed up isinstance() and issubclass() by 50-70%, so as to
...
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
mechanism. In the process, fix a bug where isinstance() and issubclass(),
when given a tuple of classes as second argument, were looking up
__instancecheck__ / __subclasscheck__ on the tuple rather than on each
type object.
Reviewed by Benjamin Peterson and Raymond Hettinger.
2008-08-26 22:42:08 +00:00
Benjamin Peterson
712ee92309
generate py3k warnings on __getslice__, __delslice__, and __setslice__
...
Reviewer: Brett Cannon
2008-08-24 18:10:20 +00:00
Nick Coghlan
48361f5cbf
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
2008-08-11 15:45:58 +00:00
Nick Coghlan
53663a695e
Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful
2008-07-15 14:27:37 +00:00
Raymond Hettinger
9c437af4eb
Revert 64424, 64438, and 64439.
2008-06-24 22:46:07 +00:00
Raymond Hettinger
e3ae655edf
Make bin() implementation parallel oct() and hex() so that int/long subclasses can override or so that other classes can support.
2008-06-20 04:18:15 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Georg Brandl
7a6de8b0f4
Some style nits. Also clarify in the docstrings what __sizeof__ does.
2008-06-01 16:42:16 +00:00
Robert Schuppenies
51df064767
Issue #2898 : Added sys.getsizeof() to retrieve size of objects in bytes.
2008-06-01 16:16:17 +00:00