summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
Commit message (Collapse)AuthorAgeFilesLines
* 00147-add-debug-malloc-stats.patchFedora Python maintainers2020-09-291-0/+9
| | | | | | | 00147 # Add a sys._debugmallocstats() function Based on patch 202 from RHEL 5's python.spec, with updates from rhbz#737198 Sent upstream as http://bugs.python.org/issue14785
* [2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)Serhiy Storchaka2018-07-311-1/+1
|
* consistently use Py_TYPE, Py_REFCNT, and correct initializer macros (#3563)Benjamin Peterson2017-09-141-26/+23
| | | This no-op change makes 2.7 more consistent with 3.x to ease comparison and backports.
* Issue #22463: Backport compiler warning fixes and workaroundsMartin Panter2016-06-211-1/+1
| | | | | | | | | | | | | | * Set but unused variable in Parser/pgen.c in non-debug builds. Patch by Christian Heimes. * Unused static function in Modules/readline.c. Patch by Georg Brandl. * main_window unused in Modules/tkappinit.c. Patch by Gregory P. Smith. * Dead assignment in Modules/_ctypes/cfield.c. Extracted from patch by Brett Cannon. * Expression result unused in PyObject_INIT macro expansions. Based on patches by Christian Heimes. * Load expat_config.h and therefore pyconfig.h before C stdlib headers are loaded. This silences pre-processor warnings including '_POSIX_C_SOURCE redefined'. Extracted from patch by Christian Heimes.
* Fix typo in comment.Raymond Hettinger2014-08-021-1/+1
|
* check for string attribute names in old-style classes (closes #14334)Benjamin Peterson2012-03-161-3/+27
|
* PyEval_CallObject requires a tuple of args (closes #13186)Benjamin Peterson2011-10-151-1/+1
|
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-2072/+2072
|
* Issue #8268: Old-style classes (not just instances) now support weakAntoine Pitrou2010-03-311-1/+4
| | | | references.
* remove the check that classmethod's argument is a callableBenjamin Peterson2009-09-011-4/+0
|
* generate py3k warnings on __getslice__, __delslice__, and __setslice__Benjamin Peterson2008-08-241-3/+24
| | | | Reviewer: Brett Cannon
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-87/+87
| | | | | | | 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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-87/+87
|
* Issue 2332: add new attribute names for instance method objectsNeal Norwitz2008-03-181-0/+4
|
* Implemented Martin's suggestion to clear the free lists during the garbage ↵Christian Heimes2008-02-141-2/+11
| | | | collection of the highest generation.
* Unified naming convention for free lists and their limits. All free listsChristian Heimes2008-02-061-2/+4
| | | | | | | | in Object/ are named ``free_list``, the counter ``numfree`` and the upper limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. The chances should make it easier to adjust Python for platforms with less memory, e.g. mobile phones.
* Limit free list of method and builtin function objects to 256 entries each.Christian Heimes2008-02-061-5/+18
|
* Make int() and long() fall back to __trunc__(). See issue 2002.Jeffrey Yasskin2008-02-041-1/+23
|
* Fix an edge case whereby the __del__() method of a classic class couldGuido van Rossum2008-01-181-0/+10
| | | | create a new weakref to the object.
* As per Armin Rigo's suggestion, remove special handing from intobject.c to ↵Kristján Valur Jónsson2007-05-071-1/+13
| | | | deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
* Correctly forward exception in instance_contains().Martin v. Löwis2006-11-081-4/+6
| | | | | Fixes #1591996. Patch contributed by Neal Norwitz. Will backport.
* Patch #1567691: super() and new.instancemethod() now don't acceptGeorg Brandl2006-09-301-0/+2
| | | | | keyword arguments any more (previously they accepted them, but didn't use them).
* Move initialization of interned strings to before allocating theNeal Norwitz2006-08-191-11/+15
| | | | | | object so we don't leak op. (Fixes an earlier patch to this code) Klockwork #350
* Can't return NULL from a void function. If there is a memory error,Neal Norwitz2006-08-141-2/+2
| | | | | about the best we can do is call PyErr_WriteUnraisable and go on. We won't be able to do the call below either, so verify delstr is valid.
* Handle a whole lot of failures from PyString_FromInternedString().Neal Norwitz2006-08-131-25/+101
| | | | Should fix most of Klocwork 234-272.
* Fix a couple of bugs exposed by the new __index__ code. The 64-bit buildbotsNeal Norwitz2006-08-121-6/+7
| | | | | | | | | | | were failing due to inappropriate clipping of numbers larger than 2**31 with new-style classes. (typeobject.c) In reviewing the code for classic classes, there were 2 problems. Any negative value return could be returned. Always return -1 if there was an error. Also make the checks similar with the new-style classes. I believe this is correct for 32 and 64 bit boxes, including Windows64. Add a test of classic classes too.
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-18/+6
| | | | | | | I modified this patch some by fixing style, some error checking, and adding XXX comments. This patch requires review and some changes are to be expected. I'm checking in now to get the greatest possible review and establish a baseline for moving forward. I don't want this to hold up release if possible.
* __hash__ may now return long int; the final hashMartin v. Löwis2006-08-091-5/+3
| | | | | value is obtained by invoking hash on the long int. Fixes #1536021.
* If a classic class defined a __coerce__() method that just returned its twoBrett Cannon2006-06-131-0/+3
| | | | | | | | arguments in reverse, the interpreter would infinitely recourse trying to get a coercion that worked. So put in a recursion check after a coercion is made and the next call to attempt to use the coerced values. Fixes bug #992017 and closes crashers/coerce.py .
* (arre, arigo) SF bug #1350060Armin Rigo2006-06-081-3/+14
| | | | | | Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'.
* Correct some value converting strangenesses.Georg Brandl2006-05-291-2/+2
|
* Simplify calling.Georg Brandl2006-05-261-8/+2
|
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-5/+2
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* Fix more ssize_t issues.Martin v. Löwis2006-04-221-5/+5
|
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-58/+11
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* More C++-compliance. Note especially listobject.c - to get C++ to accept theAnthony Baxter2006-04-111-27/+27
| | | | | | | | | PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
* Remove unnecessary casts in type object initializers.Georg Brandl2006-03-301-40/+40
|
* Stop duplicating code and handle slice indices consistently and correctlyNeal Norwitz2006-03-231-24/+3
| | | | wrt to ssize_t.
* Use macro versions instead of function versions when we already know the type.Neal Norwitz2006-03-201-5/+5
| | | | | | | | This will hopefully get rid of some Coverity warnings, be a hint to developers, and be marginally faster. Some asserts were added when the type is currently known, but depends on values from another function.
* Checking in the code for PEP 357.Guido van Rossum2006-03-071-0/+38
| | | | | | This was mostly written by Travis Oliphant. I've inspected it all; Neal Norwitz and MvL have also looked at it (in an earlier incarnation).
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Remove size constraints in SLICE opcodes.Martin v. Löwis2006-02-171-3/+3
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-22/+26
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* - On 64-bit platforms, when __len__() returns a value that cannot beGuido van Rossum2005-09-201-1/+1
| | | | | | | represented as a C int, raise OverflowError. (Forward port from 2.4.2; the patch to classobject.c was already in but needed a correction in the error message text.)
* A minor fix for 64-bit platforms: when __len__() returns Python intGuido van Rossum2005-09-191-1/+11
| | | | | | containing a value that doesn't fit in a C int, raise OverflowError rather than truncating silently (and having 50% chance of hitting the "it should be >= 0" error).
* Insert missing flag.Raymond Hettinger2005-06-191-1/+1
|
* Fix for rather inaccurately titled bugMichael W. Hudson2005-03-301-0/+6
| | | | | | | | | [ 1165306 ] Property access with decorator makes interpreter crash Don't allow the creation of unbound methods with NULL im_class, because attempting to call such crashes. Backport candidate.
* A static swapped_op[] array was defined in 3 different C files, & I thinkTim Peters2004-09-231-4/+1
| | | | | I need to define it again. Bite the bullet and define it once as an extern, _Py_SwappedOp[].
* Repair the same thinko in two places about handling of _Py_RefTotal inMichael W. Hudson2004-08-031-6/+7
| | | | | | | the case of __del__ resurrecting an object. This makes the apparent reference leaks in test_descr go away (which I expected) and also kills off those in test_gc (which is more surprising but less so once you actually think about it a bit).